Skip to content

Commit

Permalink
home dashboards/listing page only show public workspace data
Browse files Browse the repository at this point in the history
Signed-off-by: Hailong Cui <ihailong@amazon.com>
  • Loading branch information
Hailong-am committed Apr 16, 2024
1 parent 49b1617 commit 18edfb8
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
OpenSearchDashboardsRequest,
SavedObjectsFindOptions,
PUBLIC_WORKSPACE_ID,
WORKSPACE_TYPE,
} from '../../../../core/server';

type WorkspaceOptions = Pick<SavedObjectsBaseOptions, 'workspaces'> | undefined;
Expand Down Expand Up @@ -66,6 +67,14 @@ export class WorkspaceIdConsumerWrapper {
delete: wrapperOptions.client.delete,
find: (options: SavedObjectsFindOptions) => {
const findOptions = this.formatWorkspaceIdParams(wrapperOptions.request, options);
if (findOptions.type && findOptions.type === WORKSPACE_TYPE) {
return wrapperOptions.client.find(findOptions);
}

// if workspace is enabled, we always find by workspace
if (!findOptions.workspaces || findOptions.workspaces.length === 0) {
findOptions.workspaces = [PUBLIC_WORKSPACE_ID];
}

// `PUBLIC_WORKSPACE_ID` includes both saved objects without any workspace and with `PUBLIC_WORKSPACE_ID` workspace
const index = findOptions.workspaces
Expand Down

0 comments on commit 18edfb8

Please sign in to comment.