From 40f1d39748276761d63b17cc305cc1888e5ac68a Mon Sep 17 00:00:00 2001 From: yuye-aws Date: Thu, 14 Sep 2023 11:14:11 +0800 Subject: [PATCH] change workspace prop to currentWorkspace in SavedObjectsDuplicateModal Signed-off-by: yuye-aws --- .../public/application/utils/get_nav_actions.tsx | 3 ++- .../objects_table/components/duplicate_modal.tsx | 9 ++++----- .../objects_table/saved_objects_table.tsx | 3 ++- .../public/application/utils/get_top_nav_config.tsx | 3 ++- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/plugins/dashboard/public/application/utils/get_nav_actions.tsx b/src/plugins/dashboard/public/application/utils/get_nav_actions.tsx index 4c1d466b62ad..87f48e6db364 100644 --- a/src/plugins/dashboard/public/application/utils/get_nav_actions.tsx +++ b/src/plugins/dashboard/public/application/utils/get_nav_actions.tsx @@ -202,6 +202,7 @@ export const getNavActions = ( }); }; + const currentWorkspace = workspaces.currentWorkspace$.value; const dashboardSavedObject = (savedDashboard || {}) as SavedObjectWithMetadata; dashboardSavedObject.meta = { title: savedDashboard.title }; @@ -209,7 +210,7 @@ export const getNavActions = ( {}} diff --git a/src/plugins/saved_objects_management/public/management_section/objects_table/components/duplicate_modal.tsx b/src/plugins/saved_objects_management/public/management_section/objects_table/components/duplicate_modal.tsx index 506091206a2a..9760d0619074 100644 --- a/src/plugins/saved_objects_management/public/management_section/objects_table/components/duplicate_modal.tsx +++ b/src/plugins/saved_objects_management/public/management_section/objects_table/components/duplicate_modal.tsx @@ -31,7 +31,7 @@ import { EuiCallOut, EuiText, } from '@elastic/eui'; -import { WorkspaceAttribute, WorkspaceStart } from 'opensearch-dashboards/public'; +import { WorkspaceAttribute } from 'opensearch-dashboards/public'; import { i18n } from '@osd/i18n'; import { SavedObjectWithMetadata } from '../../../types'; import { getSavedObjectLabel } from '../../../lib'; @@ -41,7 +41,6 @@ import { SAVED_OBJECT_TYPE_WORKSPACE } from '../../../constants'; type WorkspaceOption = EuiComboBoxOptionOption; interface Props { - workspaces: WorkspaceStart; onDuplicate: ( savedObjects: SavedObjectWithMetadata[], includeReferencesDeep: boolean, @@ -49,8 +48,9 @@ interface Props { ) => Promise; onClose: () => void; duplicateMode: DuplicateMode; - getDuplicateWorkspaces: () => Promise; + currentWorkspace: WorkspaceAttribute | null; selectedSavedObjects: SavedObjectWithMetadata[]; + getDuplicateWorkspaces: () => Promise; } interface State { @@ -101,9 +101,8 @@ export class SavedObjectsDuplicateModal extends React.Component { }; async componentDidMount() { - const { workspaces, getDuplicateWorkspaces } = this.props; + const { currentWorkspace, getDuplicateWorkspaces } = this.props; const workspaceList = await getDuplicateWorkspaces(); - const currentWorkspace = workspaces.currentWorkspace$.value; const currentWorkspaceName = currentWorkspace?.name; // current workspace is the first option 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 f1815d1a66cf..9c627745c477 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 @@ -774,6 +774,7 @@ export class SavedObjectsTable extends Component {}}