-
Notifications
You must be signed in to change notification settings - Fork 12k
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
Alerting: alert list state view #33020
Conversation
This looks soo good 👍 . Probably will have to do something with the big group names, but anyway awesome work! |
🌞 |
5fde045
to
48dfb46
Compare
9589a05
to
bc4aa80
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.
I no longer get "An unexpected error happened" on my instance on this branch, so I like it 🥇 :-)
|
||
const styles = useStyles(getStyles); | ||
const tableStyles = useStyles(getAlertTableStyles); | ||
|
||
const [expandedKeys, setExpandedKeys] = useState<string[]>([]); | ||
|
||
const [ruleToDelete, setRuleToDelete] = useState<RulerRuleDTO>(); | ||
const [ruleToDelete, setRuleToDelete] = useState<CombinedRule>(); | ||
|
||
const toggleExpandedState = (ruleKey: string) => | ||
setExpandedKeys( | ||
expandedKeys.includes(ruleKey) ? expandedKeys.filter((key) => key !== ruleKey) : [...expandedKeys, ruleKey] | ||
); | ||
|
||
const deleteRule = () => { |
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.
Question: why not just dispatch the deleteRuleAction
on click instead of doing it on next render after we set the state? Probably me that is missing something.
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.
setting ruleToDelete
triggers a confirmation modal to be shown, but does not disaptch the delete action.
delete action is dispatched once user clicks confirmation button on the modal
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.
ah, ok ok - got it! Makes sense now.
rules: [], | ||
}; | ||
combinedGroup.rules = group.rules.map( | ||
(rule): CombinedRule => |
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: I think this code should be split up into multiple smaller functions to improve readability and prevent nesting.
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.
- break it up a little
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.
broke it up into several hopefully well-named functions
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.
Left some small nits but overall I think it looks good! Great work moving this forward!
Thanks!! I will fix the nits, but please approve so I can merge things and keep moving :) |
bc4aa80
to
49b1a6a
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.
LGTM
Nailed together a rule list view that shows rules by state.
Some types were rejiggled to make it work
state-view.mp4
What this PR does / why we need it:
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer: