Skip to content
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

Conversation

djindjic
Copy link
Contributor

@djindjic djindjic commented Dec 13, 2022

Description

Reusing existing Rule details flyout in Findings and Alerts page

Issues Resolved

Closes #124

Check List

  • Commits are signed per the DCO using --signoff

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.

@djindjic djindjic requested a review from a team December 13, 2022 21:38
Signed-off-by: Aleksandar Djindjic <[email protected]>
Comment on lines 56 to 61
if (!history) {
return;
}
history.push({
pathname: ROUTES.RULES_EDIT,
state: { ruleItem: ruleTableItem.ruleInfo },
Copy link
Collaborator

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(...)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Comment on lines 46 to 49
if (!history) {
return;
}
history.push({
Copy link
Collaborator

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(...)

Copy link
Contributor Author

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) {
Copy link
Collaborator

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

Copy link
Contributor Author

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,
Copy link
Collaborator

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?

Copy link
Contributor Author

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,
Copy link
Collaborator

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?

Copy link
Contributor Author

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]>
@amsiglan amsiglan merged commit 11e47b3 into opensearch-project:main Dec 16, 2022
opensearch-trigger-bot bot pushed a commit that referenced this pull request Dec 16, 2022
* 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)
amsiglan pushed a commit that referenced this pull request Dec 19, 2022
* 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]>
AWSHurneyt pushed a commit to AWSHurneyt/security-analytics-dashboards-plugin that referenced this pull request Feb 22, 2023
…#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]>
AWSHurneyt pushed a commit to AWSHurneyt/security-analytics-dashboards-plugin that referenced this pull request Oct 12, 2023
…#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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEATURE] Finding details flyout - clicking on rule name should trigger Rule details flyout
3 participants