mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-14 11:55:52 +08:00
chore: new dashboard permission is added for editor and admin (#1077)
* chore: new dashboard permission is added for editor and admin
This commit is contained in:
parent
6223e89d4c
commit
9cf5c7ef74
@ -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(
|
||||
|
@ -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 (
|
||||
|
@ -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[]> = {
|
||||
|
Loading…
x
Reference in New Issue
Block a user