From 5945bc182357ccac0cba521843ce3478600b13d0 Mon Sep 17 00:00:00 2001 From: Alexey Date: Wed, 5 Jul 2023 13:40:47 +0400 Subject: [PATCH] fix: remove admin settings (#1798) --- .../src/AUTH_SETTINGS_GROUP.ts | 17 +++++++++-------- .../core-theming/src/THEME_SETTINGS_GROUP.ts | 2 +- .../src/CONNECTIONS_SETTINGS_GROUP.ts | 17 +++++++++-------- .../src/SettingsPanel/SettingsGroup.tsx | 4 ++++ .../src/SettingsPanel/SettingsPanelForm.tsx | 4 ++-- 5 files changed, 25 insertions(+), 19 deletions(-) diff --git a/webapp/packages/core-authentication/src/AUTH_SETTINGS_GROUP.ts b/webapp/packages/core-authentication/src/AUTH_SETTINGS_GROUP.ts index 43d9c94581..e01d16b414 100644 --- a/webapp/packages/core-authentication/src/AUTH_SETTINGS_GROUP.ts +++ b/webapp/packages/core-authentication/src/AUTH_SETTINGS_GROUP.ts @@ -5,7 +5,7 @@ * Licensed under the Apache License, Version 2.0. * you may not use this file except in compliance with the License. */ -import { createSettingsGroup, FormFieldType, SettingsData } from '@cloudbeaver/core-settings'; +import { createSettingsGroup, SettingsData } from '@cloudbeaver/core-settings'; export const AUTH_SETTINGS_GROUP = createSettingsGroup('settings_authentication'); @@ -13,12 +13,13 @@ export const settings: SettingsData = { scopeType: 'core', scope: 'authentication', settingsData: [ - { - key: 'disableAnonymousAccess', - type: FormFieldType.Checkbox, - name: 'settings_authentication_disable_anonymous_access_name', - description: 'settings_authentication_disable_anonymous_access_description', - groupId: AUTH_SETTINGS_GROUP.id, - }, + // TODO: it's administrator settings + // { + // key: 'disableAnonymousAccess', + // type: FormFieldType.Checkbox, + // name: 'settings_authentication_disable_anonymous_access_name', + // description: 'settings_authentication_disable_anonymous_access_description', + // groupId: AUTH_SETTINGS_GROUP.id, + // }, ], }; diff --git a/webapp/packages/core-theming/src/THEME_SETTINGS_GROUP.ts b/webapp/packages/core-theming/src/THEME_SETTINGS_GROUP.ts index 04ff7c9507..d2ac529f24 100644 --- a/webapp/packages/core-theming/src/THEME_SETTINGS_GROUP.ts +++ b/webapp/packages/core-theming/src/THEME_SETTINGS_GROUP.ts @@ -20,7 +20,7 @@ export const settings: SettingsData = { type: FormFieldType.Combobox, name: 'settings_theming_default_theme_name', description: 'settings_theming_default_theme_description', - options: themes.map(theme => ({ id: theme.id, name: theme.name })), + options: themes.map(theme => ({ id: theme.id, name: theme.name })), // TODO: must be taken from ThemeService service, themes is default themes groupId: THEME_SETTINGS_GROUP.id, }, ], diff --git a/webapp/packages/plugin-connections/src/CONNECTIONS_SETTINGS_GROUP.ts b/webapp/packages/plugin-connections/src/CONNECTIONS_SETTINGS_GROUP.ts index c9c3bd7ac5..63f04450be 100644 --- a/webapp/packages/plugin-connections/src/CONNECTIONS_SETTINGS_GROUP.ts +++ b/webapp/packages/plugin-connections/src/CONNECTIONS_SETTINGS_GROUP.ts @@ -5,7 +5,7 @@ * Licensed under the Apache License, Version 2.0. * you may not use this file except in compliance with the License. */ -import { createSettingsGroup, FormFieldType, type SettingsData } from '@cloudbeaver/core-settings'; +import { createSettingsGroup, type SettingsData } from '@cloudbeaver/core-settings'; export const CONNECTIONS_SETTINGS_GROUP = createSettingsGroup('settings_connections'); @@ -13,12 +13,13 @@ export const settings: SettingsData = { scopeType: 'plugin', scope: 'connections', settingsData: [ - { - key: 'hideConnectionViewForUsers', - type: FormFieldType.Checkbox, - name: 'settings_connections_hide_connections_view_name', - description: 'settings_connections_hide_connections_view_description', - groupId: CONNECTIONS_SETTINGS_GROUP.id, - }, + // TODO: it's administrator settings + // { + // key: 'hideConnectionViewForUsers', + // type: FormFieldType.Checkbox, + // name: 'settings_connections_hide_connections_view_name', + // description: 'settings_connections_hide_connections_view_description', + // groupId: CONNECTIONS_SETTINGS_GROUP.id, + // }, ], }; diff --git a/webapp/packages/plugin-settings-panel/src/SettingsPanel/SettingsGroup.tsx b/webapp/packages/plugin-settings-panel/src/SettingsPanel/SettingsGroup.tsx index 580ed257a2..f7c92fe87c 100644 --- a/webapp/packages/plugin-settings-panel/src/SettingsPanel/SettingsGroup.tsx +++ b/webapp/packages/plugin-settings-panel/src/SettingsPanel/SettingsGroup.tsx @@ -40,6 +40,10 @@ export const SettingsGroup = observer(function SettingsGroup({ group }) { options: settingsItem.options?.map(option => ({ ...option, name: translate(option.name) })), })); + if (settings.length === 0) { + return null; + } + return styled(BASE_CONTAINERS_STYLES)( diff --git a/webapp/packages/plugin-settings-panel/src/SettingsPanel/SettingsPanelForm.tsx b/webapp/packages/plugin-settings-panel/src/SettingsPanel/SettingsPanelForm.tsx index 3d2fbcb0ba..c60fc22ac0 100644 --- a/webapp/packages/plugin-settings-panel/src/SettingsPanel/SettingsPanelForm.tsx +++ b/webapp/packages/plugin-settings-panel/src/SettingsPanel/SettingsPanelForm.tsx @@ -28,13 +28,13 @@ export const SettingsPanelForm = observer(function SettingsPanelForm() { const style = useStyles(BASE_CONTAINERS_STYLES, styles); const settingsManagerService = useService(SettingsManagerService); - const groups = Array.from(settingsManagerService.groups); + const groups = Array.from(settingsManagerService.groups.values()); return styled(style)( - {groups.map(([_, group]) => ( + {groups.map(group => ( ))}