From a0ab5be6f2dff7e9807e745ce2c8cc3650631571 Mon Sep 17 00:00:00 2001 From: Tom Butcher Date: Mon, 14 Jul 2025 23:08:33 +0100 Subject: [PATCH] Add danger property to action items in ObjectActions component and refine action filtering logic --- src/components/Dashboard/common/ObjectActions.jsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/Dashboard/common/ObjectActions.jsx b/src/components/Dashboard/common/ObjectActions.jsx index 39495ef..cbe80f5 100644 --- a/src/components/Dashboard/common/ObjectActions.jsx +++ b/src/components/Dashboard/common/ObjectActions.jsx @@ -14,6 +14,7 @@ function mapActionsToMenuItems(actions, currentUrlWithActions, id) { const item = { key: action.key || action.name, label: action.label, + danger: action?.danger || false, icon: action.icon ? React.createElement(action.icon) : undefined, disabled: actionUrl && actionUrl === currentUrlWithActions } @@ -53,11 +54,10 @@ const ObjectActions = ({ location.search ) - console.log('curr url', currentUrlWithoutActions) - - // Filter out actions whose url matches currentUrl const filteredActions = actions.filter( - (action) => !(action.url(id) && action.url(id) === currentUrlWithoutActions) + (action) => + typeof action.url !== 'function' || + action.url(id) !== currentUrlWithoutActions ) const currentUrlWithActions = location.pathname + location.search