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: edit widget is allowed for admin and editor (#1074)

palash-signozffae767fabb0
diff --git a/frontend/src/container/GridGraphLayout/WidgetHeader/index.tsx b/frontend/src/container/GridGraphLayout/WidgetHeader/index.tsx
index 617ad45f81..a627bac3e1 100644
--- a/frontend/src/container/GridGraphLayout/WidgetHeader/index.tsx
+++ b/frontend/src/container/GridGraphLayout/WidgetHeader/index.tsx
@@ -65,7 +65,10 @@ function WidgetHeader({
};
const { role } = useSelector<AppState, AppReducer>((state) => state.app);
- const [deleteWidget] = useComponentPermission(['delete_widget'], role);
+ const [deleteWidget, editWidget] = useComponentPermission(
+ ['delete_widget', 'edit_widget'],
+ role,
+ );
const menu = (
<Menu onClick={onMenuItemSelectHandler}>
@@ -74,11 +77,14 @@ function WidgetHeader({
<span>View</span> <FullscreenOutlined />
</MenuItemContainer>
</Menu.Item>
- <Menu.Item key={keyMethodMapping.edit.key}>
- <MenuItemContainer>
- <span>Edit</span> <EditFilled />
- </MenuItemContainer>
- </Menu.Item>
+
+ {editWidget && (
+ <Menu.Item key={keyMethodMapping.edit.key}>
+ <MenuItemContainer>
+ <span>Edit</span> <EditFilled />
+ </MenuItemContainer>
+ </Menu.Item>
+ )}
{deleteWidget && (
<>
diff --git a/frontend/src/utils/permission/index.ts b/frontend/src/utils/permission/index.ts
index 742fc8f66b..71d8b09c39 100644
--- a/frontend/src/utils/permission/index.ts
+++ b/frontend/src/utils/permission/index.ts
@@ -13,7 +13,8 @@ export type ComponentTypes =
| 'action'
| 'save_layout'
| 'edit_dashboard'
- | 'delete_widget';
+ | 'delete_widget'
+ | 'edit_widget';
export const componentPermission: Record<ComponentTypes, ROLES[]> = {
current_org_settings: ['ADMIN'],
@@ -28,6 +29,7 @@ export const componentPermission: Record<ComponentTypes, ROLES[]> = {
save_layout: ['ADMIN', 'EDITOR'],
edit_dashboard: ['ADMIN', 'EDITOR'],
delete_widget: ['ADMIN', 'EDITOR'],
+ edit_widget: ['ADMIN', 'EDITOR'],
};
export const routePermission: Record<keyof typeof ROUTES, ROLES[]> = {