From 4053661e0a74294bd6e58e94c9ec21cce634a1a7 Mon Sep 17 00:00:00 2001 From: leSamo Date: Mon, 13 May 2024 22:27:54 +0200 Subject: [PATCH] System "removal" instead of "deletion" --- doc/props_detail.md | 6 ++-- src/Utilities/DeleteModal.js | 1 + .../__snapshots__/DeleteModal.test.js.snap | 2 ++ src/components/InventoryDetail/TopBar.js | 6 ++-- src/components/InventoryDetail/TopBar.test.js | 8 ++--- .../RemoveHostsFromGroupModal.test.js | 2 +- .../HostStalenessCard.js | 4 +-- .../InventoryHostStaleness/constants.js | 32 +++++++++---------- .../ConventionalSystemsTab.js | 4 +-- .../ConventionalSystemsTab.test.js | 14 +++----- .../ConventionalSystems/useTableActions.js | 2 +- .../InventoryComponents/HybridInventory.cy.js | 32 +++++++++++-------- src/routes/InventoryDetail.cy.js | 12 +++---- src/routes/InventoryHostStaleness.js | 4 +-- src/store/actions.js | 2 +- src/store/inventory-actions.js | 2 +- 16 files changed, 68 insertions(+), 65 deletions(-) diff --git a/doc/props_detail.md b/doc/props_detail.md index a5728ff78..5fa128af0 100644 --- a/doc/props_detail.md +++ b/doc/props_detail.md @@ -74,13 +74,13 @@ Callback function that is fired when user clicks on application tab. *function* -Callback function that is fired when user deletes currently observed system. +Callback function that is fired when user removes currently observed system. ## showDelete *boolean* -Toggle to display delete button for removing system from inventory DB. +Toggle to display remove button for removing system from inventory DB. ## appList @@ -122,7 +122,7 @@ React element to be rendered as wrapper for tags element value, including tags m *element* -React element to be rendered as wrapper for rendering delete button. +React element to be rendered as wrapper for rendering remove button. ## ActionsWrapper diff --git a/src/Utilities/DeleteModal.js b/src/Utilities/DeleteModal.js index 342cfa441..1158da70f 100644 --- a/src/Utilities/DeleteModal.js +++ b/src/Utilities/DeleteModal.js @@ -73,6 +73,7 @@ const DeleteModal = ({ ) : ( )} @@ -174,7 +174,7 @@ const TopBar = ({ addNotification({ id: 'remove-initiated', variant: 'warning', - title: 'Delete operation initiated', + title: 'Remove operation initiated', description: `Removal of ${entity.display_name} started.`, dismissable: false, }); diff --git a/src/components/InventoryDetail/TopBar.test.js b/src/components/InventoryDetail/TopBar.test.js index 6c509bd0b..4c7922017 100644 --- a/src/components/InventoryDetail/TopBar.test.js +++ b/src/components/InventoryDetail/TopBar.test.js @@ -93,7 +93,7 @@ describe('TopBar', () => { ).not.toBeInTheDocument(); }); - it('shows delete button by default', () => { + it('shows remove button by default', () => { render( @@ -102,12 +102,12 @@ describe('TopBar', () => { expect( screen.getByRole('button', { - name: /delete/i, + name: /remove/i, }) ).toHaveAttribute('aria-disabled', 'false'); }); - it('disables delete button', () => { + it('disables remove button', () => { render( @@ -116,7 +116,7 @@ describe('TopBar', () => { expect( screen.getByRole('button', { - name: /delete/i, + name: /remove/i, }) ).toHaveAttribute('aria-disabled', 'true'); }); diff --git a/src/components/InventoryGroups/Modals/__tests__/RemoveHostsFromGroupModal.test.js b/src/components/InventoryGroups/Modals/__tests__/RemoveHostsFromGroupModal.test.js index 2aff6e8ee..a453580ce 100644 --- a/src/components/InventoryGroups/Modals/__tests__/RemoveHostsFromGroupModal.test.js +++ b/src/components/InventoryGroups/Modals/__tests__/RemoveHostsFromGroupModal.test.js @@ -64,7 +64,7 @@ describe('RemoveHostsFromGroupModal', () => { expect(setIsModalOpen).toBeCalled(); }); - it('can cancel the deletion', async () => { + it('can cancel the removal', async () => { render( { - Organization level system staleness and deletion + Organization level system staleness and removal <InventoryHostStalenessPopover hasEdgeSystems={hasEdgeSystems} /> @@ -364,7 +364,7 @@ const HostStalenessCard = ({ canModifyHostStaleness }) => { ouiaId="BasicModal" > {`Changing the organization level setting for system staleness and - deletion may impact your systems. Some systems may be deleted as a result.`} + removal may impact your systems. Some systems may be removed as a result.`} )}{' '} diff --git a/src/components/InventoryHostStaleness/constants.js b/src/components/InventoryHostStaleness/constants.js index 408edaf8c..c6ed741c7 100644 --- a/src/components/InventoryHostStaleness/constants.js +++ b/src/components/InventoryHostStaleness/constants.js @@ -73,7 +73,7 @@ export const conditionalDropdownError = (newFormValues, dropdownItems) => { className="pf-v5-u-font-size-sm pf-v5-u-danger-color-100" style={{ width: '200px' }} > - Staleness must be before deletion + Staleness must be before removal

); } else { @@ -87,7 +87,7 @@ export const conditionalDropdownError = (newFormValues, dropdownItems) => { className="pf-v5-u-font-size-sm pf-v5-u-danger-color-100" style={{ width: '200px' }} > - Stale warning must be before deletion + Stale warning must be before removal

); } else if (formValue < newFormValues['conventional_time_to_stale']) { @@ -114,7 +114,7 @@ export const conditionalDropdownError = (newFormValues, dropdownItems) => { className="pf-v5-u-font-size-sm pf-v5-u-danger-color-100" style={{ width: '200px' }} > - Deletion must be after staleness + Removal must be after staleness

); } else if (formValue < newFormValues['conventional_time_to_stale']) { @@ -123,7 +123,7 @@ export const conditionalDropdownError = (newFormValues, dropdownItems) => { className="pf-v5-u-font-size-sm pf-v5-u-danger-color-100" style={{ width: '200px' }} > - Deletion must be after stale warning + Removal must be after stale warning

); } else { @@ -151,7 +151,7 @@ export const conditionalDropdownError = (newFormValues, dropdownItems) => { className="pf-v5-u-font-size-sm pf-v5-u-danger-color-100" style={{ width: '200px' }} > - Staleness must be before deletion + Staleness must be before removal

); } else { @@ -169,7 +169,7 @@ export const conditionalDropdownError = (newFormValues, dropdownItems) => { className="pf-v5-u-font-size-sm pf-v5-u-danger-color-100 " style={{ width: '200px' }} > - Stale warning must be before deletion + Stale warning must be before removal

); } else if (formValue < newFormValues['immutable_time_to_stale']) { @@ -196,7 +196,7 @@ export const conditionalDropdownError = (newFormValues, dropdownItems) => { className="pf-v5-u-font-size-sm pf-v5-u-danger-color-100" style={{ width: '200px' }} > - Deletion must be after staleness + Removal must be after staleness

); } else if (formValue < newFormValues['immutable_time_to_stale']) { @@ -205,7 +205,7 @@ export const conditionalDropdownError = (newFormValues, dropdownItems) => { className="pf-v5-u-font-size-sm pf-v5-u-danger-color-100" style={{ width: '200px' }} > - Deletion must be after stale warning + Removal must be after stale warning

); } else { @@ -239,7 +239,7 @@ export const HostStalenessResetDefaultPopover = ({ activeTabKey }) => { - - Systems are deleted after 2 years since last check-in. + - Systems are removed after 2 years since last check-in. ) : ( @@ -256,7 +256,7 @@ export const HostStalenessResetDefaultPopover = ({ activeTabKey }) => { - - Systems are deleted after 14 days since last check-in. + - Systems are removed after 14 days since last check-in. ) @@ -286,7 +286,7 @@ export const InventoryHostStalenessPopover = ({ hasEdgeSystems }) => {

Configure the number of days it will take for your systems to be - marked as stale, stale warning, and be deleted. + marked as stale, stale warning, and be removed.

{ check-in. - - Systems are deleted after 14 days since last check-in. + - Systems are removed after 14 days since last check-in. {hasEdgeSystems && ( @@ -327,7 +327,7 @@ export const InventoryHostStalenessPopover = ({ hasEdgeSystems }) => { check-in. - - Systems are deleted after 2 years since last check-in. + - Systems are removed after 2 years since last check-in.
)} @@ -412,7 +412,7 @@ export const systemStalenessWarningItems = (activeTabKey) => { : 'conventional_time_to_stale_warning', title: 'System stale warning', modalMessage: - 'A stale warning status on a system indicates that your system has not checked-in in a while, and is at risk of being deleted from your inventory.', + 'A stale warning status on a system indicates that your system has not checked-in in a while, and is at risk of being removed from your inventory.', }, { name: '14 days', @@ -481,9 +481,9 @@ export const systemDeletionItems = (activeTabKey) => { apiKey: activeTabKey ? 'immutable_time_to_delete' : 'conventional_time_to_delete', - title: 'System deletion', + title: 'System removal', modalMessage: - 'This is the time at which your system will be deleted from your inventory. Once your system is deleted, it will have to be re-registered to be added back to your inventory.', + 'This is the time at which your system will be removed from your inventory. Once your system is removed, it will have to be re-registered to be added back to your inventory.', }, { name: '21 days', diff --git a/src/components/InventoryTabs/ConventionalSystems/ConventionalSystemsTab.js b/src/components/InventoryTabs/ConventionalSystems/ConventionalSystemsTab.js index a4ef090b5..396ca0956 100644 --- a/src/components/InventoryTabs/ConventionalSystems/ConventionalSystemsTab.js +++ b/src/components/InventoryTabs/ConventionalSystems/ConventionalSystemsTab.js @@ -40,7 +40,7 @@ const BulkDeleteButton = ({ selectedSystems, ...props }) => { ouiaId="bulk-delete-button" {...props} > - Delete + Remove ); }; @@ -266,7 +266,7 @@ const ConventionalSystemsTab = ({ addNotificationAction({ id: 'remove-initiated', variant: 'warning', - title: 'Delete operation initiated', + title: 'Remove operation initiated', description: `Removal of ${displayName} started.`, dismissable: false, }) diff --git a/src/components/InventoryTabs/ConventionalSystems/ConventionalSystemsTab.test.js b/src/components/InventoryTabs/ConventionalSystems/ConventionalSystemsTab.test.js index dccd27454..1257bba88 100644 --- a/src/components/InventoryTabs/ConventionalSystems/ConventionalSystemsTab.test.js +++ b/src/components/InventoryTabs/ConventionalSystems/ConventionalSystemsTab.test.js @@ -153,7 +153,7 @@ describe('ConventionalSystemsTab', () => { expect( screen.getByRole('button', { - name: /delete/i, + name: /remove/i, }) ).toBeEnabled(); @@ -164,7 +164,7 @@ describe('ConventionalSystemsTab', () => { ).toBeEnabled(); }); - it('can delete items', async () => { + it('can remove items', async () => { hosts.apiHostDeleteHostById = jest.fn(); const selected = new Map(); selected.set(system1.id, system1); @@ -184,7 +184,7 @@ describe('ConventionalSystemsTab', () => { await userEvent.click( screen.getByRole('button', { - name: /delete/i, + name: /remove/i, }) ); expect( @@ -192,11 +192,7 @@ describe('ConventionalSystemsTab', () => { name: /remove from inventory/i, }) ).toBeVisible(); - await userEvent.click( - screen.getByRole('button', { - name: /remove/i, - }) - ); + await userEvent.click(screen.getByTestId('confirm-inventory-delete')); expect( screen.queryByRole('heading', { name: /remove from inventory/i, @@ -207,7 +203,7 @@ describe('ConventionalSystemsTab', () => { description: `Removal of ${system1.display_name} started.`, dismissable: false, id: 'remove-initiated', - title: 'Delete operation initiated', + title: 'Remove operation initiated', variant: 'warning', }, type: '@@INSIGHTS-CORE/NOTIFICATIONS/ADD_NOTIFICATION', diff --git a/src/components/InventoryTabs/ConventionalSystems/useTableActions.js b/src/components/InventoryTabs/ConventionalSystems/useTableActions.js index 12aada45a..2b6c30c47 100644 --- a/src/components/InventoryTabs/ConventionalSystems/useTableActions.js +++ b/src/components/InventoryTabs/ConventionalSystems/useTableActions.js @@ -53,7 +53,7 @@ const useTableActions = ( ]} noAccessTooltip={NO_MODIFY_HOST_TOOLTIP_MESSAGE} > - Delete + Remove ), }, diff --git a/src/routes/InventoryComponents/HybridInventory.cy.js b/src/routes/InventoryComponents/HybridInventory.cy.js index bf66ebb2c..686830c8a 100644 --- a/src/routes/InventoryComponents/HybridInventory.cy.js +++ b/src/routes/InventoryComponents/HybridInventory.cy.js @@ -263,7 +263,7 @@ describe('hybrid inventory table', () => { cy.get(TABLE_ROW_CHECKBOX).eq(0).click(); cy.get('button') - .contains('Delete') + .contains('Remove') .should('have.attr', 'aria-disabled', 'true'); // TODO: implement ouia selector for this component @@ -308,37 +308,39 @@ describe('hybrid inventory table', () => { cy.get(MODAL_CONTENT).contains('Edit display name'); }); - it('can delete hosts in the test group', () => { + it('can remove hosts in the test group', () => { cy.get(TABLE_ROW).eq(1).find(MENU_TOGGLE).click(); - cy.get(INVENTORY_ACTION_MENU_ITEM).contains('Delete').click(); + cy.get(INVENTORY_ACTION_MENU_ITEM) + .contains(/^Remove$/) + .click(); cy.get(MODAL_CONTENT).contains('Remove from inventory'); }); - it('cannot edit nor delete hosts that are not in the test group', () => { + it('cannot edit nor remove hosts that are not in the test group', () => { cy.get(TABLE_ROW).eq(3).find(MENU_TOGGLE).click(); cy.get(DROPDOWN_ITEM) .contains('Edit') .should('have.attr', 'aria-disabled', 'true'); cy.get(DROPDOWN_ITEM) - .contains('Delete') + .contains('Remove') .should('have.attr', 'aria-disabled', 'true'); }); - it('can delete hosts that are in the test group', () => { + it('can remove hosts that are in the test group', () => { cy.get(TABLE_ROW_CHECKBOX).eq(0).click(); cy.get(TABLE_ROW_CHECKBOX).eq(1).click(); cy.get('button') - .contains('Delete') + .contains('Remove') .should('have.attr', 'aria-disabled', 'false') .click(); }); - it('cannot delete hosts that are not in the test group', () => { + it('cannot remove hosts that are not in the test group', () => { cy.get(TABLE_ROW_CHECKBOX).eq(2).click(); cy.get('button') - .contains('Delete') + .contains('Remove') .should('have.attr', 'aria-disabled', 'true'); }); @@ -377,25 +379,27 @@ describe('hybrid inventory table', () => { it('can edit hosts that are not a part of any group', () => { cy.get(TABLE_ROW).eq(4).find(MENU_TOGGLE).click(); cy.get(DROPDOWN_ITEM).contains('Edit').shouldNotHaveAriaDisabled(); - cy.get(DROPDOWN_ITEM).contains('Delete').shouldNotHaveAriaDisabled(); + cy.get(DROPDOWN_ITEM) + .contains(/^Remove$/) + .shouldNotHaveAriaDisabled(); }); it('cannot edit hosts in groups', () => { cy.get(TABLE_ROW).eq(2).find(MENU_TOGGLE).click(); cy.get(DROPDOWN_ITEM).contains('Edit').shouldHaveAriaDisabled(); - cy.get(DROPDOWN_ITEM).contains('Delete').shouldHaveAriaDisabled(); + cy.get(DROPDOWN_ITEM).contains('Remove').shouldHaveAriaDisabled(); }); - it('can bulk delete ungrouped hosts', () => { + it('can bulk remove ungrouped hosts', () => { cy.get(TABLE_ROW_CHECKBOX).eq(4).click(); cy.get(TABLE_ROW_CHECKBOX).eq(5).click(); - cy.get('button').contains('Delete').shouldHaveAriaEnabled(); + cy.get('button').contains('Remove').shouldHaveAriaEnabled(); }); it('cannot mix grouped and ungrouped hosts', () => { cy.get(TABLE_ROW_CHECKBOX).eq(2).click(); cy.get(TABLE_ROW_CHECKBOX).eq(3).click(); - cy.get('button').contains('Delete').shouldHaveAriaDisabled(); + cy.get('button').contains('Remove').shouldHaveAriaDisabled(); }); }); diff --git a/src/routes/InventoryDetail.cy.js b/src/routes/InventoryDetail.cy.js index 65967f87f..85c6fce18 100644 --- a/src/routes/InventoryDetail.cy.js +++ b/src/routes/InventoryDetail.cy.js @@ -70,8 +70,8 @@ describe('rbac integration', () => { before(() => cy.mockWindowInsights({ userPermissions: [] })); beforeEach(() => prepareTest(hostInGroup)); - it('should disable delete and edit buttons', () => { - cy.contains('Delete') + it('should disable remove and edit buttons', () => { + cy.contains('Remove') .should('exist') .and('have.attr', 'aria-disabled', 'true'); }); @@ -109,8 +109,8 @@ describe('rbac integration', () => { ); beforeEach(() => prepareTest(hostInGroup)); - it('should enable delete and edit buttons', () => { - cy.contains('Delete').should('exist').and('be.enabled'); + it('should enable remove and edit buttons', () => { + cy.contains('Remove').should('exist').and('be.enabled'); }); it('should enable edit buttons', () => { @@ -144,8 +144,8 @@ describe('rbac integration', () => { beforeEach(prepareTest); - it('should enable delete and edit buttons', () => { - cy.contains('Delete').should('exist').and('be.enabled'); + it('should enable remove and edit buttons', () => { + cy.contains('Remove').should('exist').and('be.enabled'); }); it('should enable edit buttons', () => { diff --git a/src/routes/InventoryHostStaleness.js b/src/routes/InventoryHostStaleness.js index 15bc1d06f..78e219481 100644 --- a/src/routes/InventoryHostStaleness.js +++ b/src/routes/InventoryHostStaleness.js @@ -21,7 +21,7 @@ const HostStaleness = () => { useEffect(() => { chrome?.updateDocumentTitle?.( - 'Staleness and Deletion - System Configuration' + 'Staleness and Removal - System Configuration' ); chrome.hideGlobalFilter(true); }, []); @@ -29,7 +29,7 @@ const HostStaleness = () => { return ( - + {canReadHostStaleness ? ( diff --git a/src/store/actions.js b/src/store/actions.js index b3fd5d223..c6004acf4 100644 --- a/src/store/actions.js +++ b/src/store/actions.js @@ -18,7 +18,7 @@ export const deleteEntity = (systems, displayName) => ({ notifications: { fulfilled: { variant: 'success', - title: 'Delete operation finished', + title: 'Remove operation finished', description: `${displayName} has been successfully removed.`, dismissable: true, }, diff --git a/src/store/inventory-actions.js b/src/store/inventory-actions.js index 9002a0c92..b9b9df2d9 100644 --- a/src/store/inventory-actions.js +++ b/src/store/inventory-actions.js @@ -236,7 +236,7 @@ export const deleteEntity = (systems, displayName) => ({ notifications: { fulfilled: { variant: 'success', - title: 'Delete operation finished', + title: 'Remove operation finished', description: `${displayName} has been successfully removed.`, dismissable: true, },