Skip to content

Commit

Permalink
feat: some modify
Browse files Browse the repository at this point in the history
Signed-off-by: SuZhou-Joe <suzhou@amazon.com>
  • Loading branch information
SuZhou-Joe committed Aug 3, 2023
1 parent b5538a6 commit a47e917
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/core/public/saved_objects/saved_objects_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ export class SavedObjectsClient {
* When the currentWorkspaceId is an empty string instead of undefined
* It means user is creating object in public workspace.
*/
finalWorkspaces = currentWorkspaceId ? [currentWorkspaceId] : [PUBLIC_WORKSPACE];
finalWorkspaces = [currentWorkspaceId];
}

const createRequest: Promise<SavedObject<T>> = this.savedObjectsFetch(path, {
Expand Down
12 changes: 9 additions & 3 deletions src/plugins/workspace/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@ import {
import { mountDropdownList } from './mount';
import { SavedObjectsManagementPluginSetup } from '../../saved_objects_management/public';
import { getWorkspaceColumn } from './components/utils/workspace_column';
import { getWorkspaceIdFromUrl, WORKSPACE_PATH_PREFIX } from '../../../core/public/utils';
import {
getWorkspaceIdFromUrl,
PUBLIC_WORKSPACE,
WORKSPACE_PATH_PREFIX,
} from '../../../core/public/utils';

interface WorkspacesPluginSetupDeps {
savedObjectsManagement?: SavedObjectsManagementPluginSetup;
Expand Down Expand Up @@ -72,7 +76,7 @@ export class WorkspacesPlugin implements Plugin<{}, {}, WorkspacesPluginSetupDep
/**
* Retrieve workspace id from url
*/
const workspaceId = this.getWorkspaceIdFromURL();
const workspaceId = this.getWorkspaceIdFromURL() || PUBLIC_WORKSPACE;

if (workspaceId) {
const result = await core.workspaces.client.enterWorkspace(workspaceId);
Expand Down Expand Up @@ -193,7 +197,9 @@ export class WorkspacesPlugin implements Plugin<{}, {}, WorkspacesPluginSetupDep
if (this.coreStart) {
return this.coreStart.workspaces.client.currentWorkspaceId$.subscribe(
(currentWorkspaceId) => {
this.coreStart?.savedObjects.client.setCurrentWorkspace(currentWorkspaceId || '');
this.coreStart?.savedObjects.client.setCurrentWorkspace(
currentWorkspaceId || PUBLIC_WORKSPACE
);
}
);
}
Expand Down

0 comments on commit a47e917

Please sign in to comment.