Skip to content

SigNoz is an open-source, OpenTelemetry-native observability platform for your team and their AI agents. Get logs, metrics, and traces in one tool with features like APM, distributed tracing, log management, infra monitoring, etc. Combined with SigNoz MCP and a native AI teammate (in SigNoz Cloud) it helps you build more resilient apps.

chore: new dashboard permission is added for editor and admin (#1077)

palash-signoz9cf5c7ef74bc
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<Channels[]>(allChannels);
const { role } = useSelector<AppState, AppReducer>((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<AppState, AppReducer>((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',
}}
/>
- <Dropdown trigger={['click']} overlay={menu}>
- <NewDashboardButton
- icon={<PlusOutlined />}
- type="primary"
- loading={newDashboardState.loading}
- danger={newDashboardState.error}
- >
- {getText()}
- </NewDashboardButton>
- </Dropdown>
+ {newDashboard && (
+ <Dropdown trigger={['click']} overlay={menu}>
+ <NewDashboardButton
+ icon={<PlusOutlined />}
+ type="primary"
+ loading={newDashboardState.loading}
+ danger={newDashboardState.error}
+ >
+ {getText()}
+ </NewDashboardButton>
+ </Dropdown>
+ )}
</ButtonContainer>
</Row>
),
- [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<ComponentTypes, ROLES[]> = {
current_org_settings: ['ADMIN'],
invite_members: ['ADMIN'],
@@ -29,7 +32,10 @@ export const componentPermission: Record<ComponentTypes, ROLES[]> = {
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<keyof typeof ROUTES, ROLES[]> = {