New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Alertmanager: Refactored #3937
Alertmanager: Refactored #3937
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @dtaylor113, I'm still working through this, but wanted to get you some initial comments. I'm a little concerned with this approach since we lose type safety.
frontend/public/components/monitoring/receiver-forms/alert-manager-receiver-forms.tsx
Outdated
Show resolved
Hide resolved
frontend/public/components/monitoring/receiver-forms/alert-manager-receiver-forms.tsx
Outdated
Show resolved
Hide resolved
frontend/public/components/monitoring/receiver-forms/alert-manager-receiver-forms.tsx
Outdated
Show resolved
Hide resolved
frontend/public/components/monitoring/receiver-forms/alert-manager-receiver-forms.tsx
Outdated
Show resolved
Hide resolved
103f9fa
to
efd460d
Compare
Hi @spadgett , I believe I have addressed the majority of your initial review comments. Please see last commit for these updates, and additional comments above for unresolved issues. For fixed comments, I tag each comment as 'fixed' then resolve the conversation -let me know if this is ok for you, I feel it cleans up the code review and just leaves any open issues visible, but it could be annoying to you so I'm just checking :-) |
343dad8
to
671c816
Compare
/retest |
671c816
to
13e974d
Compare
frontend/public/components/monitoring/receiver-forms/pagerduty-receiver-form.tsx
Outdated
Show resolved
Hide resolved
frontend/public/components/monitoring/receiver-forms/pagerduty-receiver-form.tsx
Outdated
Show resolved
Hide resolved
frontend/public/components/monitoring/receiver-forms/webhook-receiver-form.tsx
Outdated
Show resolved
Hide resolved
frontend/public/components/monitoring/receiver-forms/routing-labels-editor.tsx
Outdated
Show resolved
Hide resolved
frontend/public/components/monitoring/receiver-forms/routing-labels-editor.tsx
Outdated
Show resolved
Hide resolved
frontend/public/components/monitoring/receiver-forms/routing-labels-editor.tsx
Outdated
Show resolved
Hide resolved
frontend/public/components/monitoring/receiver-forms/routing-labels-editor.tsx
Outdated
Show resolved
Hide resolved
frontend/public/components/monitoring/receiver-forms/routing-labels-editor.tsx
Outdated
Show resolved
Hide resolved
13e974d
to
0fd6955
Compare
Hi @spadgett, thanks for round of comments, I believe I have addressed them. Please see last commits for changes. |
832758b
to
5a2398f
Compare
frontend/public/components/monitoring/receiver-forms/routing-labels-editor.tsx
Show resolved
Hide resolved
frontend/public/components/monitoring/receiver-forms/routing-labels-editor.tsx
Show resolved
Hide resolved
frontend/public/components/monitoring/receiver-forms/alert-manager-receiver-forms.tsx
Outdated
Show resolved
Hide resolved
frontend/public/components/monitoring/receiver-forms/alert-manager-receiver-forms.tsx
Outdated
Show resolved
Hide resolved
frontend/public/components/monitoring/receiver-forms/alert-manager-receiver-forms.tsx
Outdated
Show resolved
Hide resolved
5a2398f
to
1902b50
Compare
frontend/public/components/monitoring/receiver-forms/alert-manager-receiver-forms.tsx
Outdated
Show resolved
Hide resolved
frontend/public/components/monitoring/receiver-forms/alert-manager-receiver-forms.tsx
Outdated
Show resolved
Hide resolved
dropDownClassName="dropdown--full-width" | ||
data-test-id="receiver-type" | ||
selectedKey={formValues.receiverType} | ||
onChange={(e) => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't an event, so e
as a name is misleading.
onChange={(e) => | |
onChange={(receiverType) => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
frontend/public/components/monitoring/receiver-forms/alert-manager-receiver-forms.tsx
Outdated
Show resolved
Hide resolved
frontend/public/components/monitoring/receiver-forms/pagerduty-receiver-form.tsx
Outdated
Show resolved
Hide resolved
frontend/public/components/monitoring/receiver-forms/pagerduty-receiver-form.tsx
Outdated
Show resolved
Hide resolved
frontend/public/components/monitoring/receiver-forms/pagerduty-receiver-form.tsx
Outdated
Show resolved
Hide resolved
1a39279
to
c68a971
Compare
cc32a5a
to
1a66fee
Compare
/retest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @dtaylor113. This is looking a lot cleaner 👍
@@ -0,0 +1,3 @@ | |||
import { $ } from 'protractor'; | |||
|
|||
export const firstDropdownMenuByTestID = (id: string) => $(`[data-test-dropdown-menu=${id}]`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Drop the first
prefix :)
export const firstDropdownMenuByTestID = (id: string) => $(`[data-test-dropdown-menu=${id}]`); | |
export const dropdownMenuForID = (id: string) => $(`[data-test-dropdown-menu=${id}]`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
} | ||
}; | ||
|
||
function formReducer(formValues, action) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
function formReducer(formValues, action) { | |
const formReducer = (formValues, action) => { |
Would be nice to have types here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
config = getAlertmanagerConfig(secret, setErrorMsg); | ||
} | ||
|
||
const INITIAL_STATE = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: why all caps in the name?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just so it stands out more as it's being setup in the next couple of code blocks
|
||
const isFormInvalid = | ||
_.isEmpty(formValues.receiverName) || | ||
_.isEmpty(formValues.receiverType) || |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If these are strings, you don't need to use _.isEmpty
, just !formValues.receiverName
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, I had these fixed in large PR we closed, it was one of Ben's initial comments. Lost them in recreating this PR. fixed
}; | ||
|
||
export const isFormInvalid = (formValues): boolean => { | ||
return _.isEmpty(formValues.pagerDutyIntegrationKey); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just a string, right?
return _.isEmpty(formValues.pagerDutyIntegrationKey); | |
return !formValues.pagerDutyIntegrationKey; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
return _.isEmpty(receiverConfig) | ||
? { webhookUrl: '' } | ||
: { | ||
webhookUrl: receiverConfig?.url, | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this could be
return {
webhookURL: receiverConfig?.url || ''
};
If this is not a prop in the Alertmanager config, use webhookURL
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
}; | ||
|
||
export const isFormInvalid = (formValues) => { | ||
return _.isEmpty(formValues.webhookUrl); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return _.isEmpty(formValues.webhookUrl); | |
return !formValues.webhookUrl; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
1a66fee
to
d162c1e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/approve
/lgtm
Thanks for your patience @dtaylor113
/hold @dtaylor113 do you mind squashing? |
d162c1e
to
da62eb0
Compare
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: dtaylor113, spadgett The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/retest Please review the full test history for this PR and help us cut down flakes. |
/hold |
/hold cancel |
Refactored:
getAlertManagerYAML
method in utils