diff --git a/src/frontend/src/defaults/actions.tsx b/src/frontend/src/defaults/actions.tsx index d61c6c41c1..36e7df4402 100644 --- a/src/frontend/src/defaults/actions.tsx +++ b/src/frontend/src/defaults/actions.tsx @@ -5,14 +5,16 @@ import { IconLink, IconPlug, IconPointer, + IconReport, IconSettings, + IconTags, IconUserBolt, IconUserCog } from '@tabler/icons-react'; import type { NavigateFunction } from 'react-router-dom'; import { ModelInformationDict } from '@lib/enums/ModelInformation'; -import { UserRoles } from '@lib/index'; +import { ModelType, UserRoles } from '@lib/index'; import { openContextModal } from '@mantine/modals'; import { useMemo } from 'react'; import { useShallow } from 'zustand/react/shallow'; @@ -36,6 +38,8 @@ export function getActions(navigate: NavigateFunction) { const user = useUserState(); const actions: SpotlightActionData[] = useMemo(() => { + const staff = user?.isStaff() ?? false; + const _actions: SpotlightActionData[] = [ { id: 'dashboard', @@ -90,7 +94,7 @@ export function getActions(navigate: NavigateFunction) { } ]; - user?.isStaff() && + staff && _actions.push({ id: 'data-import', label: t`Import Data`, @@ -149,7 +153,7 @@ export function getActions(navigate: NavigateFunction) { leftSection: }); - user?.isStaff() && + staff && _actions.push({ id: 'system-settings', label: t`System Settings`, @@ -158,7 +162,7 @@ export function getActions(navigate: NavigateFunction) { leftSection: }); - user?.isStaff() && + staff && _actions.push({ id: 'admin-center', label: t`Admin Center`, @@ -167,7 +171,7 @@ export function getActions(navigate: NavigateFunction) { leftSection: }); - user?.isStaff() && + staff && _actions.push({ id: 'plugin-settings', label: t`Plugins`, @@ -176,6 +180,26 @@ export function getActions(navigate: NavigateFunction) { leftSection: }); + staff && + user?.hasViewPermission(ModelType.reporttemplate) && + _actions.push({ + id: 'report-templates', + label: t`Report Templates`, + description: t`Manage report templates`, + onClick: () => navigate('/settings/admin/reports'), + leftSection: + }); + + staff && + user?.hasViewPermission(ModelType.labeltemplate) && + _actions.push({ + id: 'label-templates', + label: t`Label Templates`, + description: t`Manage label templates`, + onClick: () => navigate('/settings/admin/labels'), + leftSection: + }); + return _actions; }, [navigate, setNavigationOpen, globalSettings, user]);