diff --git a/frontend/src/container/AllAlertChannels/AlertChannels.tsx b/frontend/src/container/AllAlertChannels/AlertChannels.tsx index 000937b8cb..974530c6e5 100644 --- a/frontend/src/container/AllAlertChannels/AlertChannels.tsx +++ b/frontend/src/container/AllAlertChannels/AlertChannels.tsx @@ -17,7 +17,7 @@ function AlertChannels({ allChannels }: AlertChannelsProps): JSX.Element { const [notifications, Element] = notification.useNotification(); const [channels, setChannels] = useState(allChannels); const { role } = useSelector((state) => state.app); - const [action] = useComponentPermission(['action'], role); + const [action] = useComponentPermission(['new_alert_action'], role); const onClickEditHandler = useCallback((id: string) => { history.replace( diff --git a/frontend/src/container/ListOfDashboard/index.tsx b/frontend/src/container/ListOfDashboard/index.tsx index 9711a47f8d..64f3f573c1 100644 --- a/frontend/src/container/ListOfDashboard/index.tsx +++ b/frontend/src/container/ListOfDashboard/index.tsx @@ -38,8 +38,8 @@ function ListOfAllDashboard(): JSX.Element { ); const { role } = useSelector((state) => state.app); - const [action, createNewDashboard] = useComponentPermission( - ['action', 'create_new_dashboards'], + const [action, createNewDashboard, newDashboard] = useComponentPermission( + ['action', 'create_new_dashboards', 'new_dashboard'], role, ); @@ -205,20 +205,28 @@ function ListOfAllDashboard(): JSX.Element { url: 'https://signoz.io/docs/userguide/dashboards', }} /> - - } - type="primary" - loading={newDashboardState.loading} - danger={newDashboardState.error} - > - {getText()} - - + {newDashboard && ( + + } + type="primary" + loading={newDashboardState.loading} + danger={newDashboardState.error} + > + {getText()} + + + )} ), - [getText, menu, newDashboardState.error, newDashboardState.loading], + [ + getText, + menu, + newDashboard, + newDashboardState.error, + newDashboardState.loading, + ], ); return ( diff --git a/frontend/src/utils/permission/index.ts b/frontend/src/utils/permission/index.ts index 71d8b09c39..16aab26ad1 100644 --- a/frontend/src/utils/permission/index.ts +++ b/frontend/src/utils/permission/index.ts @@ -14,8 +14,11 @@ export type ComponentTypes = | 'save_layout' | 'edit_dashboard' | 'delete_widget' + | 'new_dashboard' + | 'new_alert_action'; | 'edit_widget'; + export const componentPermission: Record = { current_org_settings: ['ADMIN'], invite_members: ['ADMIN'], @@ -29,7 +32,10 @@ export const componentPermission: Record = { save_layout: ['ADMIN', 'EDITOR'], edit_dashboard: ['ADMIN', 'EDITOR'], delete_widget: ['ADMIN', 'EDITOR'], + new_dashboard: ['ADMIN', 'EDITOR'], + new_alert_action: ['ADMIN'], edit_widget: ['ADMIN', 'EDITOR'], + }; export const routePermission: Record = {