diff --git a/apps/sensenet/src/application-paths.ts b/apps/sensenet/src/application-paths.ts index caae61c9e..0d640e2ba 100644 --- a/apps/sensenet/src/application-paths.ts +++ b/apps/sensenet/src/application-paths.ts @@ -13,11 +13,11 @@ export const PATHS = { content: { appPath: '/content/:browseType/:action?', snPath: '/Root/Content' }, contentTemplates: { appPath: '/content-templates/:browseType/:action?', snPath: '/Root/ContentTemplates' }, custom: { appPath: '/custom/:browseType/:path/:action?' }, - configuration: { appPath: '/settings/configuration/:action?', snPath: '/Root/System/Settings' }, - localization: { appPath: '/settings/localization/:action?', snPath: '/Root/Localization' }, - webhooks: { appPath: '/settings/webhooks/:action?', snPath: '/Root/System/WebHooks' }, - settings: { appPath: '/settings/:submenu?' }, - apiKeys: { appPath: '/settings/apikeys' }, + configuration: { appPath: '/system/settings/:action?', snPath: '/Root/System/Settings' }, + localization: { appPath: '/system/localization/:action?', snPath: '/Root/Localization' }, + webhooks: { appPath: '/system/webhooks/:action?', snPath: '/Root/System/WebHooks' }, + settings: { appPath: '/system/:submenu?' }, + apiKeys: { appPath: '/system/apikeys' }, } as const type SettingsItemType = 'stats' | 'apikeys' | 'webhooks' | 'adminui' @@ -30,28 +30,28 @@ type RoutesWithContentBrowser = keyof Pick< type RoutesWithActionParam = keyof Pick type Options = - | { path: (typeof PATHS)['events']['appPath']; params?: { eventGuid: string; [index: string]: string } } + | { path: (typeof PATHS)['events']['appPath']; params?: { eventGuid: string;[index: string]: string } } | { - path: (typeof PATHS)[RoutesWithContentBrowser]['appPath'] - params: { browseType: (typeof BrowseType)[number]; action?: string; [index: string]: string | undefined } - } + path: (typeof PATHS)[RoutesWithContentBrowser]['appPath'] + params: { browseType: (typeof BrowseType)[number]; action?: string;[index: string]: string | undefined } + } | { - path: (typeof PATHS)['custom']['appPath'] - params: { - browseType: (typeof BrowseType)[number] - path: string - action?: string - [index: string]: string | undefined - } + path: (typeof PATHS)['custom']['appPath'] + params: { + browseType: (typeof BrowseType)[number] + path: string + action?: string + [index: string]: string | undefined } + } | { - path: (typeof PATHS)[RoutesWithActionParam]['appPath'] - params?: { action: string; [index: string]: string } - } + path: (typeof PATHS)[RoutesWithActionParam]['appPath'] + params?: { action: string;[index: string]: string } + } | { - path: (typeof PATHS)['settings']['appPath'] - params?: { submenu: SettingsItemType; [index: string]: string | SettingsItemType } - } + path: (typeof PATHS)['settings']['appPath'] + params?: { submenu: SettingsItemType;[index: string]: string | SettingsItemType } + } export const resolvePathParams = ({ path, params }: Options) => { let currentPath: string = path diff --git a/apps/sensenet/src/components/settings/index.tsx b/apps/sensenet/src/components/settings/index.tsx index 22d42ea8f..ca0cb12b9 100644 --- a/apps/sensenet/src/components/settings/index.tsx +++ b/apps/sensenet/src/components/settings/index.tsx @@ -53,8 +53,8 @@ export const Settings: React.FunctionComponent = () => { const settingsItems = [ { - name: 'configuration', - displayName: localizationDrawer.titles.Configuration, + name: 'settings', + displayName: localizationDrawer.titles.Settings, url: resolvePathParams({ path: PATHS.configuration.appPath }), }, { @@ -83,7 +83,7 @@ export const Settings: React.FunctionComponent = () => { switch (routeMatch.params.submenu) { case 'localization': return - case 'configuration': + case 'settings': return case 'adminui': return @@ -117,7 +117,7 @@ export const Settings: React.FunctionComponent = () => { return (
- {localizationDrawer.titles.Settings} + {localizationDrawer.titles.System}
diff --git a/apps/sensenet/src/components/settings/setup.tsx b/apps/sensenet/src/components/settings/setup.tsx index c3a88df3b..495e78e93 100644 --- a/apps/sensenet/src/components/settings/setup.tsx +++ b/apps/sensenet/src/components/settings/setup.tsx @@ -128,7 +128,7 @@ const Setup = () => { return (
- {localizationDrawerTitles.Configuration} + {localizationDrawerTitles.Settings}
{renderContent()}
diff --git a/apps/sensenet/src/hooks/use-drawer-items.tsx b/apps/sensenet/src/hooks/use-drawer-items.tsx index 558ca0978..b53e80ab9 100644 --- a/apps/sensenet/src/hooks/use-drawer-items.tsx +++ b/apps/sensenet/src/hooks/use-drawer-items.tsx @@ -89,7 +89,7 @@ export const useDrawerItems = () => { systemItem: true, }, { - itemType: 'Settings', + itemType: 'System', systemItem: true, }, ], @@ -131,7 +131,7 @@ export const useDrawerItems = () => { return case 'CustomContent': return item.settings?.icon ? : - case 'Settings': + case 'System': return // no default } @@ -174,7 +174,7 @@ export const useDrawerItems = () => { path: (item as CustomContentDrawerItem).settings?.appPath || '', }, }) - case 'Settings': + case 'System': return resolvePathParams({ path: PATHS.settings.appPath, params: { submenu: 'stats' } }) default: return '/' @@ -194,32 +194,32 @@ export const useDrawerItems = () => { return drawerItem } - ;[...settings.drawer.items, ...builtInDrawerItems] - .filterAsync(async (item) => { - if (!item.permissions?.length) { - return true - } + ;[...settings.drawer.items, ...builtInDrawerItems] + .filterAsync(async (item) => { + if (!item.permissions?.length) { + return true + } - try { - for (const permission of item.permissions) { - const actions = await repo.getActions({ idOrPath: permission.path }) - const actionIndex = actions.d.results.findIndex((action) => action.Name === permission.action) - if (actionIndex === -1 || actions.d.results[actionIndex].Forbidden) { - return false + try { + for (const permission of item.permissions) { + const actions = await repo.getActions({ idOrPath: permission.path }) + const actionIndex = actions.d.results.findIndex((action) => action.Name === permission.action) + if (actionIndex === -1 || actions.d.results[actionIndex].Forbidden) { + return false + } } + } catch (error) { + logger.debug({ + message: error.message, + data: { + error, + }, + }) + return false } - } catch (error) { - logger.debug({ - message: error.message, - data: { - error, - }, - }) - return false - } - return true - }) - .then((items) => setDrawerItems(items.map(getItemFromSettings))) + return true + }) + .then((items) => setDrawerItems(items.map(getItemFromSettings))) }, [ localization.descriptions, localization.titles, diff --git a/apps/sensenet/src/localization/default.ts b/apps/sensenet/src/localization/default.ts index e169886d2..238588fa1 100644 --- a/apps/sensenet/src/localization/default.ts +++ b/apps/sensenet/src/localization/default.ts @@ -128,6 +128,7 @@ const values = { Settings: 'Settings', Configuration: 'Configuration', Stats: 'Stats', + System: 'System', ApiAndSecurity: 'Api and Security', Webhooks: 'Webhooks', AdminUiCustomization: 'Admin-ui customization', @@ -143,6 +144,7 @@ const values = { UsersAndGroups: 'Manage users and groups, roles and identities', CustomContent: 'Explore and manage your content from the configured path', Settings: 'Configure the sensenet system', + System: 'Configure the sensenet system', ContentTemplates: 'Manage content templates', }, personalSettingsTitle: 'Edit personal settings', diff --git a/apps/sensenet/src/services/PersonalSettings.ts b/apps/sensenet/src/services/PersonalSettings.ts index 315ffe892..30a3a830c 100644 --- a/apps/sensenet/src/services/PersonalSettings.ts +++ b/apps/sensenet/src/services/PersonalSettings.ts @@ -29,7 +29,7 @@ export const BuiltInDrawerItemType = tuple( 'SavedQueries', 'Trash', 'UsersAndGroups', - 'Settings', + 'System', 'ContentTemplates', ) @@ -149,19 +149,19 @@ export const defaultSettings: PersonalSettingsType = { export class PersonalSettings { private checkDrawerItems(settings: Partial): Partial { if (settings.default?.drawer?.items?.find((i) => typeof i === 'string')) { - ;(settings.default.drawer.items as any) = undefined + ; (settings.default.drawer.items as any) = undefined } if (settings.desktop?.drawer?.items?.find((i) => typeof i === 'string')) { - ;(settings.desktop.drawer.items as any) = undefined + ; (settings.desktop.drawer.items as any) = undefined } if (settings.tablet?.drawer?.items?.find((i) => typeof i === 'string')) { - ;(settings.tablet.drawer.items as any) = undefined + ; (settings.tablet.drawer.items as any) = undefined } if (settings.mobile?.drawer?.items?.find((i) => typeof i === 'string')) { - ;(settings.mobile.drawer.items as any) = undefined + ; (settings.mobile.drawer.items as any) = undefined } return settings