-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: duplicate selected/all saved objects UI #305
feat: duplicate selected/all saved objects UI #305
Conversation
…ject#53) * Add copy saved objects among workspaces functionality Signed-off-by: gaobinlong <gbinlong@amazon.com> Signed-off-by: gaobinlong <gbinlong@amazon.com> * Fix bug Signed-off-by: gaobinlong <gbinlong@amazon.com> * Fix bug Signed-off-by: gaobinlong <gbinlong@amazon.com> --------- Signed-off-by: gaobinlong <gbinlong@amazon.com> # Conflicts: # src/core/server/saved_objects/routes/copy.ts # src/plugins/saved_objects_management/public/constants.ts # src/plugins/saved_objects_management/public/management_section/objects_table/components/header.tsx # src/plugins/saved_objects_management/public/management_section/objects_table/saved_objects_table.tsx
* fix typo Signed-off-by: yuye-aws <yuyezhu@amazon.com> * adjust copy modal Signed-off-by: yuye-aws <yuyezhu@amazon.com> * list workspace with write permission on copy modal Signed-off-by: yuye-aws <yuyezhu@amazon.com> * add copy icon and move getcopyworkspaces function from copy_modal to saved_object table Signed-off-by: yuye-aws <yuyezhu@amazon.com> * fix duplicate error in public workspace and change copy to duplicate all in header Signed-off-by: yuye-aws <yuyezhu@amazon.com> * bug fix: create saved objects in public workspace Signed-off-by: yuye-aws <yuyezhu@amazon.com> * update snapshots Signed-off-by: yuye-aws <yuyezhu@amazon.com> * remove unused import Signed-off-by: yuye-aws <yuyezhu@amazon.com> * change validate schema Signed-off-by: yuye-aws <yuyezhu@amazon.com> * behavior subject bug fix for workspace plugin Signed-off-by: yuye-aws <yuyezhu@amazon.com> --------- Signed-off-by: yuye-aws <yuyezhu@amazon.com> # Conflicts: # src/core/public/chrome/ui/header/__snapshots__/header.test.tsx.snap # src/core/server/saved_objects/permission_control/acl.test.ts # src/core/server/saved_objects/permission_control/client.ts # src/plugins/saved_objects_management/public/management_section/objects_table/components/copy_modal.tsx # src/plugins/workspace/server/plugin.ts # src/plugins/workspace/server/saved_objects/workspace_saved_objects_client_wrapper.ts
* hide import for application home page Signed-off-by: Hailong Cui <ihailong@amazon.com> * add workpspace into gotoApp link Signed-off-by: Hailong Cui <ihailong@amazon.com> * remove special logic for management workspace Signed-off-by: Hailong Cui <ihailong@amazon.com> * variable name change and more UTs Signed-off-by: Hailong Cui <ihailong@amazon.com> --------- Signed-off-by: Hailong Cui <ihailong@amazon.com> # Conflicts: # src/plugins/saved_objects_management/public/management_section/objects_table/__snapshots__/saved_objects_table.test.tsx.snap # src/plugins/saved_objects_management/public/management_section/objects_table/components/__snapshots__/header.test.tsx.snap # src/plugins/saved_objects_management/public/management_section/objects_table/components/table.test.tsx # src/plugins/saved_objects_management/public/management_section/objects_table/components/table.tsx # src/plugins/saved_objects_management/public/management_section/objects_table/saved_objects_table.test.tsx # src/plugins/saved_objects_management/public/management_section/objects_table/saved_objects_table.tsx
* implement all duplicate copy modal Signed-off-by: yuye-aws <yuyezhu@amazon.com> * add spacer after checkbox list Signed-off-by: yuye-aws <yuyezhu@amazon.com> * add fail message for copy saved objects Signed-off-by: yuye-aws <yuyezhu@amazon.com> * change title wording to manage library Signed-off-by: yuye-aws <yuyezhu@amazon.com> * single duplicate Signed-off-by: yuye-aws <yuyezhu@amazon.com> * change wording Signed-off-by: yuye-aws <yuyezhu@amazon.com> * remove comment Signed-off-by: yuye-aws <yuyezhu@amazon.com> * bug fix: keep selected saved objects info when cancel duplicate all Signed-off-by: yuye-aws <yuyezhu@amazon.com> * fix typo Signed-off-by: yuye-aws <yuyezhu@amazon.com> * use icu syntax in copy message Signed-off-by: yuye-aws <yuyezhu@amazon.com> * bug fix: keep selected saved objects info when cancel duplicate single Signed-off-by: yuye-aws <yuyezhu@amazon.com> * set current workspace as the first option Signed-off-by: yuye-aws <yuyezhu@amazon.com> * update snapshot Signed-off-by: yuye-aws <yuyezhu@amazon.com> * resolve conflict Signed-off-by: yuye-aws <yuyezhu@amazon.com> * update snapshot Signed-off-by: yuye-aws <yuyezhu@amazon.com> * bug fix for saved object table Signed-off-by: yuye-aws <yuyezhu@amazon.com> * update snapshot Signed-off-by: yuye-aws <yuyezhu@amazon.com> * remove unused file Signed-off-by: yuye-aws <yuyezhu@amazon.com> * change i18n constant Signed-off-by: yuye-aws <yuyezhu@amazon.com> * remove empty push Signed-off-by: yuye-aws <yuyezhu@amazon.com> * hide duplicate when workspace is disabled Signed-off-by: yuye-aws <yuyezhu@amazon.com> * update snapshots Signed-off-by: yuye-aws <yuyezhu@amazon.com> --------- Signed-off-by: yuye-aws <yuyezhu@amazon.com> # Conflicts: # src/plugins/saved_objects_management/public/constants.ts # src/plugins/saved_objects_management/public/management_section/objects_table/__snapshots__/saved_objects_table.test.tsx.snap # src/plugins/saved_objects_management/public/management_section/objects_table/components/copy_modal.tsx # src/plugins/saved_objects_management/public/management_section/objects_table/components/header.tsx # src/plugins/saved_objects_management/public/management_section/objects_table/saved_objects_table.tsx # src/plugins/saved_objects_management/public/plugin.ts
* rename copy to duplicate Signed-off-by: yuye-aws <yuyezhu@amazon.com> * duplicate in visualization Signed-off-by: yuye-aws <yuyezhu@amazon.com> * duplicate in dashboard Signed-off-by: yuye-aws <yuyezhu@amazon.com> * resolve conflict Signed-off-by: yuye-aws <yuyezhu@amazon.com> * update test and snapshots Signed-off-by: yuye-aws <yuyezhu@amazon.com> * re-duplicate if some objects cannot be duplicated Signed-off-by: yuye-aws <yuyezhu@amazon.com> * remove clone for dashboard Signed-off-by: yuye-aws <yuyezhu@amazon.com> * rename duplicateState to duplicateMode Signed-off-by: yuye-aws <yuyezhu@amazon.com> * change workspace prop to currentWorkspace in SavedObjectsDuplicateModal Signed-off-by: yuye-aws <yuyezhu@amazon.com> * change wording Signed-off-by: yuye-aws <yuyezhu@amazon.com> * move duplicate modal to saved_objects for reuse Signed-off-by: yuye-aws <yuyezhu@amazon.com> * move duplicate modal to saved objects management for reuse Signed-off-by: yuye-aws <yuyezhu@amazon.com> * remove minimal duplicate modal props logic Signed-off-by: yuye-aws <yuyezhu@amazon.com> * refactor duplicate modal props for dashboard and visualization Signed-off-by: yuye-aws <yuyezhu@amazon.com> * Update getDuplicateWorkspaces function Co-authored-by: Yulong Ruan <ruanyu1@gmail.com> * update function onDuplicate for dashboard Signed-off-by: yuye-aws <yuyezhu@amazon.com> * Update doDuplicate for visualization Co-authored-by: Yulong Ruan <ruanyu1@gmail.com> * refactor function getDuplicateWorkspaces Signed-off-by: yuye-aws <yuyezhu@amazon.com> * add i18n context to saved objects table duplicate modal Signed-off-by: yuye-aws <yuyezhu@amazon.com> * refactor duplicate modal logic in saved object table Signed-off-by: yuye-aws <yuyezhu@amazon.com> * add error message for partial duplicate failed Signed-off-by: yuye-aws <yuyezhu@amazon.com> * merge commits Signed-off-by: yuye-aws <yuyezhu@amazon.com> * add type info for dashboard and visualization Signed-off-by: yuye-aws <yuyezhu@amazon.com> * remote create vis reference logic Signed-off-by: yuye-aws <yuyezhu@amazon.com> * Revert "remove clone for dashboard" This reverts commit 84f77fb. * hide duplicate when workspace disabled in dashboard Signed-off-by: yuye-aws <yuyezhu@amazon.com> * feat: skip permission validate when no workspaces and permissions attributes (opensearch-project#163) * feat: skip permission validate when saved object without workspaces and permissions attributes Signed-off-by: Lin Wang <wonglam@amazon.com> * feat: add annontation to skip permission check Signed-off-by: Lin Wang <wonglam@amazon.com> * refactor: remove bind and simplify validate logic Signed-off-by: Lin Wang <wonglam@amazon.com> * feat: remove library write for object based ACL Signed-off-by: Lin Wang <wonglam@amazon.com> --------- Signed-off-by: Lin Wang <wonglam@amazon.com> * remove get workspaces with write permission logic and add readonly props to workspace attribute Signed-off-by: yuye-aws <yuyezhu@amazon.com> * change type definition logic Signed-off-by: yuye-aws <yuyezhu@amazon.com> * Fix typo (opensearch-project#176) --------- Signed-off-by: Yulong Ruan <ruanyl@amazon.com> * remove exit workspace logic (opensearch-project#179) Signed-off-by: yuye-aws <yuyezhu@amazon.com> * rename copy to duplicate Signed-off-by: yuye-aws <yuyezhu@amazon.com> * duplicate in visualization Signed-off-by: yuye-aws <yuyezhu@amazon.com> * duplicate in dashboard Signed-off-by: yuye-aws <yuyezhu@amazon.com> * resolve conflict Signed-off-by: yuye-aws <yuyezhu@amazon.com> * update test and snapshots Signed-off-by: yuye-aws <yuyezhu@amazon.com> * re-duplicate if some objects cannot be duplicated Signed-off-by: yuye-aws <yuyezhu@amazon.com> * remove clone for dashboard Signed-off-by: yuye-aws <yuyezhu@amazon.com> * rename duplicateState to duplicateMode Signed-off-by: yuye-aws <yuyezhu@amazon.com> * change workspace prop to currentWorkspace in SavedObjectsDuplicateModal Signed-off-by: yuye-aws <yuyezhu@amazon.com> * change wording Signed-off-by: yuye-aws <yuyezhu@amazon.com> * move duplicate modal to saved_objects for reuse Signed-off-by: yuye-aws <yuyezhu@amazon.com> * move duplicate modal to saved objects management for reuse Signed-off-by: yuye-aws <yuyezhu@amazon.com> * remove minimal duplicate modal props logic Signed-off-by: yuye-aws <yuyezhu@amazon.com> * refactor duplicate modal props for dashboard and visualization Signed-off-by: yuye-aws <yuyezhu@amazon.com> * Update getDuplicateWorkspaces function Co-authored-by: Yulong Ruan <ruanyu1@gmail.com> * update function onDuplicate for dashboard Signed-off-by: yuye-aws <yuyezhu@amazon.com> * Update doDuplicate for visualization Co-authored-by: Yulong Ruan <ruanyu1@gmail.com> * refactor function getDuplicateWorkspaces Signed-off-by: yuye-aws <yuyezhu@amazon.com> * add i18n context to saved objects table duplicate modal Signed-off-by: yuye-aws <yuyezhu@amazon.com> * refactor duplicate modal logic in saved object table Signed-off-by: yuye-aws <yuyezhu@amazon.com> * add error message for partial duplicate failed Signed-off-by: yuye-aws <yuyezhu@amazon.com> * merge commits Signed-off-by: yuye-aws <yuyezhu@amazon.com> * add type info for dashboard and visualization Signed-off-by: yuye-aws <yuyezhu@amazon.com> * remote create vis reference logic Signed-off-by: yuye-aws <yuyezhu@amazon.com> * Revert "remove clone for dashboard" This reverts commit 84f77fb. * hide duplicate when workspace disabled in dashboard Signed-off-by: yuye-aws <yuyezhu@amazon.com> * remove get workspaces with write permission logic and add readonly props to workspace attribute Signed-off-by: yuye-aws <yuyezhu@amazon.com> * change type definition logic Signed-off-by: yuye-aws <yuyezhu@amazon.com> * rename variable and function name Signed-off-by: yuye-aws <yuyezhu@amazon.com> * change permission mode to get target workspaces when duplicate Signed-off-by: yuye-aws <yuyezhu@amazon.com> --------- Signed-off-by: yuye-aws <yuyezhu@amazon.com> Signed-off-by: Lin Wang <wonglam@amazon.com> Signed-off-by: Yulong Ruan <ruanyl@amazon.com> Co-authored-by: Yulong Ruan <ruanyu1@gmail.com> Co-authored-by: Lin Wang <wonglam@amazon.com> Co-authored-by: Yulong Ruan <ruanyl@amazon.com> # Conflicts: # src/core/public/workspace/workspaces_service.ts # src/plugins/saved_objects_management/public/constants.ts # src/plugins/saved_objects_management/public/management_section/objects_table/components/duplicate_modal.tsx # src/plugins/saved_objects_management/public/management_section/objects_table/saved_objects_table.tsx # src/plugins/workspace/server/saved_objects/workspace_saved_objects_client_wrapper.ts
...ed_objects_management/public/management_section/objects_table/components/duplicate_modal.tsx
Outdated
Show resolved
Hide resolved
...ed_objects_management/public/management_section/objects_table/components/duplicate_modal.tsx
Outdated
Show resolved
Hide resolved
...ed_objects_management/public/management_section/objects_table/components/duplicate_modal.tsx
Show resolved
Hide resolved
...ed_objects_management/public/management_section/objects_table/components/duplicate_modal.tsx
Outdated
Show resolved
Hide resolved
.../saved_objects_management/public/management_section/objects_table/components/header.test.tsx
Outdated
Show resolved
Hide resolved
* modal can still recover (e.g. the name of the saved object was already taken). | ||
*/ | ||
|
||
export function showDuplicateModal( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file is used for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file is used to reuse the duplicate logic in subsequent dashboard and visualize plugins.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we need to show a modal, we can embed it as a React component. Why do we make it as a util?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The file has been deleted.
...lugins/saved_objects_management/public/management_section/objects_table/components/table.tsx
Outdated
Show resolved
Hide resolved
...ins/saved_objects_management/public/management_section/objects_table/saved_objects_table.tsx
Outdated
Show resolved
Hide resolved
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## workspace-pr-integr #305 +/- ##
=======================================================
+ Coverage 67.05% 67.09% +0.03%
=======================================================
Files 3345 3349 +4
Lines 65045 65156 +111
Branches 10505 10525 +20
=======================================================
+ Hits 43617 43717 +100
- Misses 18849 18860 +11
Partials 2579 2579
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Signed-off-by: yubonluo <yubonluo@amazon.com>
…Dashboards into pr-integr-duplicate
Signed-off-by: yubonluo <yubonluo@amazon.com>
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
* | ||
* Any modifications Copyright OpenSearch Contributors. See |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code in copy.ts and copy.test.ts are old, please use the code in the workspace-pr-integr
branch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have reverted these codes
Signed-off-by: yubonluo <yubonluo@amazon.com>
Signed-off-by: yubonluo <yubonluo@amazon.com>
Signed-off-by: yubonluo <yubonluo@amazon.com>
Signed-off-by: yubonluo <yubonluo@amazon.com>
/* | ||
* 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. | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/* | |
* 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. | |
*/ | |
/* | |
* Copyright OpenSearch Contributors | |
* SPDX-License-Identifier: Apache-2.0 | |
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
if (duplicateMode === DuplicateMode.All) { | ||
selectedObjects = selectedObjects.filter((item) => this.isSavedObjectTypeIncluded(item.type)); | ||
} | ||
// If the target workspace is selected, all saved objects will be retained. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// If the target workspace is selected, all saved objects will be retained. | |
// If the target workspace is not selected, all saved objects will be retained. |
Should be not selected?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have modified it according to your suggestion.
> | ||
<> | ||
<EuiText size="s" color="subdued"> | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems the text is not wrapped by i18n
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
400 lines are a too large for a single component, can we split it?
Some recommendations:
- Move enum or types to separate files.
- Split some render logic into a small Component. ->
renderDuplicateObjectCategory
renderDuplicateObjectCategories
. - Consider to move some data transform function to util.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code has been split to two files.
- The enum file has been moved to types.ts;
- The renderDuplicateObjectCategory and renderDuplicateObjectCategories function has been moved to a new tsx file.
@@ -31,19 +31,59 @@ | |||
import React from 'react'; | |||
import { shallow } from 'enzyme'; | |||
import { Header } from './header'; | |||
import { any } from 'bluebird'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import { any } from 'bluebird'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have modified it according to your suggestion.
const newIndexPatternUrl = applications.getUrlForApp('management', { | ||
path: 'opensearch-dashboards/indexPatterns', | ||
}); | ||
const newIndexPatternUrl = applications.getUrlForApp('indexPatterns'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const newIndexPatternUrl = applications.getUrlForApp('indexPatterns'); | |
const newIndexPatternUrl = applications.getUrlForApp('management', { | |
path: 'opensearch-dashboards/indexPatterns', | |
}); |
Please do not change the index pattern url in this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have modified it according to your suggestion.
import { DataPublicPluginStart } from '../../../../../plugins/data/public'; | ||
import { Header, Table, Flyout, Relationships, SavedObjectsDuplicateModal } from './components'; | ||
import { DataPublicPluginStart } from '../../../../data/public'; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have modified it according to your suggestion.
import { Header, Table, Flyout, Relationships, SavedObjectsDuplicateModal } from './components'; | ||
import { DataPublicPluginStart } from '../../../../data/public'; | ||
|
||
import { DuplicateMode } from './'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should import from ./components
instead of ./index
. Import from ./index
makes the dependency chain confusing.
jest.clearAllMocks(); | ||
jest.resetModules(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am thinking maybe we should only clear the needed mocks instead of clearAll.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems that we don't any afterEach code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have deleted the logic
@@ -78,14 +80,15 @@ export interface TableProps { | |||
items: SavedObjectWithMetadata[]; | |||
itemId: string | (() => string); | |||
totalItemCount: number; | |||
onQueryChange: (query: any, filterFields: string[]) => void; | |||
onQueryChange: (query: any, filterFields?: string[]) => void; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems unrelated changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have deleted it according to your suggestion.
import { Header, Table, Flyout, Relationships } from './components'; | ||
import { DataPublicPluginStart } from '../../../../../plugins/data/public'; | ||
import { Header, Table, Flyout, Relationships, SavedObjectsDuplicateModal } from './components'; | ||
import { DataPublicPluginStart } from '../../../../data/public'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import { DataPublicPluginStart } from '../../../../data/public'; | |
import { DataPublicPluginStart } from '../../../../plugins/data/public'; |
better to avoid unnecessary change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have modified it according to your suggestion.
Signed-off-by: yubonluo <yubonluo@amazon.com>
Signed-off-by: yubonluo <yubonluo@amazon.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks much better than the first version, good job!
@@ -38,12 +38,51 @@ describe('Header', () => { | |||
onExportAll: () => {}, | |||
onImport: () => {}, | |||
onRefresh: () => {}, | |||
totalCount: 4, | |||
onDuplicate: () => {}, | |||
title: 'Saved Objects', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
title is not a required props for header I think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have deleted the useless code.
const targetWorkspaceId = targetWorkspaceOption?.at(0)?.key; | ||
let selectedObjects = allSelectedObjects; | ||
if (duplicateMode === DuplicateMode.All) { | ||
selectedObjects = selectedObjects.filter((item) => this.isSavedObjectTypeIncluded(item.type)); | ||
} | ||
// If the target workspace is not selected, all saved objects will be retained. | ||
// If the target workspace has been selected, filter out the saved objects that belongs to the workspace. | ||
const includedSelectedObjects = selectedObjects.filter((item) => | ||
!!targetWorkspaceId && !!item.workspaces ? !item.workspaces.includes(targetWorkspaceId) : true | ||
); | ||
|
||
const ignoredSelectedObjectsLength = selectedObjects.length - includedSelectedObjects.length; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extract to a method of the component maybe? It is hard to understand what these lines are doing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, have extracted the logic to a method.
Signed-off-by: yubonluo <yubonluo@amazon.com>
…shboards into pr-integr-duplicate
Signed-off-by: yubonluo <yubonluo@amazon.com>
Signed-off-by: yubonluo <yubonluo@amazon.com>
…shboards into pr-integr-duplicate
Signed-off-by: yubonluo <yubonluo@amazon.com>
Signed-off-by: yubonluo <yubonluo@amazon.com>
Signed-off-by: yubonluo <yubonluo@amazon.com>
Signed-off-by: yubonluo <yubonluo@amazon.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Description
duplicate selected/all saved objects UI
Screenshot
Testing the changes
Check List
yarn test:jest
yarn test:jest_integration