From 5ea00ad54184d5cb6bd4ecd5f96ae8155ddde84b Mon Sep 17 00:00:00 2001 From: Hailong Cui Date: Fri, 20 Sep 2024 10:51:53 +0800 Subject: [PATCH] [Workspace] Drop user personal settings page (#8236) * drop user personal settings page Signed-off-by: Hailong Cui * Changeset file for PR #8236 created/updated * remove unuse code Signed-off-by: Hailong Cui --------- Signed-off-by: Hailong Cui Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com> --- changelogs/fragments/8236.yml | 2 ++ .../advanced_settings/public/plugin.ts | 8 +++++++- .../advanced_settings/server/plugin.ts | 19 ++++++------------- 3 files changed, 15 insertions(+), 14 deletions(-) create mode 100644 changelogs/fragments/8236.yml diff --git a/changelogs/fragments/8236.yml b/changelogs/fragments/8236.yml new file mode 100644 index 000000000000..3847544e5466 --- /dev/null +++ b/changelogs/fragments/8236.yml @@ -0,0 +1,2 @@ +fix: +- [Workspace] drop user personal settings page ([#8236](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/8236)) \ No newline at end of file diff --git a/src/plugins/advanced_settings/public/plugin.ts b/src/plugins/advanced_settings/public/plugin.ts index 6811290ac0f9..4882f038256a 100644 --- a/src/plugins/advanced_settings/public/plugin.ts +++ b/src/plugins/advanced_settings/public/plugin.ts @@ -46,7 +46,12 @@ import { AdvancedSettingsPluginStart, } from './types'; import { setupTopNavThemeButton } from './register_nav_control'; -import { DEFAULT_NAV_GROUPS, AppNavLinkStatus, WorkspaceAvailability } from '../../../core/public'; +import { + DEFAULT_NAV_GROUPS, + AppNavLinkStatus, + WorkspaceAvailability, + AppStatus, +} from '../../../core/public'; import { getScopedBreadcrumbs } from '../../opensearch_dashboards_react/public'; import { setupUserSettingsPage } from './management_app/user_settings'; @@ -193,6 +198,7 @@ export class AdvancedSettingsPlugin const userSettingsEnabled = core.application.capabilities.userSettings?.enabled; if (app.id === USER_SETTINGS_APPID) { return { + status: userSettingsEnabled ? AppStatus.accessible : AppStatus.inaccessible, navLinkStatus: userSettingsEnabled ? AppNavLinkStatus.visible : AppNavLinkStatus.hidden, }; } diff --git a/src/plugins/advanced_settings/server/plugin.ts b/src/plugins/advanced_settings/server/plugin.ts index 42f60d9eea97..c4d94ad6506b 100644 --- a/src/plugins/advanced_settings/server/plugin.ts +++ b/src/plugins/advanced_settings/server/plugin.ts @@ -40,12 +40,10 @@ import { Observable } from 'rxjs'; import { first } from 'rxjs/operators'; import { capabilitiesProvider } from './capabilities_provider'; import { UserUISettingsClientWrapper } from './saved_objects/user_ui_settings_client_wrapper'; -import { extractUserName } from './utils'; export class AdvancedSettingsServerPlugin implements Plugin { private readonly logger: Logger; private userUiSettingsClientWrapper?: UserUISettingsClientWrapper; - private coreStart: CoreStart | undefined; private readonly globalConfig$: Observable; constructor(initializerContext: PluginInitializerContext) { @@ -81,16 +79,12 @@ export class AdvancedSettingsServerPlugin implements Plugin { ); core.capabilities.registerSwitcher(async (request, capabilities) => { - const userName = extractUserName(request, this.coreStart); - if (userName) { - return { - ...capabilities, - userSettings: { - enabled: true, - }, - }; - } - return capabilities; + return { + ...capabilities, + userSettings: { + enabled: false, + }, + }; }); return {}; @@ -98,7 +92,6 @@ export class AdvancedSettingsServerPlugin implements Plugin { public start(core: CoreStart) { this.logger.debug('advancedSettings: Started'); - this.coreStart = core; this.userUiSettingsClientWrapper?.setCore(core); return {};