From f509edcc4e2d8a696c5059fe96e4d2fd6318bd19 Mon Sep 17 00:00:00 2001 From: yuye-aws Date: Tue, 12 Sep 2023 14:23:22 +0800 Subject: [PATCH] resolve conflict Signed-off-by: yuye-aws --- .../application/utils/get_nav_actions.tsx | 7 +++-- .../saved_objects_management/public/index.ts | 2 +- .../public/management_section/index.ts | 2 +- .../components/duplicate_modal.tsx | 7 +++-- .../objects_table/components/table.tsx | 4 +-- .../objects_table/saved_objects_table.tsx | 29 +++++++++++++------ .../application/utils/get_top_nav_config.tsx | 17 ++++++----- 7 files changed, 43 insertions(+), 25 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 995b3cff62b1..75c6c20ff1c9 100644 --- a/src/plugins/dashboard/public/application/utils/get_nav_actions.tsx +++ b/src/plugins/dashboard/public/application/utils/get_nav_actions.tsx @@ -37,6 +37,7 @@ import { Dashboard } from '../../dashboard'; import { SavedObjectWithMetadata } from '../../../../saved_objects_management/common'; import { duplicateSavedObjects, + DuplicateState, getWorkspacesWithWritePermission, SavedObjectsDuplicateModal, } from '../../../../saved_objects_management/public'; @@ -229,11 +230,13 @@ export const getNavActions = ( }); }; - const dashboardSavedObjects = [(savedDashboard || {}) as SavedObjectWithMetadata]; + const dashboardSavedObject = (savedDashboard || {}) as SavedObjectWithMetadata; + dashboardSavedObject.meta = { title: savedDashboard.title }; const duplicateModal = ( { key={savedObjectType} label={ { const confirmMessageForAllObjects = `Duplicate (${includedSelectedObjects.length})`; const confirmMessageForSingleOrSelectedObjects = 'Duplicate'; const confirmMessage = - duplicateState === DuplicateState.All + duplicateState === DuplicateState.All ? confirmMessageForAllObjects : confirmMessageForSingleOrSelectedObjects; const warningMessageForOnlyOneSavedObject = ( 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 6da89119c3bd..c948669596a8 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 @@ -326,7 +326,7 @@ export class Table extends PureComponent { type: 'icon', icon: 'copyClipboard', isPrimary: true, - onClick: (object: SavedObjectWithMetadata) => onCopySingle(object), + onClick: (object: SavedObjectWithMetadata) => onDuplicateSingle(object), 'data-test-subj': 'savedObjectsTableAction-duplicate', }, ] @@ -449,7 +449,7 @@ export class Table extends PureComponent { 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 46af12b1333a..18703906d824 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 @@ -97,7 +97,7 @@ import { import { Header, Table, Flyout, Relationships } from './components'; import { DataPublicPluginStart } from '../../../../data/public'; import { SavedObjectsDuplicateModal } from './components'; -import { PUBLIC_WORKSPACE_ID, MANAGEMENT_WORKSPACE_ID } from '../../../../../core/public'; +import { PUBLIC_WORKSPACE_ID } from '../../../../../core/public'; export enum DuplicateState { Single = 'single', @@ -533,20 +533,31 @@ export class SavedObjectsTable extends Component ({ id: obj.id, type: obj.type })); let result; try { - result = await duplicateSavedObjects(http, objectsToDuplicate, includeReferencesDeep, targetWorkspace); + result = await duplicateSavedObjects( + http, + objectsToDuplicate, + includeReferencesDeep, + targetWorkspace + ); if (result.success) { notifications.toasts.addSuccess({ - title: i18n.translate('savedObjectsManagement.objectsTable.duplicate.successNotification', { - defaultMessage: - 'Duplicate ' + savedObjects.length.toString() + ' saved objects successfully', - }), + title: i18n.translate( + 'savedObjectsManagement.objectsTable.duplicate.successNotification', + { + defaultMessage: + 'Duplicate ' + savedObjects.length.toString() + ' saved objects successfully', + } + ), }); } else { const failedCount = savedObjects.length - result.successCount; notifications.toasts.addSuccess({ - title: i18n.translate('savedObjectsManagement.objectsTable.duplicate.dangerNotification', { - defaultMessage: 'Unable to duplicate ' + failedCount.toString() + ' saved objects', - }), + title: i18n.translate( + 'savedObjectsManagement.objectsTable.duplicate.dangerNotification', + { + defaultMessage: 'Unable to duplicate ' + failedCount.toString() + ' saved objects', + } + ), }); } } catch (e) { diff --git a/src/plugins/visualize/public/application/utils/get_top_nav_config.tsx b/src/plugins/visualize/public/application/utils/get_top_nav_config.tsx index e2264d628f80..2ea955523822 100644 --- a/src/plugins/visualize/public/application/utils/get_top_nav_config.tsx +++ b/src/plugins/visualize/public/application/utils/get_top_nav_config.tsx @@ -30,23 +30,21 @@ import React from 'react'; import { i18n } from '@osd/i18n'; - import { TopNavMenuData } from 'src/plugins/navigation/public'; import { AppMountParameters, WorkspaceAttribute } from 'opensearch-dashboards/public'; import { VISUALIZE_EMBEDDABLE_TYPE, VisualizeInput } from '../../../../visualizations/public'; import { - showSaveModal, - showDuplicateModal, + OnSaveProps, SavedObjectSaveModalOrigin, SavedObjectSaveOpts, - OnSaveProps, + showDuplicateModal, + showSaveModal, } from '../../../../saved_objects/public'; import { unhashUrl } from '../../../../opensearch_dashboards_utils/public'; - import { - VisualizeServices, VisualizeAppStateContainer, VisualizeEditorVisInstance, + VisualizeServices, } from '../types'; import { VisualizeConstants } from '../visualize_constants'; import { getEditBreadcrumbs } from './breadcrumbs'; @@ -56,6 +54,7 @@ import { getWorkspacesWithWritePermission, SavedObjectsDuplicateModal, SavedObjectWithMetadata, + DuplicateState, } from '../../../../saved_objects_management/public/'; interface TopNavConfigParams { @@ -338,11 +337,13 @@ export const getTopNavConfig = ( }); }; - const visualizationSavedObjects = [(savedVis || {}) as SavedObjectWithMetadata]; + const visualizationSavedObject = (savedVis || {}) as SavedObjectWithMetadata; + visualizationSavedObject.meta = { title: savedVis?.title }; // meta is missing in savedVis const duplicateModal = (