Skip to content

Commit

Permalink
[GEN-2042]: do not display warning when closing drawer of "unknown in…
Browse files Browse the repository at this point in the history
…strumentation 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.
  • Loading branch information
BenElferink authored Dec 19, 2024
1 parent fc1772b commit c1958de
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export const RuleDrawer: React.FC<Props> = () => {
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);
Expand Down

0 comments on commit c1958de

Please sign in to comment.