Skip to content

Commit

Permalink
add workspaceAvailability
Browse files Browse the repository at this point in the history
Signed-off-by: Qxisylolo <[email protected]>
  • Loading branch information
Qxisylolo committed Dec 10, 2024
1 parent 98e9042 commit 9fc4103
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/plugins/dashboard/public/plugin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ import { filter, map } from 'rxjs/operators';
import { i18n } from '@osd/i18n';
import { FormattedMessage } from '@osd/i18n/react';

import { UrlForwardingSetup, UrlForwardingStart } from 'src/plugins/url_forwarding/public';
import { isEmpty } from 'lodash';
import { createHashHistory } from 'history';
import {
App,
AppMountParameters,
Expand All @@ -43,11 +46,9 @@ import {
Plugin,
PluginInitializerContext,
SavedObjectsClientContract,
WorkspaceAvailability,
ScopedHistory,
} from 'src/core/public';
import { UrlForwardingSetup, UrlForwardingStart } from 'src/plugins/url_forwarding/public';
import { isEmpty } from 'lodash';
import { createHashHistory } from 'history';
} from '../../../../src/core/public';
import { UsageCollectionSetup } from '../../usage_collection/public';
import {
CONTEXT_MENU_TRIGGER,
Expand Down Expand Up @@ -367,6 +368,7 @@ export class DashboardPlugin
id: DashboardConstants.DASHBOARDS_ID,
title: 'Dashboards',
order: 2500,
workspaceAvailability: WorkspaceAvailability.insideWorkspace,
euiIconType: 'inputOutput',
defaultPath: `#${DashboardConstants.LANDING_PAGE_PATH}`,
updater$: this.appStateUpdater,
Expand Down
2 changes: 2 additions & 0 deletions src/plugins/visualize/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import {
ScopedHistory,
} from 'opensearch-dashboards/public';

import { WorkspaceAvailability } from '../../../../src/core/public';
import {
Storage,
createOsdUrlTracker,
Expand Down Expand Up @@ -158,6 +159,7 @@ export class VisualizePlugin
title: 'Visualize',
order: 8000,
euiIconType: 'inputOutput',
workspaceAvailability: WorkspaceAvailability.insideWorkspace,
defaultPath: '#/',
category: DEFAULT_APP_CATEGORIES.opensearchDashboards,
updater$: this.appStateUpdater.asObservable(),
Expand Down
6 changes: 6 additions & 0 deletions src/plugins/workspace/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,12 @@ export class WorkspacePlugin
*/
return { status: AppStatus.inaccessible };
});
} else {
this.appUpdater$.next((app) => {
if (app.workspaceAvailability === WorkspaceAvailability.insideWorkspace) {
return { status: AppStatus.inaccessible };
}
});
}
});

Expand Down

0 comments on commit 9fc4103

Please sign in to comment.