From 3ef1e092ca16cadd53749fed47de1dc55664f454 Mon Sep 17 00:00:00 2001 From: Lin Wang Date: Sun, 29 Sep 2024 18:00:39 +0800 Subject: [PATCH] [Workspace]Fix workspace assets page UI bugs (#8265) * Update the gap between search bar and table Signed-off-by: Lin Wang * Update to target workspace and remove description Signed-off-by: Lin Wang * Add bottom Close button for copy result flyout Signed-off-by: Lin Wang * Update "Objects" to "Assets" in the export modal Signed-off-by: Lin Wang * Hide workspace column and filter when in a workspace Signed-off-by: Lin Wang * Add tooltip for table refresh button Signed-off-by: Lin Wang * Update objects to assets in top right buttons Signed-off-by: Lin Wang * Update objects to assets in flyout Signed-off-by: Lin Wang * Changeset file for PR #8265 created/updated * Reduce page content padding for new updated UX Signed-off-by: Lin Wang * Update meta title Signed-off-by: Lin Wang * Update object to asset Signed-off-by: Lin Wang --------- Signed-off-by: Lin Wang Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com> --- changelogs/fragments/8265.yml | 2 + .../management_section/mount_section.tsx | 24 +++++- .../saved_objects_table.test.tsx.snap | 11 ++- .../duplicate_modal.test.tsx.snap | 14 +--- .../duplicate_result_flyout.test.tsx.snap | 40 ++++++++++ .../__snapshots__/flyout.test.tsx.snap | 41 +++++++--- .../__snapshots__/header.test.tsx.snap | 6 +- .../__snapshots__/table.test.tsx.snap | 52 +++++++++---- .../components/duplicate_modal.tsx | 31 ++++---- .../duplicate_result_flyout.test.tsx | 9 +++ .../components/duplicate_result_flyout.tsx | 10 +++ .../objects_table/components/flyout.tsx | 73 ++++++++++++++---- .../objects_table/components/header.tsx | 13 ++-- .../components/import_mode_control.tsx | 31 ++++++-- .../components/import_summary.tsx | 14 +++- .../objects_table/components/table.tsx | 30 +++++--- .../saved_objects_table.test.tsx | 6 +- .../objects_table/saved_objects_table.tsx | 77 ++++++++++++------- src/plugins/workspace/public/plugin.ts | 6 +- 19 files changed, 350 insertions(+), 140 deletions(-) create mode 100644 changelogs/fragments/8265.yml diff --git a/changelogs/fragments/8265.yml b/changelogs/fragments/8265.yml new file mode 100644 index 00000000000..f57aa5d6d0a --- /dev/null +++ b/changelogs/fragments/8265.yml @@ -0,0 +1,2 @@ +fix: +- [Workspace]Fix workspace assets page UI bugs ([#8265](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/8265)) \ No newline at end of file diff --git a/src/plugins/saved_objects_management/public/management_section/mount_section.tsx b/src/plugins/saved_objects_management/public/management_section/mount_section.tsx index 60060a0d199..98235cd6ef3 100644 --- a/src/plugins/saved_objects_management/public/management_section/mount_section.tsx +++ b/src/plugins/saved_objects_management/public/management_section/mount_section.tsx @@ -51,9 +51,15 @@ interface MountParams { let allowedObjectTypes: string[] | undefined; -const title = i18n.translate('savedObjectsManagement.objects.savedObjectsTitle', { +const savedObjectsTitle = i18n.translate('savedObjectsManagement.objects.savedObjectsTitle', { defaultMessage: 'Saved Objects', }); +const workspaceAssetsTitle = i18n.translate('savedObjectsManagement.objects.workspaceAssetsTitle', { + defaultMessage: 'Workspace assets', +}); +const assetsTitle = i18n.translate('savedObjectsManagement.objects.assetsTitle', { + defaultMessage: 'Assets', +}); const SavedObjectsEditionPage = lazy(() => import('./saved_objects_edition_page')); const SavedObjectsTablePage = lazy(() => import('./saved_objects_table_page')); @@ -75,7 +81,19 @@ export const mountManagementSection = async ({ ? allowedObjectTypes : allowedObjectTypes.filter((type) => type !== 'data-source'); - coreStart.chrome.docTitle.change(title); + const useUpdatedUX = coreStart.uiSettings.get('home:useNewHomePage'); + const currentWorkspaceId = coreStart.workspaces.currentWorkspaceId$.getValue(); + const getDocTitle = () => { + if (currentWorkspaceId) { + return workspaceAssetsTitle; + } + if (useUpdatedUX) { + return assetsTitle; + } + return savedObjectsTitle; + }; + + coreStart.chrome.docTitle.change(getDocTitle()); const capabilities = coreStart.application.capabilities; @@ -89,8 +107,6 @@ export const mountManagementSection = async ({ return children! as React.ReactElement; }; - const useUpdatedUX = coreStart.uiSettings.get('home:useNewHomePage'); - const content = ( 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 c3ba3dfea90..23f8a7b8972 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 @@ -869,11 +869,12 @@ exports[`SavedObjectsTable export should allow the user to choose when exporting >

@@ -936,9 +937,13 @@ exports[`SavedObjectsTable export should allow the user to choose when exporting checked={true} label={ } name="includeReferencesDeep" diff --git a/src/plugins/saved_objects_management/public/management_section/objects_table/components/__snapshots__/duplicate_modal.test.tsx.snap b/src/plugins/saved_objects_management/public/management_section/objects_table/components/__snapshots__/duplicate_modal.test.tsx.snap index 1e8c8acc083..7e8f5704dc7 100644 --- a/src/plugins/saved_objects_management/public/management_section/objects_table/components/__snapshots__/duplicate_modal.test.tsx.snap +++ b/src/plugins/saved_objects_management/public/management_section/objects_table/components/__snapshots__/duplicate_modal.test.tsx.snap @@ -80,24 +80,12 @@ HTMLCollection [ class="euiFormLabel euiFormRow__label" for="generated-id" > - Workspace + Target workspace
-
-
- Move copied saved objects to the selected workspace. -
-
-
+
+ +
@@ -571,6 +591,26 @@ HTMLCollection [ +
+ +
diff --git a/src/plugins/saved_objects_management/public/management_section/objects_table/components/__snapshots__/flyout.test.tsx.snap b/src/plugins/saved_objects_management/public/management_section/objects_table/components/__snapshots__/flyout.test.tsx.snap index e0d7f197c88..bb80392a8e4 100644 --- a/src/plugins/saved_objects_management/public/management_section/objects_table/components/__snapshots__/flyout.test.tsx.snap +++ b/src/plugins/saved_objects_management/public/management_section/objects_table/components/__snapshots__/flyout.test.tsx.snap @@ -13,9 +13,13 @@ exports[`Flyout conflicts should allow conflict resolution 1`] = ` >

@@ -38,7 +42,7 @@ exports[`Flyout conflicts should allow conflict resolution 1`] = ` >

, + "useUpdatedUX": undefined, } } /> @@ -277,9 +282,13 @@ exports[`Flyout legacy conflicts should allow conflict resolution 1`] = ` >

@@ -328,7 +337,7 @@ exports[`Flyout legacy conflicts should allow conflict resolution 1`] = ` >

, + "useUpdatedUX": undefined, } } /> @@ -491,7 +501,7 @@ Array [ >

, + "useUpdatedUX": undefined, } } /> @@ -541,9 +552,13 @@ exports[`Flyout should render cluster selector and import options when datasourc >

@@ -697,9 +712,13 @@ exports[`Flyout should render import step 1`] = ` >

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 a873c689020..8a451f6802e 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 @@ -12,7 +12,7 @@ exports[`Header - workspace enabled should render \`Import\` button inside a wor Object { "controlType": "button", "iconType": "exportAction", - "label": "Export all objects", + "label": "Export all assets", "run": [Function], "testId": "exportAllObjects", }, @@ -263,14 +263,14 @@ exports[`Header should render normally when useUpdatedUX is true 1`] = ` "controlType": "button", "disabled": false, "iconType": "copy", - "label": "Copy all objects to...", + "label": "Copy all assets to...", "run": [Function], "testId": "duplicateObjects", }, Object { "controlType": "button", "iconType": "exportAction", - "label": "Export all objects", + "label": "Export all assets", "run": [Function], "testId": "exportAllObjects", }, 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 c0537471afa..20c945c5ee4 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 @@ -84,9 +84,13 @@ exports[`Table prevents saved objects from being deleted 1`] = ` checked={true} label={ } name="includeReferencesDeep" @@ -324,9 +328,13 @@ exports[`Table should call onDuplicateSingle when show duplicate 1`] = ` checked={true} label={ } name="includeReferencesDeep" @@ -560,9 +568,13 @@ exports[`Table should render normally 1`] = ` checked={true} label={ } name="includeReferencesDeep" @@ -731,12 +743,18 @@ exports[`Table should render normally when use updated UX 1`] = ` toolsRight={ Array [ - + + + , , } name="includeReferencesDeep" @@ -828,7 +850,7 @@ exports[`Table should render normally when use updated UX 1`] = ` } />
void; + useUpdatedUX?: boolean; } interface State { @@ -128,10 +128,11 @@ export class SavedObjectsDuplicateModal extends React.Component @@ -142,21 +143,10 @@ export class SavedObjectsDuplicateModal extends React.Component <> - - {i18n.translate( - 'savedObjectsManagement.objectsTable.duplicateModal.targetWorkspaceNotice', - { - defaultMessage: `Move copied saved object${ - allSelectedObjects.length > 1 ? `s` : `` - } to the selected workspace.`, - } - )} - - <> @@ -186,7 +182,10 @@ export class SavedObjectsDuplicateModal extends React.Component { ); expect(document.children).toMatchSnapshot(); }); + + it('calls onClose after footer close button clicked', () => { + render(); + + const closeButton = screen.getByText('Close'); + fireEvent.click(closeButton); + + expect(onCloseMock).toHaveBeenCalledTimes(1); + }); }); diff --git a/src/plugins/saved_objects_management/public/management_section/objects_table/components/duplicate_result_flyout.tsx b/src/plugins/saved_objects_management/public/management_section/objects_table/components/duplicate_result_flyout.tsx index f1efcad4317..7b771d6723e 100644 --- a/src/plugins/saved_objects_management/public/management_section/objects_table/components/duplicate_result_flyout.tsx +++ b/src/plugins/saved_objects_management/public/management_section/objects_table/components/duplicate_result_flyout.tsx @@ -9,10 +9,12 @@ import { EuiFlexItem, EuiFlyout, EuiFlyoutBody, + EuiFlyoutFooter, EuiFlyoutHeader, EuiHorizontalRule, EuiIcon, EuiIconTip, + EuiSmallButton, EuiSpacer, EuiText, EuiTitle, @@ -226,6 +228,14 @@ export class DuplicateResultFlyout extends React.Component {this.copyResult({ failedCopies, successfulCopies })} + + + + + ); } diff --git a/src/plugins/saved_objects_management/public/management_section/objects_table/components/flyout.tsx b/src/plugins/saved_objects_management/public/management_section/objects_table/components/flyout.tsx index 38226d85399..5b2b1cf3a9a 100644 --- a/src/plugins/saved_objects_management/public/management_section/objects_table/components/flyout.tsx +++ b/src/plugins/saved_objects_management/public/management_section/objects_table/components/flyout.tsx @@ -103,6 +103,7 @@ export interface FlyoutProps { savedObjects: SavedObjectsClientContract; notifications: NotificationsStart; dataSourceManagement?: DataSourceManagementPluginSetup; + useUpdatedUX?: boolean; } export interface FlyoutState { @@ -281,7 +282,14 @@ export class Flyout extends Component { }; legacyImport = async () => { - const { serviceRegistry, indexPatterns, overlays, http, allowedTypes } = this.props; + const { + serviceRegistry, + indexPatterns, + overlays, + http, + allowedTypes, + useUpdatedUX, + } = this.props; const { file, importMode } = this.state; this.setState({ status: 'loading', error: undefined }); @@ -308,7 +316,11 @@ export class Flyout extends Component { status: 'error', error: i18n.translate( 'savedObjectsManagement.objectsTable.flyout.invalidFormatOfImportedFileErrorMessage', - { defaultMessage: 'Saved objects file format is invalid and cannot be imported.' } + { + defaultMessage: + '{useUpdatedUX, select, true {Assets} other {Saved objects}} file format is invalid and cannot be imported.', + values: { useUpdatedUX }, + } ), }); return; @@ -405,7 +417,7 @@ export class Flyout extends Component { failedImports, } = this.state; - const { serviceRegistry, indexPatterns, search } = this.props; + const { serviceRegistry, indexPatterns, search, useUpdatedUX } = this.props; this.setState({ error: undefined, @@ -459,7 +471,11 @@ export class Flyout extends Component { this.setState({ loadingMessage: i18n.translate( 'savedObjectsManagement.objectsTable.flyout.confirmLegacyImport.retryingFailedObjectsLoadingMessage', - { defaultMessage: 'Retrying failed objects…' } + { + defaultMessage: + 'Retrying failed {useUpdatedUX, select, true {assets} other {objects}}…', + values: { useUpdatedUX }, + } ), }); importCount += await saveObjects( @@ -530,7 +546,11 @@ export class Flyout extends Component { ), description: i18n.translate( 'savedObjectsManagement.objectsTable.flyout.renderConflicts.columnCountDescription', - { defaultMessage: 'How many affected objects' } + { + defaultMessage: + 'How many affected {useUpdatedUX, select, true {assets} other {objects}}', + values: { useUpdatedUX: this.props.useUpdatedUX }, + } ), render: (list: any[]) => { return {list.length}; @@ -540,11 +560,19 @@ export class Flyout extends Component { field: 'list', name: i18n.translate( 'savedObjectsManagement.objectsTable.flyout.renderConflicts.columnSampleOfAffectedObjectsName', - { defaultMessage: 'Sample of affected objects' } + { + defaultMessage: + 'Sample of affected {useUpdatedUX, select, true {assets} other {objects}}', + values: { useUpdatedUX: this.props.useUpdatedUX }, + } ), description: i18n.translate( 'savedObjectsManagement.objectsTable.flyout.renderConflicts.columnSampleOfAffectedObjectsDescription', - { defaultMessage: 'Sample of affected objects' } + { + defaultMessage: + 'Sample of affected {useUpdatedUX, select, true {assets} other {objects}}', + values: { useUpdatedUX: this.props.useUpdatedUX }, + } ), render: (list: any[]) => { return ( @@ -637,7 +665,7 @@ export class Flyout extends Component { importMode, } = this.state; - const { dataSourceEnabled } = this.props; + const { dataSourceEnabled, useUpdatedUX } = this.props; if (status === 'loading') { return ( @@ -654,7 +682,13 @@ export class Flyout extends Component { } if (isLegacyFile === false && status === 'success') { - return ; + return ( + + ); } // Import summary for failed legacy import @@ -674,10 +708,11 @@ export class Flyout extends Component {

@@ -728,7 +763,10 @@ export class Flyout extends Component { title={ } color="primary" @@ -751,8 +789,8 @@ export class Flyout extends Component {

@@ -850,6 +888,7 @@ export class Flyout extends Component { 'savedObjectsManagement.objectsTable.importModeControl.importOptionsTitle', { defaultMessage: 'Conflict management' } )} + useUpdatedUX={this.props.useUpdatedUX} />
@@ -979,7 +1018,7 @@ export class Flyout extends Component {

{ /> ), + useUpdatedUX: this.props.useUpdatedUX, }} />

@@ -1013,7 +1053,7 @@ export class Flyout extends Component { } render() { - const { close } = this.props; + const { close, useUpdatedUX } = this.props; let confirmOverwriteModal: ReactNode; const { conflictingRecord } = this.state; @@ -1031,7 +1071,8 @@ export class Flyout extends Component {

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 9ac49f00705..7d201e16f22 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 @@ -130,8 +130,8 @@ export const Header = ({ disabled: objectCount === 0, iconType: 'copy', label: i18n.translate( - 'savedObjectsManagement.objectsTable.header.duplicateAllButtonLabel', - { defaultMessage: 'Copy all objects to...' } + 'savedObjectsManagement.objectsTable.header.duplicateAllAssetsButtonLabel', + { defaultMessage: 'Copy all assets to...' } ), } as TopNavControlButtonData, ] @@ -141,9 +141,12 @@ export const Header = ({ run: onExportAll, controlType: 'button', iconType: 'exportAction', - label: i18n.translate('savedObjectsManagement.objectsTable.header.exportButtonLabel', { - defaultMessage: 'Export all objects', - }), + label: i18n.translate( + 'savedObjectsManagement.objectsTable.header.exportAssetsButtonLabel', + { + defaultMessage: 'Export all assets', + } + ), } as TopNavControlButtonData, ...(showImportButton ? [ diff --git a/src/plugins/saved_objects_management/public/management_section/objects_table/components/import_mode_control.tsx b/src/plugins/saved_objects_management/public/management_section/objects_table/components/import_mode_control.tsx index 996eaa2b1b5..3f835dd87f5 100644 --- a/src/plugins/saved_objects_management/public/management_section/objects_table/components/import_mode_control.tsx +++ b/src/plugins/saved_objects_management/public/management_section/objects_table/components/import_mode_control.tsx @@ -47,6 +47,7 @@ export interface ImportModeControlProps { isLegacyFile: boolean; updateSelection: (result: ImportMode) => void; optionLabel: string; + useUpdatedUX?: boolean; } export interface ImportMode { @@ -54,32 +55,43 @@ export interface ImportMode { overwrite: boolean; } -const createNewCopiesDisabled = { +const generateCreateNewCopiesDisabled = (useUpdatedUX?: boolean) => ({ id: 'createNewCopiesDisabled', text: i18n.translate( 'savedObjectsManagement.objectsTable.importModeControl.createNewCopies.disabledTitle', - { defaultMessage: 'Check for existing objects' } + { + defaultMessage: 'Check for existing {useUpdatedUX, select, true {assets} other {objects}}', + values: { useUpdatedUX }, + } ), tooltip: i18n.translate( 'savedObjectsManagement.objectsTable.importModeControl.createNewCopies.disabledText', { - defaultMessage: 'Check if objects were previously copied or imported.', + defaultMessage: + 'Check if {useUpdatedUX, select, true {assets} other {objects}} were previously copied or imported.', + values: { useUpdatedUX }, } ), -}; -const createNewCopiesEnabled = { +}); +const generateCreateNewCopiesEnabled = (useUpdatedUX?: boolean) => ({ id: 'createNewCopiesEnabled', text: i18n.translate( 'savedObjectsManagement.objectsTable.importModeControl.createNewCopies.enabledTitle', - { defaultMessage: 'Create new objects with unique IDs' } + { + defaultMessage: + 'Create new {useUpdatedUX, select, true {assets} other {objects}} with unique IDs', + values: { useUpdatedUX }, + } ), tooltip: i18n.translate( 'savedObjectsManagement.objectsTable.importModeControl.createNewCopies.enabledText', { - defaultMessage: 'Use this option to create one or more copies of the object.', + defaultMessage: + 'Use this option to create one or more copies of the {useUpdatedUX, select, true {asset} other {object}}.', + values: { useUpdatedUX }, } ), -}; +}); const overwriteEnabled = { id: 'overwriteEnabled', label: i18n.translate( @@ -123,9 +135,12 @@ export const ImportModeControl = ({ isLegacyFile, updateSelection, optionLabel, + useUpdatedUX, }: ImportModeControlProps) => { const [createNewCopies, setCreateNewCopies] = useState(initialValues.createNewCopies); const [overwrite, setOverwrite] = useState(initialValues.overwrite); + const createNewCopiesEnabled = generateCreateNewCopiesEnabled(useUpdatedUX); + const createNewCopiesDisabled = generateCreateNewCopiesDisabled(useUpdatedUX); const onChange = (partial: Partial) => { if (partial.createNewCopies !== undefined) { diff --git a/src/plugins/saved_objects_management/public/management_section/objects_table/components/import_summary.tsx b/src/plugins/saved_objects_management/public/management_section/objects_table/components/import_summary.tsx index cce1edceede..70787b48722 100644 --- a/src/plugins/saved_objects_management/public/management_section/objects_table/components/import_summary.tsx +++ b/src/plugins/saved_objects_management/public/management_section/objects_table/components/import_summary.tsx @@ -53,6 +53,7 @@ const DEFAULT_ICON = 'apps'; export interface ImportSummaryProps { failedImports: FailedImport[]; successfulImports: SavedObjectsImportSuccess[]; + useUpdatedUX?: boolean; } interface ImportItem { @@ -187,7 +188,11 @@ const getStatusIndicator = ({ outcome, errorMessage = 'Error' }: ImportItem) => } }; -export const ImportSummary = ({ failedImports, successfulImports }: ImportSummaryProps) => { +export const ImportSummary = ({ + failedImports, + successfulImports, + useUpdatedUX, +}: ImportSummaryProps) => { const importItems: ImportItem[] = _.sortBy( [ ...failedImports.map((x) => mapFailedImport(x)), @@ -208,13 +213,14 @@ export const ImportSummary = ({ failedImports, successfulImports }: ImportSummar {importItems.length === 1 ? ( ) : ( )}

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 6642dd61bd0..5f7ee123537 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 @@ -428,13 +428,22 @@ export class Table extends PureComponent { toolsRight={[ <> {useUpdatedUX && ( - + + + )} , <>{showDuplicate && duplicateButton}, @@ -478,7 +487,10 @@ export class Table extends PureComponent { label={ } checked={this.state.isIncludeReferencesDeepChecked} @@ -502,7 +514,7 @@ export class Table extends PureComponent { ]} /> {queryParseError} - +
{ expect(filters[1].options[1].value).toBe('bar'); }); - it('workspace filter only include current workspaces when in a workspace', async () => { + it('should hide workspace filter when in a workspace', async () => { const applications = applicationServiceMock.createStartContract(); applications.capabilities = { navLinks: {}, @@ -775,9 +775,7 @@ describe('SavedObjectsTable', () => { const props = component.find('Table').props() as TableProps; const filters = props.filters; const wsFilter = filters.filter((f) => f.field === 'workspaces'); - expect(wsFilter.length).toBe(1); - expect(wsFilter[0].options.length).toBe(1); - expect(wsFilter[0].options[0].value).toBe('foo'); + expect(wsFilter.length).toBe(0); }); it('current workspace in find options when workspace on', async () => { 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 12ee0682ae3..3ecfd103488 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 @@ -392,7 +392,7 @@ export class SavedObjectsTable extends Component { const { activeQuery: query } = this.state; - const { notifications, http } = this.props; + const { notifications, http, useUpdatedUX } = this.props; try { const resp = await findObjects(http, this.findOptions); @@ -421,7 +421,11 @@ export class SavedObjectsTable extends Component { - const { notifications, http } = this.props; + const { notifications, http, useUpdatedUX } = this.props; try { const resp = await findObject(http, type, id); if (!this._isMounted) { @@ -455,7 +459,11 @@ export class SavedObjectsTable extends Component { - const { notifications } = this.props; + const { notifications, useUpdatedUX } = this.props; if (exportDetails && exportDetails.missingReferences.length > 0) { notifications.toasts.addWarning({ title: i18n.translate( @@ -589,8 +597,11 @@ export class SavedObjectsTable extends Component { - const { savedObjectsClient, notifications } = this.props; + const { savedObjectsClient, notifications, useUpdatedUX } = this.props; const { selectedSavedObjects, isDeleting } = this.state; if (isDeleting) { @@ -657,7 +668,11 @@ export class SavedObjectsTable extends Component ); } @@ -704,7 +720,7 @@ export class SavedObjectsTable extends Component { - const { notifications, http } = this.props; + const { notifications, http, useUpdatedUX } = this.props; const findOptions = this.findOptions; findOptions.perPage = 9999; findOptions.page = 1; @@ -725,7 +741,11 @@ export class SavedObjectsTable extends Component { - const { notifications, workspaces } = this.props; + const { notifications, workspaces, useUpdatedUX } = this.props; const workspaceClient = workspaces.client$.getValue(); const showErrorNotification = () => { notifications.toasts.addDanger({ title: i18n.translate('savedObjectsManagement.objectsTable.duplicate.dangerNotification', { defaultMessage: - 'Unable to copy {errorCount, plural, one {# saved object} other {# saved objects}}.', - values: { errorCount: savedObjects.length }, + 'Unable to copy {useUpdatedUX, select, true {{errorCount, plural, one {# asset} other {# assets}}} other {{errorCount, plural, one {# saved object} other {# saved objects}}}}.', + values: { errorCount: savedObjects.length, useUpdatedUX }, }), }); }; @@ -790,6 +810,7 @@ export class SavedObjectsTable extends Component ); } @@ -975,8 +996,9 @@ export class SavedObjectsTable extends Component @@ -1017,7 +1039,10 @@ export class SavedObjectsTable extends Component } checked={isIncludeReferencesDeepChecked} @@ -1122,18 +1147,16 @@ export class SavedObjectsTable extends Component (currentWorkspace ? currentWorkspace.id === ws.id : true)) - .map((ws) => { - return { - name: ws.name, - value: ws.name, - view: `${ws.name} (${wsCounts[ws.id] || 0})`, - }; - }); + const wsFilterOptions = availableWorkspaces.map((ws) => { + return { + name: ws.name, + value: ws.name, + view: `${ws.name} (${wsCounts[ws.id] || 0})`, + }; + }); filters.push({ type: 'field_value_selection', @@ -1148,7 +1171,7 @@ export class SavedObjectsTable extends Component + {this.renderFlyout()} {this.renderRelationships()} {this.renderDeleteConfirmModal()} diff --git a/src/plugins/workspace/public/plugin.ts b/src/plugins/workspace/public/plugin.ts index ef9906f1935..65c6e28e944 100644 --- a/src/plugins/workspace/public/plugin.ts +++ b/src/plugins/workspace/public/plugin.ts @@ -517,9 +517,11 @@ export class WorkspacePlugin } /** - * register workspace column into saved objects table + * Only register workspace column into saved objects table when out of workspace */ - savedObjectsManagement?.columns.register(getWorkspaceColumn(core)); + if (!core.workspaces.currentWorkspaceId$.getValue()) { + savedObjectsManagement?.columns.register(getWorkspaceColumn(core)); + } /** * Add workspace list to settings and setup group