-
Notifications
You must be signed in to change notification settings - Fork 48
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
Rule flyout opening from Findings and Alerts page #219
Rule flyout opening from Findings and Alerts page #219
Conversation
Signed-off-by: Aleksandar Djindjic <[email protected]>
Signed-off-by: Aleksandar Djindjic <[email protected]>
if (!history) { | ||
return; | ||
} | ||
history.push({ | ||
pathname: ROUTES.RULES_EDIT, | ||
state: { ruleItem: ruleTableItem.ruleInfo }, |
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.
Can we clubbed into
history?.push(...)
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.
done
if (!history) { | ||
return; | ||
} | ||
history.push({ |
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.
Club together into
history?.push(...)
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.
done
@@ -74,6 +81,9 @@ export const RuleViewerFlyout: React.FC<RuleViewerFlyoutProps> = ({ | |||
}; | |||
|
|||
const onDeleteRuleConfirmed = async () => { | |||
if (!ruleService) { | |||
return; | |||
} | |||
const deleteRuleRes = await ruleService.deleteRule(ruleTableItem.ruleId); | |||
|
|||
if (!deleteRuleRes.ok) { |
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.
Let's fix this Todo? we can show an error toast saying Failed to delete rule
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.
check this commit, I think its a right error handling here now:
dae1c8f#diff-ddf4d433db9a97c023d49ad7aeb681cf5376c5248d42f51246485942e687863fR86
@@ -45,6 +50,8 @@ export default class FindingDetailsFlyout extends Component< | |||
super(props); | |||
this.state = { | |||
loading: false, | |||
ruleViewerFlyoutShown: false, |
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 boolean seems redundant since we are anyways rendering the flyout based on the data. I think just ruleViewerFlyoutData
is enough for check. Thoughts?
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.
Totally right. I've cleaned it up
source: fullRule.source, | ||
ruleInfo: { | ||
_source: fullRule, | ||
} as any, |
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.
Why do we need to use as any
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.
I've changed it to as RuleItemInfoBase
which is more appropriate.
TS assertion is needed because we don't have all the data to construct whole object. Other properties are anyway not in use in the Rule flyout.
Let me know if you have some better idea.
Signed-off-by: Aleksandar Djindjic <[email protected]>
Signed-off-by: Aleksandar Djindjic <[email protected]>
Signed-off-by: Aleksandar Djindjic <[email protected]>
Signed-off-by: Aleksandar Djindjic <[email protected]>
Signed-off-by: Aleksandar Djindjic <[email protected]>
* rule flyout opening from findings and alerts page Signed-off-by: Aleksandar Djindjic <[email protected]> * update cypress test for findings page Signed-off-by: Aleksandar Djindjic <[email protected]> * make code shorter Signed-off-by: Aleksandar Djindjic <[email protected]> * toast error notifications for rule deletion Signed-off-by: Aleksandar Djindjic <[email protected]> * cleanup component state Signed-off-by: Aleksandar Djindjic <[email protected]> * avoid as any in favor of RuleItemInfoBase Signed-off-by: Aleksandar Djindjic <[email protected]> * fix cypress test for rules Signed-off-by: Aleksandar Djindjic <[email protected]> Signed-off-by: Aleksandar Djindjic <[email protected]> (cherry picked from commit 11e47b3)
* rule flyout opening from findings and alerts page Signed-off-by: Aleksandar Djindjic <[email protected]> * update cypress test for findings page Signed-off-by: Aleksandar Djindjic <[email protected]> * make code shorter Signed-off-by: Aleksandar Djindjic <[email protected]> * toast error notifications for rule deletion Signed-off-by: Aleksandar Djindjic <[email protected]> * cleanup component state Signed-off-by: Aleksandar Djindjic <[email protected]> * avoid as any in favor of RuleItemInfoBase Signed-off-by: Aleksandar Djindjic <[email protected]> * fix cypress test for rules Signed-off-by: Aleksandar Djindjic <[email protected]> Signed-off-by: Aleksandar Djindjic <[email protected]> (cherry picked from commit 11e47b3) Co-authored-by: Aleksandar Djindjic <[email protected]>
…#219) (opensearch-project#230) * rule flyout opening from findings and alerts page Signed-off-by: Aleksandar Djindjic <[email protected]> * update cypress test for findings page Signed-off-by: Aleksandar Djindjic <[email protected]> * make code shorter Signed-off-by: Aleksandar Djindjic <[email protected]> * toast error notifications for rule deletion Signed-off-by: Aleksandar Djindjic <[email protected]> * cleanup component state Signed-off-by: Aleksandar Djindjic <[email protected]> * avoid as any in favor of RuleItemInfoBase Signed-off-by: Aleksandar Djindjic <[email protected]> * fix cypress test for rules Signed-off-by: Aleksandar Djindjic <[email protected]> Signed-off-by: Aleksandar Djindjic <[email protected]> (cherry picked from commit 11e47b3) Co-authored-by: Aleksandar Djindjic <[email protected]> Signed-off-by: AWSHurneyt <[email protected]>
…#219) (opensearch-project#230) * rule flyout opening from findings and alerts page Signed-off-by: Aleksandar Djindjic <[email protected]> * update cypress test for findings page Signed-off-by: Aleksandar Djindjic <[email protected]> * make code shorter Signed-off-by: Aleksandar Djindjic <[email protected]> * toast error notifications for rule deletion Signed-off-by: Aleksandar Djindjic <[email protected]> * cleanup component state Signed-off-by: Aleksandar Djindjic <[email protected]> * avoid as any in favor of RuleItemInfoBase Signed-off-by: Aleksandar Djindjic <[email protected]> * fix cypress test for rules Signed-off-by: Aleksandar Djindjic <[email protected]> Signed-off-by: Aleksandar Djindjic <[email protected]> (cherry picked from commit 11e47b3) Co-authored-by: Aleksandar Djindjic <[email protected]> Signed-off-by: AWSHurneyt <[email protected]>
Description
Reusing existing Rule details flyout in Findings and Alerts page
Issues Resolved
Closes #124
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.