Skip to content

Commit

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

* remove management workspace (opensearch-project#278)

* 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

* update typescript version to 4.6.4

* delete useless code and add a lost yarn.lock

* delete yarn.lock
  • Loading branch information
yubonluo authored Mar 7, 2024
1 parent 77ef493 commit 1e582e2
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 51 deletions.
8 changes: 1 addition & 7 deletions src/core/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -354,13 +354,7 @@ export {
} from './metrics';

export { AppCategory, WorkspaceAttribute } from '../types';
export {
DEFAULT_APP_CATEGORIES,
PUBLIC_WORKSPACE_ID,
MANAGEMENT_WORKSPACE_ID,
WORKSPACE_TYPE,
PERSONAL_WORKSPACE_ID_PREFIX,
} from '../utils';
export { DEFAULT_APP_CATEGORIES, PUBLIC_WORKSPACE_ID, WORKSPACE_TYPE } from '../utils';

export {
SavedObject,
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';
8 changes: 1 addition & 7 deletions src/core/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,4 @@ export {
} from './context';
export { DEFAULT_APP_CATEGORIES } from './default_app_categories';
export { getWorkspaceIdFromUrl, formatUrlWithWorkspaceId, cleanWorkspaceId } from './workspace';
export {
WORKSPACE_PATH_PREFIX,
PUBLIC_WORKSPACE_ID,
MANAGEMENT_WORKSPACE_ID,
WORKSPACE_TYPE,
PERSONAL_WORKSPACE_ID_PREFIX,
} from './constants';
export { WORKSPACE_PATH_PREFIX, PUBLIC_WORKSPACE_ID, WORKSPACE_TYPE } 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 @@ -266,8 +266,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 @@ -329,8 +329,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 1e582e2

Please sign in to comment.