From c1958de1e81140e31899483e614b175cf671c7cc Mon Sep 17 00:00:00 2001 From: Ben Elferink Date: Thu, 19 Dec 2024 20:08:14 +0200 Subject: [PATCH] [GEN-2042]: do not display warning when closing drawer of "unknown instrumentation rule" (#2036) This pull request includes a small but important change to the `RuleDrawer` component in the `frontend/webapp/containers/main/instrumentation-rules/rule-drawer/index.tsx` file. The change adds an additional condition to the `handleEdit` function to improve the handling of unknown rule types. * [`frontend/webapp/containers/main/instrumentation-rules/rule-drawer/index.tsx`](diffhunk://#diff-759940924dd4ee0c6895f60e21ca040542d9cf1d3f69162677c9983d62b12f8cL76-R76): Modified the `handleEdit` function to include a condition that checks if the `bool` parameter is `true` or `undefined` before adding a notification for unknown rule types. --- .../containers/main/instrumentation-rules/rule-drawer/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/webapp/containers/main/instrumentation-rules/rule-drawer/index.tsx b/frontend/webapp/containers/main/instrumentation-rules/rule-drawer/index.tsx index 8002a49b2..cdcbfeda9 100644 --- a/frontend/webapp/containers/main/instrumentation-rules/rule-drawer/index.tsx +++ b/frontend/webapp/containers/main/instrumentation-rules/rule-drawer/index.tsx @@ -71,7 +71,7 @@ export const RuleDrawer: React.FC = () => { const { id, item } = selectedItem as { id: string; item: InstrumentationRuleSpecMapped }; const handleEdit = (bool?: boolean) => { - if (item.type === InstrumentationRuleType.UNKNOWN_TYPE) { + if (item.type === InstrumentationRuleType.UNKNOWN_TYPE && (bool || bool === undefined)) { addNotification({ type: NOTIFICATION_TYPE.WARNING, title: FORM_ALERTS.FORBIDDEN, message: FORM_ALERTS.CANNOT_EDIT_RULE, crdType: OVERVIEW_ENTITY_TYPES.RULE, target: id }); } else { setIsEditing(typeof bool === 'boolean' ? bool : true);