Skip to content

Commit

Permalink
remove management workspace (opensearch-project#278)
Browse files Browse the repository at this point in the history
* remove management workspace

* delete unnecessary code comments

* delete comments
# Conflicts:
#	src/core/public/index.ts
#	src/core/public/utils/index.ts
#	src/core/utils/constants.ts
#	src/plugins/workspace/public/components/workspace_creator/workspace_form.tsx
#	src/plugins/workspace/public/components/workspace_menu/workspace_menu.tsx
#	src/plugins/workspace/server/workspace_client.ts
  • Loading branch information
yubonluo committed Mar 6, 2024
1 parent 3ddbf99 commit 575d6ed
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 39 deletions.
1 change: 0 additions & 1 deletion src/core/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,6 @@ export { AppCategory, WorkspaceAttribute } from '../types';
export {
DEFAULT_APP_CATEGORIES,
PUBLIC_WORKSPACE_ID,
MANAGEMENT_WORKSPACE_ID,
WORKSPACE_TYPE,
PERSONAL_WORKSPACE_ID_PREFIX,
} from '../utils';
Expand Down
4 changes: 0 additions & 4 deletions src/core/utils/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,3 @@ export const WORKSPACE_TYPE = 'workspace';
export const WORKSPACE_PATH_PREFIX = '/w';

export const PUBLIC_WORKSPACE_ID = 'public';

export const MANAGEMENT_WORKSPACE_ID = 'management';

export const PERSONAL_WORKSPACE_ID_PREFIX = 'personal';
1 change: 0 additions & 1 deletion src/core/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ export { getWorkspaceIdFromUrl, formatUrlWithWorkspaceId, cleanWorkspaceId } fro
export {
WORKSPACE_PATH_PREFIX,
PUBLIC_WORKSPACE_ID,
MANAGEMENT_WORKSPACE_ID,
WORKSPACE_TYPE,
PERSONAL_WORKSPACE_ID_PREFIX,
} from './constants';
8 changes: 4 additions & 4 deletions src/plugins/workspace/server/integration_tests/routes.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,8 @@ describe('workspace service', () => {
page: 1,
})
.expect(200);
// Global and Management workspace will be created by default after workspace list API called.
expect(listResult.body.result.total).toEqual(4);
// Global workspace will be created by default after workspace list API called.
expect(listResult.body.result.total).toEqual(3);
});
it('unable to perform operations on workspace by calling saved objects APIs', async () => {
const result = await osdTestServer.request
Expand Down Expand Up @@ -259,8 +259,8 @@ describe('workspace service', () => {
})
.expect(200);
expect(findResult.body.total).toEqual(0);
// Global and Management workspace will be created by default after workspace list API called.
expect(listResult.body.result.total).toEqual(3);
// Global workspace will be created by default after workspace list API called.
expect(listResult.body.result.total).toEqual(2);
});
});
});
29 changes: 0 additions & 29 deletions src/plugins/workspace/server/workspace_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import type {
} from '../../../core/server';
import {
DEFAULT_APP_CATEGORIES,
MANAGEMENT_WORKSPACE_ID,
PUBLIC_WORKSPACE_ID,
WORKSPACE_TYPE,
Logger,
Expand Down Expand Up @@ -106,24 +105,6 @@ export class WorkspaceClient implements IWorkspaceClientImpl {
reserved: true,
});
}
private async setupManagementWorkspace(savedObjectClient?: SavedObjectsClientContract) {
const DSM_APP_ID = 'dataSources';
const DEV_TOOLS_APP_ID = 'dev_tools';

return this.checkAndCreateWorkspace(savedObjectClient, MANAGEMENT_WORKSPACE_ID, {
name: i18n.translate('workspaces.management.workspace.default.name', {
defaultMessage: 'Management',
}),
features: [
`@${DEFAULT_APP_CATEGORIES.management.id}`,
WORKSPACE_OVERVIEW_APP_ID,
WORKSPACE_UPDATE_APP_ID,
DSM_APP_ID,
DEV_TOOLS_APP_ID,
],
reserved: true,
});
}
public async setup(core: CoreSetup): Promise<IResponse<boolean>> {
this.setupDep.savedObjects.registerType(workspace);
return {
Expand Down Expand Up @@ -197,16 +178,6 @@ export class WorkspaceClient implements IWorkspaceClientImpl {
tasks.push(this.setupPublicWorkspace(scopedClientWithoutPermissionCheck));
}

/**
* Setup management workspace if management workspace can not be found
*/
const hasManagementWorkspace = savedObjects.some(
(item) => item.id === MANAGEMENT_WORKSPACE_ID
);
if (!hasManagementWorkspace) {
tasks.push(this.setupManagementWorkspace(scopedClientWithoutPermissionCheck));
}

try {
await Promise.all(tasks);
if (tasks.length) {
Expand Down

0 comments on commit 575d6ed

Please sign in to comment.