From 623ad8b34ec8e1acd4480d084925701777b6332c Mon Sep 17 00:00:00 2001 From: yuye-aws Date: Mon, 28 Aug 2023 15:51:16 +0800 Subject: [PATCH 01/10] fix typo Signed-off-by: yuye-aws --- .../saved_objects/permission_control/acl.test.ts | 2 +- .../server/saved_objects/permission_control/acl.ts | 2 +- .../saved_objects/permission_control/client.ts | 2 +- .../objects_table/components/copy_modal.tsx | 12 ++++++------ .../workspace_saved_objects_client_wrapper.ts | 10 +++++----- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/core/server/saved_objects/permission_control/acl.test.ts b/src/core/server/saved_objects/permission_control/acl.test.ts index 4498c4768c2c..3c71ac82bda1 100644 --- a/src/core/server/saved_objects/permission_control/acl.test.ts +++ b/src/core/server/saved_objects/permission_control/acl.test.ts @@ -124,7 +124,7 @@ describe('SavedObjectTypeRegistry', () => { users: ['user1'], groups: ['group1'], }; - const result = ACL.genereateGetPermittedSavedObjectsQueryDSL(['read'], principals, 'workspace'); + const result = ACL.generateGetPermittedSavedObjectsQueryDSL(['read'], principals, 'workspace'); expect(result).toEqual({ query: { bool: { diff --git a/src/core/server/saved_objects/permission_control/acl.ts b/src/core/server/saved_objects/permission_control/acl.ts index cc17e8170ac8..1631b0cbef46 100644 --- a/src/core/server/saved_objects/permission_control/acl.ts +++ b/src/core/server/saved_objects/permission_control/acl.ts @@ -197,7 +197,7 @@ export class ACL { /** * generate query DSL by the specific conditions, used for fetching saved objects from the saved objects index */ - public static genereateGetPermittedSavedObjectsQueryDSL( + public static generateGetPermittedSavedObjectsQueryDSL( permissionTypes: string[], principals: Principals, savedObjectType?: string | string[] diff --git a/src/core/server/saved_objects/permission_control/client.ts b/src/core/server/saved_objects/permission_control/client.ts index 76c1c05d6bc3..a7d31c576109 100644 --- a/src/core/server/saved_objects/permission_control/client.ts +++ b/src/core/server/saved_objects/permission_control/client.ts @@ -128,7 +128,7 @@ export class SavedObjectsPermissionControl { permissionModes: SavedObjectsPermissionModes ) { const principals = this.getPrincipalsFromRequest(request); - const queryDSL = ACL.genereateGetPermittedSavedObjectsQueryDSL(permissionModes, principals, [ + const queryDSL = ACL.generateGetPermittedSavedObjectsQueryDSL(permissionModes, principals, [ WORKSPACE_TYPE, ]); const repository = this.getInternalRepository(); diff --git a/src/plugins/saved_objects_management/public/management_section/objects_table/components/copy_modal.tsx b/src/plugins/saved_objects_management/public/management_section/objects_table/components/copy_modal.tsx index b510dc450498..2c2bf73e731d 100644 --- a/src/plugins/saved_objects_management/public/management_section/objects_table/components/copy_modal.tsx +++ b/src/plugins/saved_objects_management/public/management_section/objects_table/components/copy_modal.tsx @@ -46,11 +46,11 @@ interface Props { targetWorkspace: string ) => Promise; onClose: () => void; - seletedSavedObjects: SavedObjectWithMetadata[]; + selectedSavedObjects: SavedObjectWithMetadata[]; } interface State { - allSeletedObjects: SavedObjectWithMetadata[]; + allSelectedObjects: SavedObjectWithMetadata[]; workspaceOptions: WorkspaceOption[]; allWorkspaceOptions: WorkspaceOption[]; targetWorkspaceOption: WorkspaceOption[]; @@ -65,7 +65,7 @@ export class SavedObjectsCopyModal extends React.Component { super(props); this.state = { - allSeletedObjects: this.props.seletedSavedObjects, + allSelectedObjects: this.props.selectedSavedObjects, workspaceOptions: [], allWorkspaceOptions: [], targetWorkspaceOption: [], @@ -152,15 +152,15 @@ export class SavedObjectsCopyModal extends React.Component { workspaceOptions, targetWorkspaceOption, isIncludeReferencesDeepChecked, - allSeletedObjects, + allSelectedObjects, } = this.state; const targetWorkspaceId = targetWorkspaceOption?.at(0)?.key; - const includedSeletedObjects = allSeletedObjects.filter((item) => + const includedSeletedObjects = allSelectedObjects.filter((item) => !!targetWorkspaceId && !!item.workspaces ? !item.workspaces.includes(targetWorkspaceId) : true && item.type !== SAVED_OBJECT_TYPE_WORKSAPCE ); - const ignoredSeletedObjectsLength = allSeletedObjects.length - includedSeletedObjects.length; + const ignoredSeletedObjectsLength = allSelectedObjects.length - includedSeletedObjects.length; let confirmCopyButtonEnabled = false; if (!!targetWorkspaceId && includedSeletedObjects.length > 0) { diff --git a/src/plugins/workspace/server/saved_objects/workspace_saved_objects_client_wrapper.ts b/src/plugins/workspace/server/saved_objects/workspace_saved_objects_client_wrapper.ts index 592257dcd80b..0549ebba58a4 100644 --- a/src/plugins/workspace/server/saved_objects/workspace_saved_objects_client_wrapper.ts +++ b/src/plugins/workspace/server/saved_objects/workspace_saved_objects_client_wrapper.ts @@ -349,13 +349,14 @@ export class WorkspaceSavedObjectsClientWrapper { }; const findWithWorkspacePermissionControl = async ( - options: SavedObjectsFindOptions + options: SavedObjectsFindOptions, + permissionModes?: WorkspacePermissionMode[] ) => { const principals = this.permissionControl.getPrincipalsFromRequest(wrapperOptions.request); if (this.isRelatedToWorkspace(options.type)) { - const queryDSLForQueryingWorkspaces = ACL.genereateGetPermittedSavedObjectsQueryDSL( - [ + options.queryDSL = ACL.generateGetPermittedSavedObjectsQueryDSL( + permissionModes ?? [ WorkspacePermissionMode.LibraryRead, WorkspacePermissionMode.LibraryWrite, WorkspacePermissionMode.Management, @@ -363,7 +364,6 @@ export class WorkspaceSavedObjectsClientWrapper { principals, WORKSPACE_TYPE ); - options.queryDSL = queryDSLForQueryingWorkspaces; } else { const permittedWorkspaceIds = await this.permissionControl.getPermittedWorkspaceIds( wrapperOptions.request, @@ -392,7 +392,7 @@ export class WorkspaceSavedObjectsClientWrapper { */ options.workspaces = permittedWorkspaces; } else { - const queryDSL = ACL.genereateGetPermittedSavedObjectsQueryDSL( + const queryDSL = ACL.generateGetPermittedSavedObjectsQueryDSL( [WorkspacePermissionMode.Read, WorkspacePermissionMode.Write], principals, options.type From c8b62a4207a0d1fb7111ee2c3bf49c10c735e9aa Mon Sep 17 00:00:00 2001 From: yuye-aws Date: Mon, 28 Aug 2023 21:11:08 +0800 Subject: [PATCH 02/10] adjust copy modal Signed-off-by: yuye-aws --- .../objects_table/components/copy_modal.tsx | 90 ++++++++++++------- .../objects_table/saved_objects_table.tsx | 2 +- 2 files changed, 61 insertions(+), 31 deletions(-) diff --git a/src/plugins/saved_objects_management/public/management_section/objects_table/components/copy_modal.tsx b/src/plugins/saved_objects_management/public/management_section/objects_table/components/copy_modal.tsx index 2c2bf73e731d..c0b9a3478260 100644 --- a/src/plugins/saved_objects_management/public/management_section/objects_table/components/copy_modal.tsx +++ b/src/plugins/saved_objects_management/public/management_section/objects_table/components/copy_modal.tsx @@ -23,12 +23,13 @@ import { EuiSpacer, EuiComboBox, EuiFormRow, - EuiSwitch, + EuiCheckbox, EuiComboBoxOptionOption, EuiInMemoryTable, EuiToolTip, EuiIcon, EuiCallOut, + EuiText, } from '@elastic/eui'; import { WorkspaceAttribute, WorkspaceStart } from 'opensearch-dashboards/public'; import { i18n } from '@osd/i18n'; @@ -155,15 +156,15 @@ export class SavedObjectsCopyModal extends React.Component { allSelectedObjects, } = this.state; const targetWorkspaceId = targetWorkspaceOption?.at(0)?.key; - const includedSeletedObjects = allSelectedObjects.filter((item) => + const includedSelectedObjects = allSelectedObjects.filter((item) => !!targetWorkspaceId && !!item.workspaces ? !item.workspaces.includes(targetWorkspaceId) - : true && item.type !== SAVED_OBJECT_TYPE_WORKSAPCE + : item.type !== SAVED_OBJECT_TYPE_WORKSAPCE ); - const ignoredSeletedObjectsLength = allSelectedObjects.length - includedSeletedObjects.length; + const ignoredSelectedObjectsLength = allSelectedObjects.length - includedSelectedObjects.length; let confirmCopyButtonEnabled = false; - if (!!targetWorkspaceId && includedSeletedObjects.length > 0) { + if (!!targetWorkspaceId && includedSelectedObjects.length > 0) { confirmCopyButtonEnabled = true; } @@ -175,7 +176,7 @@ export class SavedObjectsCopyModal extends React.Component { ); const warningMessageForMultipleSavedObjects = (

- {ignoredSeletedObjectsLength} saved objects will{' '} + {ignoredSelectedObjectsLength} saved objects will{' '} not be copied, because they have already existed in the selected workspace or they are worksapces themselves.

@@ -187,9 +188,9 @@ export class SavedObjectsCopyModal extends React.Component { title="Some saved objects will be ignored." color="warning" iconType="help" - aria-disabled={ignoredSeletedObjectsLength === 0} + aria-disabled={ignoredSelectedObjectsLength === 0} > - {ignoredSeletedObjectsLength === 1 + {ignoredSelectedObjectsLength === 1 ? warningMessageForOnlyOneSavedObject : warningMessageForMultipleSavedObjects} @@ -207,7 +208,11 @@ export class SavedObjectsCopyModal extends React.Component { 1 ? ' objects?' : ' object?') + } /> @@ -218,36 +223,61 @@ export class SavedObjectsCopyModal extends React.Component { label={ } > - + <> + + {'Specify a workspace where the objects will be duplicated.'} + + + + - } - checked={isIncludeReferencesDeepChecked} - onChange={this.changeIncludeReferencesDeep} - /> + > + <> + + { + 'We recommended duplicating related objects to ensure your duplicated objects will continue to function.' + } + + + + } + checked={isIncludeReferencesDeepChecked} + onChange={this.changeIncludeReferencesDeep} + /> + + - {ignoredSeletedObjectsLength === 0 ? null : ignoreSomeObjectsChildren} + {ignoredSelectedObjectsLength === 0 ? null : ignoreSomeObjectsChildren}

{

{ this.copySavedObjects(includedSeletedObjects)} + onClick={() => this.copySavedObjects(includedSelectedObjects)} isLoading={this.state.isLoading} disabled={!confirmCopyButtonEnabled} > diff --git a/src/plugins/saved_objects_management/public/management_section/objects_table/saved_objects_table.tsx b/src/plugins/saved_objects_management/public/management_section/objects_table/saved_objects_table.tsx index 482b33978edf..b5b3711f7359 100644 --- a/src/plugins/saved_objects_management/public/management_section/objects_table/saved_objects_table.tsx +++ b/src/plugins/saved_objects_management/public/management_section/objects_table/saved_objects_table.tsx @@ -689,7 +689,7 @@ export class SavedObjectsTable extends Component Date: Tue, 29 Aug 2023 14:32:20 +0800 Subject: [PATCH 03/10] list workspace with write permission on copy modal Signed-off-by: yuye-aws --- .../get_workspaces_with_write_permission.ts | 20 +++++++++++++++++++ .../public/lib/index.ts | 1 + .../objects_table/components/copy_modal.tsx | 16 ++++++++------- .../objects_table/saved_objects_table.tsx | 5 +++-- .../workspace/public/workspace_client.ts | 2 ++ src/plugins/workspace/server/routes/index.ts | 1 + .../workspace_saved_objects_client_wrapper.ts | 6 +++--- src/plugins/workspace/server/types.ts | 1 + 8 files changed, 40 insertions(+), 12 deletions(-) create mode 100644 src/plugins/saved_objects_management/public/lib/get_workspaces_with_write_permission.ts diff --git a/src/plugins/saved_objects_management/public/lib/get_workspaces_with_write_permission.ts b/src/plugins/saved_objects_management/public/lib/get_workspaces_with_write_permission.ts new file mode 100644 index 000000000000..eed14101ac0e --- /dev/null +++ b/src/plugins/saved_objects_management/public/lib/get_workspaces_with_write_permission.ts @@ -0,0 +1,20 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + * + * Any modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +import { HttpStart, WorkspacePermissionMode } from 'src/core/public'; + +export async function getWorkspacesWithWritePermission(http: HttpStart) { + return await http.post('/api/workspaces/_list', { + body: JSON.stringify({ + permissionModes: [WorkspacePermissionMode.Management, WorkspacePermissionMode.LibraryWrite], + }), + }); +} diff --git a/src/plugins/saved_objects_management/public/lib/index.ts b/src/plugins/saved_objects_management/public/lib/index.ts index 7bb6f9168cbd..a25aaf669066 100644 --- a/src/plugins/saved_objects_management/public/lib/index.ts +++ b/src/plugins/saved_objects_management/public/lib/index.ts @@ -58,3 +58,4 @@ export { createFieldList } from './create_field_list'; export { getAllowedTypes } from './get_allowed_types'; export { filterQuery } from './filter_query'; export { copySavedObjects } from './copy_saved_objects'; +export { getWorkspacesWithWritePermission } from './get_workspaces_with_write_permission'; diff --git a/src/plugins/saved_objects_management/public/management_section/objects_table/components/copy_modal.tsx b/src/plugins/saved_objects_management/public/management_section/objects_table/components/copy_modal.tsx index c0b9a3478260..122f6f93b2a6 100644 --- a/src/plugins/saved_objects_management/public/management_section/objects_table/components/copy_modal.tsx +++ b/src/plugins/saved_objects_management/public/management_section/objects_table/components/copy_modal.tsx @@ -31,10 +31,10 @@ import { EuiCallOut, EuiText, } from '@elastic/eui'; -import { WorkspaceAttribute, WorkspaceStart } from 'opensearch-dashboards/public'; +import { HttpStart, WorkspaceAttribute, WorkspaceStart } from 'opensearch-dashboards/public'; import { i18n } from '@osd/i18n'; import { SavedObjectWithMetadata } from '../../../types'; -import { getSavedObjectLabel } from '../../../lib'; +import { getSavedObjectLabel, getWorkspacesWithWritePermission } from '../../../lib'; import { SAVED_OBJECT_TYPE_WORKSAPCE } from '../../../constants'; type WorkspaceOption = EuiComboBoxOptionOption; @@ -47,6 +47,7 @@ interface Props { targetWorkspace: string ) => Promise; onClose: () => void; + http: HttpStart; selectedSavedObjects: SavedObjectWithMetadata[]; } @@ -80,21 +81,22 @@ export class SavedObjectsCopyModal extends React.Component { }; async componentDidMount() { - const { workspaces } = this.props; - const workspaceList = workspaces.workspaceList$; + const { workspaces, http } = this.props; + const workspaceList = (await getWorkspacesWithWritePermission(http)).result.workspaces; + const workspaceList2 = workspaces.workspaceList$.value; const currentWorkspace = workspaces.currentWorkspace$; if (!!currentWorkspace?.value?.name) { const currentWorkspaceName = currentWorkspace.value.name; - const filteredWorkspaceOptions = workspaceList.value + const filteredWorkspaceOptions = workspaceList .map(this.workspaceToOption) - .filter((item) => item.label !== currentWorkspaceName); + .filter((item: WorkspaceOption) => item.label !== currentWorkspaceName); this.setState({ workspaceOptions: filteredWorkspaceOptions, allWorkspaceOptions: filteredWorkspaceOptions, }); } else { - const allWorkspaceOptions = workspaceList.value.map(this.workspaceToOption); + const allWorkspaceOptions = workspaceList.map(this.workspaceToOption); this.setState({ workspaceOptions: allWorkspaceOptions, allWorkspaceOptions, diff --git a/src/plugins/saved_objects_management/public/management_section/objects_table/saved_objects_table.tsx b/src/plugins/saved_objects_management/public/management_section/objects_table/saved_objects_table.tsx index b5b3711f7359..c58195502f76 100644 --- a/src/plugins/saved_objects_management/public/management_section/objects_table/saved_objects_table.tsx +++ b/src/plugins/saved_objects_management/public/management_section/objects_table/saved_objects_table.tsx @@ -94,7 +94,7 @@ import { SavedObjectsManagementNamespaceServiceStart, } from '../../services'; import { Header, Table, Flyout, Relationships } from './components'; -import { DataPublicPluginStart } from '../../../../../plugins/data/public'; +import { DataPublicPluginStart } from '../../../../data/public'; import { SavedObjectsCopyModal } from './components/copy_modal'; import { PUBLIC_WORKSPACE_ID, MANAGEMENT_WORKSPACE_ID } from '../../../../../core/public'; @@ -495,7 +495,7 @@ export class SavedObjectsTable extends Component diff --git a/src/plugins/workspace/public/workspace_client.ts b/src/plugins/workspace/public/workspace_client.ts index 77edb920334b..6196cab3f6a3 100644 --- a/src/plugins/workspace/public/workspace_client.ts +++ b/src/plugins/workspace/public/workspace_client.ts @@ -51,6 +51,7 @@ interface WorkspaceFindOptions { searchFields?: string[]; sortField?: string; sortOrder?: string; + permissionModes?: WorkspacePermissionMode[]; } /** @@ -265,6 +266,7 @@ export class WorkspaceClient { * @property {integer} [options.page=1] * @property {integer} [options.per_page=20] * @property {array} options.fields + * @property {string array} permissionModes * @returns A find result with workspaces matching the specified search. */ public list = ( diff --git a/src/plugins/workspace/server/routes/index.ts b/src/plugins/workspace/server/routes/index.ts index e8baf5bdb20d..8e5208411337 100644 --- a/src/plugins/workspace/server/routes/index.ts +++ b/src/plugins/workspace/server/routes/index.ts @@ -106,6 +106,7 @@ export function registerRoutes({ page: schema.number({ min: 0, defaultValue: 1 }), sortField: schema.maybe(schema.string()), searchFields: schema.maybe(schema.arrayOf(schema.string())), + permissionModes: schema.maybe(schema.arrayOf(schema.string())), }), }, }, diff --git a/src/plugins/workspace/server/saved_objects/workspace_saved_objects_client_wrapper.ts b/src/plugins/workspace/server/saved_objects/workspace_saved_objects_client_wrapper.ts index 0549ebba58a4..14ae6c8a3302 100644 --- a/src/plugins/workspace/server/saved_objects/workspace_saved_objects_client_wrapper.ts +++ b/src/plugins/workspace/server/saved_objects/workspace_saved_objects_client_wrapper.ts @@ -32,6 +32,7 @@ import { WorkspacePermissionMode, } from '../../../../core/server'; import { ConfigSchema } from '../../config'; +import { WorkspaceFindOptions } from '../types'; // Can't throw unauthorized for now, the page will be refreshed if unauthorized const generateWorkspacePermissionError = () => @@ -349,14 +350,13 @@ export class WorkspaceSavedObjectsClientWrapper { }; const findWithWorkspacePermissionControl = async ( - options: SavedObjectsFindOptions, - permissionModes?: WorkspacePermissionMode[] + options: SavedObjectsFindOptions & Pick ) => { const principals = this.permissionControl.getPrincipalsFromRequest(wrapperOptions.request); if (this.isRelatedToWorkspace(options.type)) { options.queryDSL = ACL.generateGetPermittedSavedObjectsQueryDSL( - permissionModes ?? [ + options.permissionModes ?? [ WorkspacePermissionMode.LibraryRead, WorkspacePermissionMode.LibraryWrite, WorkspacePermissionMode.Management, diff --git a/src/plugins/workspace/server/types.ts b/src/plugins/workspace/server/types.ts index 3d0be3ac824d..c45d13f0fb87 100644 --- a/src/plugins/workspace/server/types.ts +++ b/src/plugins/workspace/server/types.ts @@ -24,6 +24,7 @@ export interface WorkspaceFindOptions { searchFields?: string[]; sortField?: string; sortOrder?: string; + permissionModes?: WorkspacePermissionMode[]; } export interface IRequestDetail { From 64ee1633f39f4f208d9fdcfa3a3289a9220398d9 Mon Sep 17 00:00:00 2001 From: yuye-aws Date: Tue, 29 Aug 2023 17:06:02 +0800 Subject: [PATCH 04/10] add copy icon and move getcopyworkspaces function from copy_modal to saved_object table Signed-off-by: yuye-aws --- .../get_workspaces_with_write_permission.ts | 3 ++- .../objects_table/components/copy_modal.tsx | 9 +++---- .../objects_table/components/table.tsx | 12 +++++++-- .../objects_table/saved_objects_table.tsx | 27 ++++++++++++++++++- 4 files changed, 42 insertions(+), 9 deletions(-) diff --git a/src/plugins/saved_objects_management/public/lib/get_workspaces_with_write_permission.ts b/src/plugins/saved_objects_management/public/lib/get_workspaces_with_write_permission.ts index eed14101ac0e..2a8b47a86aae 100644 --- a/src/plugins/saved_objects_management/public/lib/get_workspaces_with_write_permission.ts +++ b/src/plugins/saved_objects_management/public/lib/get_workspaces_with_write_permission.ts @@ -9,7 +9,8 @@ * GitHub history for details. */ -import { HttpStart, WorkspacePermissionMode } from 'src/core/public'; +import { HttpStart } from 'src/core/public'; +import { WorkspacePermissionMode } from '../../../../core/public'; export async function getWorkspacesWithWritePermission(http: HttpStart) { return await http.post('/api/workspaces/_list', { diff --git a/src/plugins/saved_objects_management/public/management_section/objects_table/components/copy_modal.tsx b/src/plugins/saved_objects_management/public/management_section/objects_table/components/copy_modal.tsx index 122f6f93b2a6..5dba2e10c438 100644 --- a/src/plugins/saved_objects_management/public/management_section/objects_table/components/copy_modal.tsx +++ b/src/plugins/saved_objects_management/public/management_section/objects_table/components/copy_modal.tsx @@ -34,7 +34,7 @@ import { import { HttpStart, WorkspaceAttribute, WorkspaceStart } from 'opensearch-dashboards/public'; import { i18n } from '@osd/i18n'; import { SavedObjectWithMetadata } from '../../../types'; -import { getSavedObjectLabel, getWorkspacesWithWritePermission } from '../../../lib'; +import { getSavedObjectLabel } from '../../../lib'; import { SAVED_OBJECT_TYPE_WORKSAPCE } from '../../../constants'; type WorkspaceOption = EuiComboBoxOptionOption; @@ -47,7 +47,7 @@ interface Props { targetWorkspace: string ) => Promise; onClose: () => void; - http: HttpStart; + getCopyWorkspaces: () => Promise; selectedSavedObjects: SavedObjectWithMetadata[]; } @@ -81,9 +81,8 @@ export class SavedObjectsCopyModal extends React.Component { }; async componentDidMount() { - const { workspaces, http } = this.props; - const workspaceList = (await getWorkspacesWithWritePermission(http)).result.workspaces; - const workspaceList2 = workspaces.workspaceList$.value; + const { workspaces, getCopyWorkspaces } = this.props; + const workspaceList = await getCopyWorkspaces(); const currentWorkspace = workspaces.currentWorkspace$; if (!!currentWorkspace?.value?.name) { diff --git a/src/plugins/saved_objects_management/public/management_section/objects_table/components/table.tsx b/src/plugins/saved_objects_management/public/management_section/objects_table/components/table.tsx index 636933d449df..d7a1d66ff288 100644 --- a/src/plugins/saved_objects_management/public/management_section/objects_table/components/table.tsx +++ b/src/plugins/saved_objects_management/public/management_section/objects_table/components/table.tsx @@ -46,6 +46,7 @@ import { EuiText, EuiTableFieldDataColumnType, EuiTableActionsColumnType, + EuiButtonIcon, } from '@elastic/eui'; import { i18n } from '@osd/i18n'; import { FormattedMessage } from '@osd/i18n/react'; @@ -61,7 +62,6 @@ export interface TableProps { basePath: IBasePath; actionRegistry: SavedObjectsManagementActionServiceStart; columnRegistry: SavedObjectsManagementColumnServiceStart; - namespaceRegistry: SavedObjectsManagementNamespaceServiceStart; selectedSavedObjects: SavedObjectWithMetadata[]; selectionConfig: { onSelectionChange: (selection: SavedObjectWithMetadata[]) => void; @@ -69,6 +69,7 @@ export interface TableProps { filters: any[]; canDelete: boolean; onDelete: () => void; + onCopy: () => void; onActionRefresh: (object: SavedObjectWithMetadata) => void; onExport: (includeReferencesDeep: boolean) => void; goInspectObject: (obj: SavedObjectWithMetadata) => void; @@ -167,6 +168,7 @@ export class Table extends PureComponent { filters, selectionConfig: selection, onDelete, + onCopy, onActionRefresh, selectedSavedObjects, onTableChange, @@ -175,7 +177,6 @@ export class Table extends PureComponent { basePath, actionRegistry, columnRegistry, - namespaceRegistry, dateFormat, } = this.props; @@ -379,6 +380,13 @@ export class Table extends PureComponent { defaultMessage="Delete" /> , + , => { + const { notifications, http } = this.props; + let result; + try { + result = await getWorkspacesWithWritePermission(http); + } catch (error) { + notifications?.toasts.addDanger({ + title: i18n.translate( + 'savedObjectsManagement.objectsTable.copyWorkspaces.dangerNotification', + { + defaultMessage: 'Unable to get workspaces with write permission', + } + ), + text: error instanceof Error ? error.message : JSON.stringify(error), + }); + } + if (result?.success) { + return result.result?.workspaces ?? []; + } else { + return []; + } + }; + onCopy = async ( savedObjects: SavedObjectWithMetadata[], includeReferencesDeep: boolean, @@ -691,7 +715,7 @@ export class SavedObjectsTable extends Component @@ -1045,6 +1069,7 @@ export class SavedObjectsTable extends Component this.setState({ isShowingCopyModal: true })} onActionRefresh={this.refreshObject} goInspectObject={this.props.goInspectObject} pageIndex={page} From 938d7a837bd73a1de5bcc00b5c41228f97135174 Mon Sep 17 00:00:00 2001 From: yuye-aws Date: Tue, 29 Aug 2023 17:45:23 +0800 Subject: [PATCH 05/10] fix duplicate error in public workspace and change copy to duplicate all in header Signed-off-by: yuye-aws --- .../objects_table/components/header.tsx | 27 +++++++++---------- .../workspace_saved_objects_client_wrapper.ts | 2 +- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/src/plugins/saved_objects_management/public/management_section/objects_table/components/header.tsx b/src/plugins/saved_objects_management/public/management_section/objects_table/components/header.tsx index 176e605297f1..b6803c92d9a0 100644 --- a/src/plugins/saved_objects_management/public/management_section/objects_table/components/header.tsx +++ b/src/plugins/saved_objects_management/public/management_section/objects_table/components/header.tsx @@ -67,6 +67,19 @@ export const Header = ({ + + + + + - - - - - Date: Tue, 29 Aug 2023 17:52:54 +0800 Subject: [PATCH 06/10] bug fix: create saved objects in public workspace Signed-off-by: yuye-aws --- .../saved_objects/workspace_saved_objects_client_wrapper.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/workspace/server/saved_objects/workspace_saved_objects_client_wrapper.ts b/src/plugins/workspace/server/saved_objects/workspace_saved_objects_client_wrapper.ts index 7faa955ab8a5..06a512265efb 100644 --- a/src/plugins/workspace/server/saved_objects/workspace_saved_objects_client_wrapper.ts +++ b/src/plugins/workspace/server/saved_objects/workspace_saved_objects_client_wrapper.ts @@ -259,7 +259,7 @@ export class WorkspaceSavedObjectsClientWrapper { workspacePermitted = await this.validateMultiWorkspacesPermissions( options.workspaces, wrapperOptions.request, - WorkspacePermissionMode.Management + [WorkspacePermissionMode.LibraryWrite, WorkspacePermissionMode.Management] ); } else { workspacePermitted = true; From 97a4b3eb1bd8cf801d887e2e4b0a51ef3fc02093 Mon Sep 17 00:00:00 2001 From: yuye-aws Date: Tue, 29 Aug 2023 21:55:21 +0800 Subject: [PATCH 07/10] update snapshots Signed-off-by: yuye-aws --- .../header/__snapshots__/header.test.tsx.snap | 584 +++++++++++++++++- .../saved_objects_table.test.tsx.snap | 1 + .../__snapshots__/header.test.tsx.snap | 31 +- .../__snapshots__/table.test.tsx.snap | 10 + 4 files changed, 602 insertions(+), 24 deletions(-) diff --git a/src/core/public/chrome/ui/header/__snapshots__/header.test.tsx.snap b/src/core/public/chrome/ui/header/__snapshots__/header.test.tsx.snap index 707bacb76142..1c01d1f5fcf0 100644 --- a/src/core/public/chrome/ui/header/__snapshots__/header.test.tsx.snap +++ b/src/core/public/chrome/ui/header/__snapshots__/header.test.tsx.snap @@ -1852,6 +1852,53 @@ exports[`Header handles visibility and lock changes 1`] = ` "closed": false, "hasError": false, "isStopped": false, + "observers": Array [ + Subscriber { + "_parentOrParents": null, + "_subscriptions": Array [ + SubjectSubscription { + "_parentOrParents": [Circular], + "_subscriptions": null, + "closed": false, + "subject": [Circular], + "subscriber": [Circular], + }, + ], + "closed": false, + "destination": SafeSubscriber { + "_complete": undefined, + "_context": [Circular], + "_error": undefined, + "_next": [Function], + "_parentOrParents": null, + "_parentSubscriber": [Circular], + "_subscriptions": null, + "closed": false, + "destination": Object { + "closed": true, + "complete": [Function], + "error": [Function], + "next": [Function], + }, + "isStopped": false, + "syncErrorThrowable": false, + "syncErrorThrown": false, + "syncErrorValue": null, + }, + "isStopped": false, + "syncErrorThrowable": true, + "syncErrorThrown": false, + "syncErrorValue": null, + }, + ], + "thrownError": null, + }, + "hasFetchedWorkspaceList$": BehaviorSubject { + "_isScalar": false, + "_value": false, + "closed": false, + "hasError": false, + "isStopped": false, "observers": Array [], "thrownError": null, }, @@ -1900,6 +1947,43 @@ exports[`Header handles visibility and lock changes 1`] = ` "syncErrorThrown": false, "syncErrorValue": null, }, + Subscriber { + "_parentOrParents": null, + "_subscriptions": Array [ + SubjectSubscription { + "_parentOrParents": [Circular], + "_subscriptions": null, + "closed": false, + "subject": [Circular], + "subscriber": [Circular], + }, + ], + "closed": false, + "destination": SafeSubscriber { + "_complete": undefined, + "_context": [Circular], + "_error": undefined, + "_next": [Function], + "_parentOrParents": null, + "_parentSubscriber": [Circular], + "_subscriptions": null, + "closed": false, + "destination": Object { + "closed": true, + "complete": [Function], + "error": [Function], + "next": [Function], + }, + "isStopped": false, + "syncErrorThrowable": false, + "syncErrorThrown": false, + "syncErrorValue": null, + }, + "isStopped": false, + "syncErrorThrowable": true, + "syncErrorThrown": false, + "syncErrorValue": null, + }, ], "thrownError": null, }, @@ -5913,6 +5997,53 @@ exports[`Header handles visibility and lock changes 1`] = ` "closed": false, "hasError": false, "isStopped": false, + "observers": Array [ + Subscriber { + "_parentOrParents": null, + "_subscriptions": Array [ + SubjectSubscription { + "_parentOrParents": [Circular], + "_subscriptions": null, + "closed": false, + "subject": [Circular], + "subscriber": [Circular], + }, + ], + "closed": false, + "destination": SafeSubscriber { + "_complete": undefined, + "_context": [Circular], + "_error": undefined, + "_next": [Function], + "_parentOrParents": null, + "_parentSubscriber": [Circular], + "_subscriptions": null, + "closed": false, + "destination": Object { + "closed": true, + "complete": [Function], + "error": [Function], + "next": [Function], + }, + "isStopped": false, + "syncErrorThrowable": false, + "syncErrorThrown": false, + "syncErrorValue": null, + }, + "isStopped": false, + "syncErrorThrowable": true, + "syncErrorThrown": false, + "syncErrorValue": null, + }, + ], + "thrownError": null, + }, + "hasFetchedWorkspaceList$": BehaviorSubject { + "_isScalar": false, + "_value": false, + "closed": false, + "hasError": false, + "isStopped": false, "observers": Array [], "thrownError": null, }, @@ -5961,6 +6092,43 @@ exports[`Header handles visibility and lock changes 1`] = ` "syncErrorThrown": false, "syncErrorValue": null, }, + Subscriber { + "_parentOrParents": null, + "_subscriptions": Array [ + SubjectSubscription { + "_parentOrParents": [Circular], + "_subscriptions": null, + "closed": false, + "subject": [Circular], + "subscriber": [Circular], + }, + ], + "closed": false, + "destination": SafeSubscriber { + "_complete": undefined, + "_context": [Circular], + "_error": undefined, + "_next": [Function], + "_parentOrParents": null, + "_parentSubscriber": [Circular], + "_subscriptions": null, + "closed": false, + "destination": Object { + "closed": true, + "complete": [Function], + "error": [Function], + "next": [Function], + }, + "isStopped": false, + "syncErrorThrowable": false, + "syncErrorThrown": false, + "syncErrorValue": null, + }, + "isStopped": false, + "syncErrorThrowable": true, + "syncErrorThrown": false, + "syncErrorValue": null, + }, ], "thrownError": null, }, @@ -6032,6 +6200,53 @@ exports[`Header handles visibility and lock changes 1`] = ` "closed": false, "hasError": false, "isStopped": false, + "observers": Array [ + Subscriber { + "_parentOrParents": null, + "_subscriptions": Array [ + SubjectSubscription { + "_parentOrParents": [Circular], + "_subscriptions": null, + "closed": false, + "subject": [Circular], + "subscriber": [Circular], + }, + ], + "closed": false, + "destination": SafeSubscriber { + "_complete": undefined, + "_context": [Circular], + "_error": undefined, + "_next": [Function], + "_parentOrParents": null, + "_parentSubscriber": [Circular], + "_subscriptions": null, + "closed": false, + "destination": Object { + "closed": true, + "complete": [Function], + "error": [Function], + "next": [Function], + }, + "isStopped": false, + "syncErrorThrowable": false, + "syncErrorThrown": false, + "syncErrorValue": null, + }, + "isStopped": false, + "syncErrorThrowable": true, + "syncErrorThrown": false, + "syncErrorValue": null, + }, + ], + "thrownError": null, + }, + "hasFetchedWorkspaceList$": BehaviorSubject { + "_isScalar": false, + "_value": false, + "closed": false, + "hasError": false, + "isStopped": false, "observers": Array [], "thrownError": null, }, @@ -6080,6 +6295,43 @@ exports[`Header handles visibility and lock changes 1`] = ` "syncErrorThrown": false, "syncErrorValue": null, }, + Subscriber { + "_parentOrParents": null, + "_subscriptions": Array [ + SubjectSubscription { + "_parentOrParents": [Circular], + "_subscriptions": null, + "closed": false, + "subject": [Circular], + "subscriber": [Circular], + }, + ], + "closed": false, + "destination": SafeSubscriber { + "_complete": undefined, + "_context": [Circular], + "_error": undefined, + "_next": [Function], + "_parentOrParents": null, + "_parentSubscriber": [Circular], + "_subscriptions": null, + "closed": false, + "destination": Object { + "closed": true, + "complete": [Function], + "error": [Function], + "next": [Function], + }, + "isStopped": false, + "syncErrorThrowable": false, + "syncErrorThrown": false, + "syncErrorValue": null, + }, + "isStopped": false, + "syncErrorThrowable": true, + "syncErrorThrown": false, + "syncErrorValue": null, + }, ], "thrownError": null, }, @@ -6132,7 +6384,7 @@ exports[`Header handles visibility and lock changes 1`] = ` > - OpenSearch Analytics + OpenSearch Dashboards @@ -8195,13 +8447,97 @@ exports[`Header renders condensed header 1`] = ` "closed": false, "hasError": false, "isStopped": false, - "observers": Array [], - "thrownError": null, - }, - "renderWorkspaceMenu": [MockFunction], - "workspaceEnabled$": BehaviorSubject { - "_isScalar": false, - "_value": false, + "observers": Array [ + Subscriber { + "_parentOrParents": null, + "_subscriptions": Array [ + SubjectSubscription { + "_parentOrParents": [Circular], + "_subscriptions": null, + "closed": false, + "subject": [Circular], + "subscriber": [Circular], + }, + ], + "closed": false, + "destination": SafeSubscriber { + "_complete": undefined, + "_context": [Circular], + "_error": undefined, + "_next": [Function], + "_parentOrParents": null, + "_parentSubscriber": [Circular], + "_subscriptions": null, + "closed": false, + "destination": Object { + "closed": true, + "complete": [Function], + "error": [Function], + "next": [Function], + }, + "isStopped": false, + "syncErrorThrowable": false, + "syncErrorThrown": false, + "syncErrorValue": null, + }, + "isStopped": false, + "syncErrorThrowable": true, + "syncErrorThrown": false, + "syncErrorValue": null, + }, + Subscriber { + "_parentOrParents": null, + "_subscriptions": Array [ + SubjectSubscription { + "_parentOrParents": [Circular], + "_subscriptions": null, + "closed": false, + "subject": [Circular], + "subscriber": [Circular], + }, + ], + "closed": false, + "destination": SafeSubscriber { + "_complete": undefined, + "_context": [Circular], + "_error": undefined, + "_next": [Function], + "_parentOrParents": null, + "_parentSubscriber": [Circular], + "_subscriptions": null, + "closed": false, + "destination": Object { + "closed": true, + "complete": [Function], + "error": [Function], + "next": [Function], + }, + "isStopped": false, + "syncErrorThrowable": false, + "syncErrorThrown": false, + "syncErrorValue": null, + }, + "isStopped": false, + "syncErrorThrowable": true, + "syncErrorThrown": false, + "syncErrorValue": null, + }, + ], + "thrownError": null, + }, + "hasFetchedWorkspaceList$": BehaviorSubject { + "_isScalar": false, + "_value": false, + "closed": false, + "hasError": false, + "isStopped": false, + "observers": Array [], + "thrownError": null, + }, + "renderWorkspaceMenu": [MockFunction], + "workspaceEnabled$": BehaviorSubject { + "_isScalar": false, + "_value": false, "closed": false, "hasError": false, "isStopped": false, @@ -8243,6 +8579,80 @@ exports[`Header renders condensed header 1`] = ` "syncErrorThrown": false, "syncErrorValue": null, }, + Subscriber { + "_parentOrParents": null, + "_subscriptions": Array [ + SubjectSubscription { + "_parentOrParents": [Circular], + "_subscriptions": null, + "closed": false, + "subject": [Circular], + "subscriber": [Circular], + }, + ], + "closed": false, + "destination": SafeSubscriber { + "_complete": undefined, + "_context": [Circular], + "_error": undefined, + "_next": [Function], + "_parentOrParents": null, + "_parentSubscriber": [Circular], + "_subscriptions": null, + "closed": false, + "destination": Object { + "closed": true, + "complete": [Function], + "error": [Function], + "next": [Function], + }, + "isStopped": false, + "syncErrorThrowable": false, + "syncErrorThrown": false, + "syncErrorValue": null, + }, + "isStopped": false, + "syncErrorThrowable": true, + "syncErrorThrown": false, + "syncErrorValue": null, + }, + Subscriber { + "_parentOrParents": null, + "_subscriptions": Array [ + SubjectSubscription { + "_parentOrParents": [Circular], + "_subscriptions": null, + "closed": false, + "subject": [Circular], + "subscriber": [Circular], + }, + ], + "closed": false, + "destination": SafeSubscriber { + "_complete": undefined, + "_context": [Circular], + "_error": undefined, + "_next": [Function], + "_parentOrParents": null, + "_parentSubscriber": [Circular], + "_subscriptions": null, + "closed": false, + "destination": Object { + "closed": true, + "complete": [Function], + "error": [Function], + "next": [Function], + }, + "isStopped": false, + "syncErrorThrowable": false, + "syncErrorThrown": false, + "syncErrorValue": null, + }, + "isStopped": false, + "syncErrorThrowable": true, + "syncErrorThrown": false, + "syncErrorValue": null, + }, ], "thrownError": null, }, @@ -11231,6 +11641,90 @@ exports[`Header renders condensed header 1`] = ` "closed": false, "hasError": false, "isStopped": false, + "observers": Array [ + Subscriber { + "_parentOrParents": null, + "_subscriptions": Array [ + SubjectSubscription { + "_parentOrParents": [Circular], + "_subscriptions": null, + "closed": false, + "subject": [Circular], + "subscriber": [Circular], + }, + ], + "closed": false, + "destination": SafeSubscriber { + "_complete": undefined, + "_context": [Circular], + "_error": undefined, + "_next": [Function], + "_parentOrParents": null, + "_parentSubscriber": [Circular], + "_subscriptions": null, + "closed": false, + "destination": Object { + "closed": true, + "complete": [Function], + "error": [Function], + "next": [Function], + }, + "isStopped": false, + "syncErrorThrowable": false, + "syncErrorThrown": false, + "syncErrorValue": null, + }, + "isStopped": false, + "syncErrorThrowable": true, + "syncErrorThrown": false, + "syncErrorValue": null, + }, + Subscriber { + "_parentOrParents": null, + "_subscriptions": Array [ + SubjectSubscription { + "_parentOrParents": [Circular], + "_subscriptions": null, + "closed": false, + "subject": [Circular], + "subscriber": [Circular], + }, + ], + "closed": false, + "destination": SafeSubscriber { + "_complete": undefined, + "_context": [Circular], + "_error": undefined, + "_next": [Function], + "_parentOrParents": null, + "_parentSubscriber": [Circular], + "_subscriptions": null, + "closed": false, + "destination": Object { + "closed": true, + "complete": [Function], + "error": [Function], + "next": [Function], + }, + "isStopped": false, + "syncErrorThrowable": false, + "syncErrorThrown": false, + "syncErrorValue": null, + }, + "isStopped": false, + "syncErrorThrowable": true, + "syncErrorThrown": false, + "syncErrorValue": null, + }, + ], + "thrownError": null, + }, + "hasFetchedWorkspaceList$": BehaviorSubject { + "_isScalar": false, + "_value": false, + "closed": false, + "hasError": false, + "isStopped": false, "observers": Array [], "thrownError": null, }, @@ -11279,6 +11773,80 @@ exports[`Header renders condensed header 1`] = ` "syncErrorThrown": false, "syncErrorValue": null, }, + Subscriber { + "_parentOrParents": null, + "_subscriptions": Array [ + SubjectSubscription { + "_parentOrParents": [Circular], + "_subscriptions": null, + "closed": false, + "subject": [Circular], + "subscriber": [Circular], + }, + ], + "closed": false, + "destination": SafeSubscriber { + "_complete": undefined, + "_context": [Circular], + "_error": undefined, + "_next": [Function], + "_parentOrParents": null, + "_parentSubscriber": [Circular], + "_subscriptions": null, + "closed": false, + "destination": Object { + "closed": true, + "complete": [Function], + "error": [Function], + "next": [Function], + }, + "isStopped": false, + "syncErrorThrowable": false, + "syncErrorThrown": false, + "syncErrorValue": null, + }, + "isStopped": false, + "syncErrorThrowable": true, + "syncErrorThrown": false, + "syncErrorValue": null, + }, + Subscriber { + "_parentOrParents": null, + "_subscriptions": Array [ + SubjectSubscription { + "_parentOrParents": [Circular], + "_subscriptions": null, + "closed": false, + "subject": [Circular], + "subscriber": [Circular], + }, + ], + "closed": false, + "destination": SafeSubscriber { + "_complete": undefined, + "_context": [Circular], + "_error": undefined, + "_next": [Function], + "_parentOrParents": null, + "_parentSubscriber": [Circular], + "_subscriptions": null, + "closed": false, + "destination": Object { + "closed": true, + "complete": [Function], + "error": [Function], + "next": [Function], + }, + "isStopped": false, + "syncErrorThrowable": false, + "syncErrorThrown": false, + "syncErrorValue": null, + }, + "isStopped": false, + "syncErrorThrowable": true, + "syncErrorThrown": false, + "syncErrorValue": null, + }, ], "thrownError": null, }, diff --git a/src/plugins/saved_objects_management/public/management_section/objects_table/__snapshots__/saved_objects_table.test.tsx.snap b/src/plugins/saved_objects_management/public/management_section/objects_table/__snapshots__/saved_objects_table.test.tsx.snap index 5f33fe812f36..1f7eef56d0a4 100644 --- a/src/plugins/saved_objects_management/public/management_section/objects_table/__snapshots__/saved_objects_table.test.tsx.snap +++ b/src/plugins/saved_objects_management/public/management_section/objects_table/__snapshots__/saved_objects_table.test.tsx.snap @@ -376,6 +376,7 @@ exports[`SavedObjectsTable should render normally 1`] = ` ] } onActionRefresh={[Function]} + onCopy={[Function]} onDelete={[Function]} onExport={[Function]} onQueryChange={[Function]} diff --git a/src/plugins/saved_objects_management/public/management_section/objects_table/components/__snapshots__/header.test.tsx.snap b/src/plugins/saved_objects_management/public/management_section/objects_table/components/__snapshots__/header.test.tsx.snap index 832406480324..1ebba756345f 100644 --- a/src/plugins/saved_objects_management/public/management_section/objects_table/components/__snapshots__/header.test.tsx.snap +++ b/src/plugins/saved_objects_management/public/management_section/objects_table/components/__snapshots__/header.test.tsx.snap @@ -21,6 +21,21 @@ exports[`Header should render normally 1`] = ` gutterSize="m" responsive={false} > + + + + + @@ -57,22 +72,6 @@ exports[`Header should render normally 1`] = ` /> - - - - - diff --git a/src/plugins/saved_objects_management/public/management_section/objects_table/components/__snapshots__/table.test.tsx.snap b/src/plugins/saved_objects_management/public/management_section/objects_table/components/__snapshots__/table.test.tsx.snap index e22f7f3a0128..df77cdea32d4 100644 --- a/src/plugins/saved_objects_management/public/management_section/objects_table/components/__snapshots__/table.test.tsx.snap +++ b/src/plugins/saved_objects_management/public/management_section/objects_table/components/__snapshots__/table.test.tsx.snap @@ -40,6 +40,11 @@ exports[`Table prevents saved objects from being deleted 1`] = ` values={Object {}} /> , + , , + , Date: Tue, 29 Aug 2023 22:13:15 +0800 Subject: [PATCH 08/10] remove unused import Signed-off-by: yuye-aws --- .../management_section/objects_table/components/copy_modal.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/saved_objects_management/public/management_section/objects_table/components/copy_modal.tsx b/src/plugins/saved_objects_management/public/management_section/objects_table/components/copy_modal.tsx index 5dba2e10c438..45ede536f078 100644 --- a/src/plugins/saved_objects_management/public/management_section/objects_table/components/copy_modal.tsx +++ b/src/plugins/saved_objects_management/public/management_section/objects_table/components/copy_modal.tsx @@ -31,7 +31,7 @@ import { EuiCallOut, EuiText, } from '@elastic/eui'; -import { HttpStart, WorkspaceAttribute, WorkspaceStart } from 'opensearch-dashboards/public'; +import { WorkspaceAttribute, WorkspaceStart } from 'opensearch-dashboards/public'; import { i18n } from '@osd/i18n'; import { SavedObjectWithMetadata } from '../../../types'; import { getSavedObjectLabel } from '../../../lib'; From c0ba29c3a1aeb7c7826dbd3b3d556ed19a793fd0 Mon Sep 17 00:00:00 2001 From: yuye-aws Date: Wed, 30 Aug 2023 17:17:40 +0800 Subject: [PATCH 09/10] change validate schema Signed-off-by: yuye-aws --- src/plugins/workspace/server/routes/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/workspace/server/routes/index.ts b/src/plugins/workspace/server/routes/index.ts index 8e5208411337..5a1d51553837 100644 --- a/src/plugins/workspace/server/routes/index.ts +++ b/src/plugins/workspace/server/routes/index.ts @@ -106,7 +106,7 @@ export function registerRoutes({ page: schema.number({ min: 0, defaultValue: 1 }), sortField: schema.maybe(schema.string()), searchFields: schema.maybe(schema.arrayOf(schema.string())), - permissionModes: schema.maybe(schema.arrayOf(schema.string())), + permissionModes: schema.maybe(schema.arrayOf(workspacePermissionMode)), }), }, }, From 560f2c12f5a842272961dd6b4877250e57fcec7d Mon Sep 17 00:00:00 2001 From: yuye-aws Date: Wed, 30 Aug 2023 17:23:42 +0800 Subject: [PATCH 10/10] behavior subject bug fix for workspace plugin Signed-off-by: yuye-aws --- src/plugins/workspace/server/plugin.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/workspace/server/plugin.ts b/src/plugins/workspace/server/plugin.ts index 8ec28a102563..824135698536 100644 --- a/src/plugins/workspace/server/plugin.ts +++ b/src/plugins/workspace/server/plugin.ts @@ -34,7 +34,7 @@ export class WorkspacePlugin implements Plugin<{}, {}> { private client?: IWorkspaceDBImpl; private coreStart?: CoreStart; private config$: Observable; - private enabled$: BehaviorSubject = new BehaviorSubject(false); + private enabled$: BehaviorSubject = new BehaviorSubject(false); private get isEnabled() { return this.enabled$.getValue();