From bf61ea3a8e19c684a9f14b1c3864a8cd8665eb39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Dugovi=C4=8D?= Date: Thu, 12 Feb 2026 16:24:33 +0100 Subject: [PATCH 1/8] refactor: remove updatePatchSets cascade --- src/Messages.js | 27 ---- .../PatchSetWrapper/PatchSetWrapper.js | 7 - .../PatchSetWrapper/PatchSetWrapper.test.js | 3 - .../Modals/AssignSystemsModal.js | 153 ------------------ src/SmartComponents/Modals/Helpers.js | 5 - .../PatchSet/PatchSetAssets.js | 12 -- .../Systems/SystemsMainContent.test.js | 6 - src/Utilities/api.js | 3 - src/Utilities/hooks/Hooks.js | 7 +- 9 files changed, 2 insertions(+), 221 deletions(-) delete mode 100644 src/SmartComponents/Modals/AssignSystemsModal.js diff --git a/src/Messages.js b/src/Messages.js index 2b4aa28c5..b23a270cf 100644 --- a/src/Messages.js +++ b/src/Messages.js @@ -549,11 +549,6 @@ export default defineMessages({ defaultMessage: 'A system can have only one content template, therefore if you apply a new content template to the system, it will be overwritten.', }, - templateApply: { - id: 'templateApply', - description: 'title with capital letters', - defaultMessage: 'Apply template', - }, templateApplySystems: { id: 'templateApplySystems', description: 'step name of the patch template wizard', @@ -586,11 +581,6 @@ export default defineMessages({ description: 'template wizard template title', defaultMessage: 'Define template content', }, - templateCreate: { - id: 'templateCreate', - description: 'title with capital letters', - defaultMessage: 'Create', - }, templateDateField: { id: 'templateDateField', description: 'Field name of the patch template wizard', @@ -688,11 +678,6 @@ export default defineMessages({ defaultMessage: 'At least one system must be selected. Actions must be associated to a system to be added to a playbook.', }, - templateOr: { - id: 'templateOr', - description: 'title with capital letters', - defaultMessage: 'Or', - }, templatePopoverBody: { id: 'templatePopoverBody', description: 'Template page header popover body', @@ -709,23 +694,11 @@ export default defineMessages({ description: 'step name of the patch template wizard', defaultMessage: 'Review ', }, - templateSelect: { - id: 'templateSelect', - description: 'title with capital letters', - defaultMessage: - 'Select a template to apply to the selected {systemCount, plural, one {# system} other {# systems}}.', - }, templateSelectExisting: { id: 'templateSelectExisting', description: 'title with capital letters', defaultMessage: 'Select an existing template', }, - templateSelectSatellite: { - id: 'templateSelectSatellite', - description: 'title with capital letters', - defaultMessage: - '{systemCount} of the selected systems content is Managed by Satellite therefore Template is not applicable.', - }, templateStepSystems: { id: 'templateStepSystems', description: 'step name of the patch template wizard', diff --git a/src/PresentationalComponents/PatchSetWrapper/PatchSetWrapper.js b/src/PresentationalComponents/PatchSetWrapper/PatchSetWrapper.js index 7d5ad5e17..a27223c71 100644 --- a/src/PresentationalComponents/PatchSetWrapper/PatchSetWrapper.js +++ b/src/PresentationalComponents/PatchSetWrapper/PatchSetWrapper.js @@ -3,7 +3,6 @@ import propTypes from 'prop-types'; import PatchSetWizard from '../../SmartComponents/PatchSetWizard/PatchSetWizard'; import UnassignSystemsModal from '../../SmartComponents/Modals/UnassignSystemsModal'; -import AssignSystemsModal from '../../SmartComponents/Modals/AssignSystemsModal'; const PatchSetWrapper = ({ patchSetState, setPatchSetState, totalItems }) => ( <> @@ -15,12 +14,6 @@ const PatchSetWrapper = ({ patchSetState, setPatchSetState, totalItems }) => ( totalItems={totalItems} /> )} - {patchSetState.isPatchSetWizardOpen && ( )} diff --git a/src/PresentationalComponents/PatchSetWrapper/PatchSetWrapper.test.js b/src/PresentationalComponents/PatchSetWrapper/PatchSetWrapper.test.js index 0d8ce8cd6..ad0a59edb 100644 --- a/src/PresentationalComponents/PatchSetWrapper/PatchSetWrapper.test.js +++ b/src/PresentationalComponents/PatchSetWrapper/PatchSetWrapper.test.js @@ -9,9 +9,6 @@ jest.mock('../../SmartComponents/PatchSetWizard/PatchSetWizard', () => () => ( jest.mock('../../SmartComponents/Modals/UnassignSystemsModal', () => () => (
)); -jest.mock('../../SmartComponents/Modals/AssignSystemsModal', () => () => ( -
-)); const mockState = {}; diff --git a/src/SmartComponents/Modals/AssignSystemsModal.js b/src/SmartComponents/Modals/AssignSystemsModal.js deleted file mode 100644 index ff2e760fc..000000000 --- a/src/SmartComponents/Modals/AssignSystemsModal.js +++ /dev/null @@ -1,153 +0,0 @@ -import React, { useEffect, useState } from 'react'; -import propTypes from 'prop-types'; -import { Button, Stack, StackItem, Form, Spinner } from '@patternfly/react-core'; -import { Modal } from '@patternfly/react-core/deprecated'; -import { injectIntl } from 'react-intl'; -import SelectExistingSets from '../PatchSetWizard/InputFields/SelectExistingSets'; -import messages from '../../Messages'; -import { updatePatchSets } from '../../Utilities/api'; -import { useAddNotification } from '@redhat-cloud-services/frontend-components-notifications'; -import { patchSetAssignSystemsNotifications } from '../PatchSet/PatchSetAssets'; -import { filterSelectedActiveSystemIDs } from '../../Utilities/Helpers'; -import { filterSatelliteManagedSystems } from './Helpers'; -import { useFetchBatched } from '../../Utilities/hooks'; -import isEmpty from 'lodash/isEmpty'; - -const AssignSystemsModal = ({ patchSetState = {}, setPatchSetState, intl, totalItems }) => { - const { systemsIDs, isAssignSystemsModalOpen } = patchSetState; - const [selectedPatchSet, setSelectedPatchSet] = useState([]); - const [selectedPatchSetDetails, setSelectedPatchSetDetails] = useState({}); - - const [systemsNotManagedBySatellite, setSystemsNotManagedBySatellite] = useState([]); - const [systemsLoading, setSystemsLoading] = useState(true); - const { fetchBatched } = useFetchBatched(); - const addNotification = useAddNotification(); - - const closeModal = () => { - setPatchSetState({ - isAssignSystemsModalOpen: !isAssignSystemsModalOpen, - systemsIDs: [], - }); - setSelectedPatchSet([]); - setSelectedPatchSetDetails({}); - }; - - const submitModal = () => { - const systems = systemsNotManagedBySatellite.reduce((obj, item) => { - obj[item] = true; - return obj; - }, {}); - - updatePatchSets({ inventory_ids: systemsIDs }, selectedPatchSetDetails.id) - .then(() => { - (addNotification(patchSetAssignSystemsNotifications(Object.keys(systems).length).success), - setPatchSetState({ - ...patchSetState, - shouldRefresh: true, - isAssignSystemsModalOpen: false, - systemsIDs: [], - })); - }) - .catch(() => { - addNotification(patchSetAssignSystemsNotifications().failure); - }); - - closeModal(); - }; - - const openWizard = () => { - setPatchSetState({ - ...patchSetState, - isPatchSetWizardOpen: true, - systemsIDs: filterSelectedActiveSystemIDs(systemsIDs), - shouldRefresh: false, - }); - setSelectedPatchSet([]); - setSelectedPatchSetDetails({}); - setSystemsLoading(true); - }; - - useEffect(() => { - if (systemsIDs && !isEmpty(systemsIDs)) { - setSystemsLoading(true); - filterSatelliteManagedSystems(Object.keys(systemsIDs), fetchBatched, totalItems).then( - (result) => { - setSystemsNotManagedBySatellite(result); - setSystemsLoading(false); - }, - ); - } - }, [systemsIDs]); - - const systemsManagedBySatelliteCount = - Object.keys(systemsIDs).length - systemsNotManagedBySatellite.length; - - return ( - - {intl.formatMessage(messages.templateApply)} - , - , - ]} - data-testid='assign-systems-modal' - > - {systemsLoading ? ( - - ) : systemsNotManagedBySatellite.length === 0 ? ( - systemsNotManagedBySatellite.length === 1 ? ( - 'Template cannot be applied to the selected system.' - ) : ( - 'Template cannot be applied to any of the selected systems.' - ) - ) : ( - - - {intl.formatMessage(messages.templateSelect, { - systemCount: systemsNotManagedBySatellite.length, - b: (...chunks) => {chunks}, - })} - - {systemsManagedBySatelliteCount > 0 && ( - - {intl.formatMessage(messages.templateSelectSatellite, { - systemCount: systemsManagedBySatelliteCount, - b: (...chunks) => {chunks}, - })} - - )} - -
- - -
- {intl.formatMessage(messages.templateOr)} - - - -
- )} -
- ); -}; - -AssignSystemsModal.propTypes = { - intl: propTypes.any, - setPatchSetState: propTypes.func, - patchSetState: propTypes.object, - totalItems: propTypes.number, -}; - -export default injectIntl(AssignSystemsModal); diff --git a/src/SmartComponents/Modals/Helpers.js b/src/SmartComponents/Modals/Helpers.js index dcf958fe7..94573dd44 100644 --- a/src/SmartComponents/Modals/Helpers.js +++ b/src/SmartComponents/Modals/Helpers.js @@ -25,11 +25,6 @@ export const filterSystemsWithoutTemplates = (systemsIDs, fetchBatched, totalIte return filterChosenSystems(urlFilter, systemsIDs, fetchBatched, totalItems); }; -export const filterSatelliteManagedSystems = (systemsIDs, fetchBatched, totalItems) => { - const urlFilter = { 'filter[satellite_managed]': 'false' }; - return filterChosenSystems(urlFilter, systemsIDs, fetchBatched, totalItems); -}; - export const renderUnassignModalMessages = (bodyMessage, systemsCount, intl) => ( {intl.formatMessage(messages[bodyMessage], { systemsCount, b: (...chunks) => {chunks} })} diff --git a/src/SmartComponents/PatchSet/PatchSetAssets.js b/src/SmartComponents/PatchSet/PatchSetAssets.js index 1b6cb5e29..40f28156f 100644 --- a/src/SmartComponents/PatchSet/PatchSetAssets.js +++ b/src/SmartComponents/PatchSet/PatchSetAssets.js @@ -96,15 +96,3 @@ export const patchSetUnassignSystemsNotifications = (systemsCount) => ({ variant: 'danger', }, }); - -export const patchSetAssignSystemsNotifications = (systemsCount) => ({ - success: { - title: `Systems succesfully applied to this Patch template.`, - description: `${systemsCount} ${systemsCount > 1 ? 'systems' : 'system'} added to Patch template(s)`, - variant: 'success', - }, - failure: { - title: `Failed to apply systems to this Patch template.`, - variant: 'danger', - }, -}); diff --git a/src/SmartComponents/Systems/SystemsMainContent.test.js b/src/SmartComponents/Systems/SystemsMainContent.test.js index 9abc18405..fee0c4e30 100644 --- a/src/SmartComponents/Systems/SystemsMainContent.test.js +++ b/src/SmartComponents/Systems/SystemsMainContent.test.js @@ -139,12 +139,6 @@ describe('SystemsTable', () => { expect(screen.getByText(`Do more with your Red Hat Enterprise Linux environment`)).toBeTruthy(); }); - it('Should display assign systems modal', async () => { - renderComponent(mockState); - await user.click(screen.getByTestId('open-assign-modal')); - await waitFor(() => expect(screen.getByTestId('assign-systems-modal')).toBeVisible()); - }); - it('Should display unassign systems modal', async () => { renderComponent(mockState); await user.click(screen.getByTestId('open-unasssign-modal')); diff --git a/src/Utilities/api.js b/src/Utilities/api.js index f7c549b72..cd791bb3d 100644 --- a/src/Utilities/api.js +++ b/src/Utilities/api.js @@ -202,9 +202,6 @@ export const assignSystemToPatchSet = (payload) => export const fetchPatchSets = (params) => createApiCall(`/baselines`, 'v3', 'get', params); -export const updatePatchSets = (payload, id) => - createApiCall(`/baselines/${id}`, 'v3', 'put', null, payload); - export const deletePatchSet = (patchSetID) => createApiCall(`/baselines/${patchSetID}`, 'v3', 'delete'); diff --git a/src/Utilities/hooks/Hooks.js b/src/Utilities/hooks/Hooks.js index a6d4e6291..d6921ec83 100644 --- a/src/Utilities/hooks/Hooks.js +++ b/src/Utilities/hooks/Hooks.js @@ -18,7 +18,7 @@ import { objOnlyWithTrue, } from '../Helpers'; import { intl } from '../IntlProvider'; -import { assignSystemToPatchSet, updatePatchSets } from '../api'; +import { assignSystemToPatchSet } from '../api'; import { createSystemsSortBy } from '../SystemsHelpers'; import { ColumnManagementModal } from '@patternfly/react-component-groups'; @@ -341,10 +341,7 @@ export const usePatchSetApi = (wizardState, setWizardState, patchSetID) => { setWizardState({ ...wizardState, submitted: true, failed: false, requestPending: true }); - const response = - patchSetID || id - ? updatePatchSets(requestConfig, patchSetID || id) - : assignSystemToPatchSet(requestConfig); + const response = assignSystemToPatchSet(requestConfig); handleApiResponse(response); }); From e6e80d178ca0b4b837777882dd234b3487383574 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Dugovi=C4=8D?= Date: Mon, 16 Feb 2026 17:02:45 +0100 Subject: [PATCH 2/8] refactor: remove assignSystemToPatchSet cascade --- package-lock.json | 1 - package.json | 1 - src/Messages.js | 102 --------- .../PatchSetWrapper/PatchSetWrapper.js | 5 +- .../Snippets/EmptyStates.js | 10 - src/SmartComponents/PatchSet/PatchSet.js | 6 +- .../PatchSetDetail/PatchSetDetail.js | 6 +- .../InputFields/ConfigurationFields.js | 34 --- .../InputFields/ConfigurationFields.test.js | 21 -- .../InputFields/DescriptionField.js | 35 --- .../InputFields/DescriptionField.test.js | 44 ---- .../PatchSetWizard/InputFields/NameField.js | 92 -------- .../InputFields/NameField.test.js | 71 ------ .../PatchSetWizard/InputFields/ToDateField.js | 45 ---- .../InputFields/ToDateField.test.js | 32 --- .../PatchSetWizard/PatchSetWizard.js | 117 ++-------- .../PatchSetWizard/WizardAssets.js | 170 -------------- .../steps/ConfigurationStepFields.js | 47 ---- .../PatchSetWizard/steps/ContentStep.js | 57 ----- .../PatchSetWizard/steps/ReviewPatchSet.js | 80 ------- .../steps/ReviewPatchSet.test.js | 44 ---- .../PatchSetWizard/steps/ReviewSystems.js | 207 ------------------ src/Utilities/DataMappers.js | 46 ---- src/Utilities/Helpers.js | 32 --- src/Utilities/api.js | 3 - src/Utilities/dateValidator.js | 32 --- src/Utilities/dateValidator.test.js | 17 -- src/Utilities/hooks/Hooks.js | 48 ---- src/Utilities/hooks/useFeatureFlag.js | 3 +- src/store/ActionTypes.js | 1 - src/store/Actions/Actions.js | 5 - src/store/Reducers/SpecificPatchSetReducer.js | 40 ---- src/store/index.js | 2 - 33 files changed, 28 insertions(+), 1428 deletions(-) delete mode 100644 src/SmartComponents/PatchSetWizard/InputFields/ConfigurationFields.js delete mode 100644 src/SmartComponents/PatchSetWizard/InputFields/ConfigurationFields.test.js delete mode 100644 src/SmartComponents/PatchSetWizard/InputFields/DescriptionField.js delete mode 100644 src/SmartComponents/PatchSetWizard/InputFields/DescriptionField.test.js delete mode 100644 src/SmartComponents/PatchSetWizard/InputFields/NameField.js delete mode 100644 src/SmartComponents/PatchSetWizard/InputFields/NameField.test.js delete mode 100644 src/SmartComponents/PatchSetWizard/InputFields/ToDateField.js delete mode 100644 src/SmartComponents/PatchSetWizard/InputFields/ToDateField.test.js delete mode 100644 src/SmartComponents/PatchSetWizard/steps/ConfigurationStepFields.js delete mode 100644 src/SmartComponents/PatchSetWizard/steps/ContentStep.js delete mode 100644 src/SmartComponents/PatchSetWizard/steps/ReviewPatchSet.js delete mode 100644 src/SmartComponents/PatchSetWizard/steps/ReviewPatchSet.test.js delete mode 100644 src/SmartComponents/PatchSetWizard/steps/ReviewSystems.js delete mode 100644 src/Utilities/dateValidator.js delete mode 100644 src/Utilities/dateValidator.test.js delete mode 100644 src/store/Reducers/SpecificPatchSetReducer.js diff --git a/package-lock.json b/package-lock.json index f1b0799a4..62f9473fb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,6 @@ "version": "1.63.5", "hasInstallScript": true, "dependencies": { - "@data-driven-forms/pf4-component-mapper": "^4.1.1", "@data-driven-forms/react-form-renderer": "^4.1.1", "@patternfly/react-component-groups": "^6.4.0", "@patternfly/react-core": "^6.3.1", diff --git a/package.json b/package.json index 9f03e16b4..c47020fe6 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,6 @@ "browser": "dist/index.js", "private": false, "dependencies": { - "@data-driven-forms/pf4-component-mapper": "^4.1.1", "@data-driven-forms/react-form-renderer": "^4.1.1", "@patternfly/react-component-groups": "^6.4.0", "@patternfly/react-core": "^6.3.1", diff --git a/src/Messages.js b/src/Messages.js index b23a270cf..1e6e854f6 100644 --- a/src/Messages.js +++ b/src/Messages.js @@ -153,11 +153,6 @@ export default defineMessages({ description: 'shared label', defaultMessage: 'Up to applicable version', }, - labelsColumnsUpToDate: { - id: 'labelsColumnsUpToDate', - description: 'shared label', - defaultMessage: 'Red Hat advisories up to date', - }, labelsColumnsUpToInstallable: { id: 'labelsColumnsUpToInstallable', description: 'shared label', @@ -198,16 +193,6 @@ export default defineMessages({ description: 'Documentation link text', defaultMessage: 'Documentation', }, - labelsErrorDateLimit: { - id: 'labelsErrorDateLimit', - description: 'Label', - defaultMessage: 'Date is before the allowable range.', - }, - labelsErrorInvalidDate: { - id: 'labelsErrorInvalidDate', - description: 'Label', - defaultMessage: 'The date should be valid of a type YYYY-MM-DD', - }, labelsFiltersClear: { id: 'labelsFiltersClear', description: 'label for remove filter chips', @@ -283,11 +268,6 @@ export default defineMessages({ description: 'label for remove filter chips', defaultMessage: 'Reset filters', }, - labelsFiltersSearch: { - id: 'labelsFiltersSearch', - description: 'Label for search filter placeholder', - defaultMessage: 'Search ', - }, labelsFiltersSearchAdvisoriesPlaceholder: { id: 'labelsFiltersSearchAdvisoriesPlaceholder', description: 'Label for search filter placeholder', @@ -415,11 +395,6 @@ export default defineMessages({ description: 'Return to previous page label for general usage', defaultMessage: 'Return to previous page', }, - labelsSelectedSystems: { - id: 'labelsSelectedSystems', - description: 'label', - defaultMessage: 'Template applied to', - }, labelsSeverity: { id: 'labelsSeverity', description: 'label for cves info', @@ -440,11 +415,6 @@ export default defineMessages({ description: 'Label for status report', defaultMessage: 'Systems with patches available', }, - labelsSystem: { - id: 'labelsSystem', - description: 'Generic pluralized systems label', - defaultMessage: '{systemsCount, plural, one { # system } other { # systems }}', - }, labelsTemplateNoSystems: { id: 'labelsTemplateNoSystems', description: 'Template list table applied systems column fallback', @@ -506,11 +476,6 @@ export default defineMessages({ description: 'Label', defaultMessage: 'No matching packages found', }, - statesNoMatchingSystems: { - id: 'statesNoMatchingSystems', - description: 'Label', - defaultMessage: 'No matching systems found', - }, statesNoMatchingTemplate: { id: 'statesNoMatchingTemplate', description: 'Label', @@ -543,28 +508,6 @@ export default defineMessages({ defaultMessage: 'This system is up to date, based on package information submitted at the most recent system check-in', }, - templateAlertSystems: { - id: 'templateAlertSystems', - description: 'Template wizard alert', - defaultMessage: - 'A system can have only one content template, therefore if you apply a new content template to the system, it will be overwritten.', - }, - templateApplySystems: { - id: 'templateApplySystems', - description: 'step name of the patch template wizard', - defaultMessage: 'Apply to systems (optional)', - }, - templateContentStepExpandable: { - id: 'templateContentStepExpandable', - description: 'template wizard template expandable text', - defaultMessage: - 'You have a system with 10 applicable RHEL advisories, the most recent of which was published today. You apply a template with a date of yesterday to that system. After re-evaluation, the advisory published today will not be considered installable on the system, but will be considered applicable.', - }, - templateContentStepExpandableTitle: { - id: 'templateContentStepExpandableTitle', - description: 'template wizard template expandable title', - defaultMessage: 'What does it mean?', - }, templateContentStepSidebarName: { id: 'templateContentStepSidebarName', description: 'template wizard template left sidebar label', @@ -581,16 +524,6 @@ export default defineMessages({ description: 'template wizard template title', defaultMessage: 'Define template content', }, - templateDateField: { - id: 'templateDateField', - description: 'Field name of the patch template wizard', - defaultMessage: 'Select date of Red Hat repositiories', - }, - templateDateUpto: { - id: 'templateDateUpto', - description: 'Field text of the patch template wizard', - defaultMessage: 'Include advisories up to this date', - }, templateDescription: { id: 'templateDescription', description: 'description of the patch template wizard', @@ -689,11 +622,6 @@ export default defineMessages({ description: 'Template page header popover title', defaultMessage: 'About Templates', }, - templateReview: { - id: 'templateReview', - description: 'step name of the patch template wizard', - defaultMessage: 'Review ', - }, templateSelectExisting: { id: 'templateSelectExisting', description: 'title with capital letters', @@ -714,16 +642,6 @@ export default defineMessages({ description: 'title of the patch template wizard', defaultMessage: 'Assign system(s) to a patch template ', }, - templateWizardValidateLoading: { - id: 'templateWizardValidateLoading', - description: 'template wizard text when user input is not valid', - defaultMessage: 'Template details are loading.', - }, - templateWizardValidateNameTaken: { - id: 'templateWizardValidateNameTaken', - description: 'template wizard text when user input is not valid', - defaultMessage: 'Template name already exists. Try a different name.', - }, textConfigurationInProgress: { id: 'textConfigurationInProgress', description: 'text for the patch template', @@ -749,11 +667,6 @@ export default defineMessages({ description: 'text to notify there is not available version', defaultMessage: 'No version is available', }, - textPatchTemplateContent: { - id: 'textPatchTemplateContent', - description: 'text for the patch template', - defaultMessage: 'Content', - }, textPatchTemplateDetails: { id: 'textPatchTemplateDetails', description: 'text for the patch template', @@ -765,21 +678,11 @@ export default defineMessages({ defaultMessage: 'Please allow a few minutes to set up a patch template. You will receive a notification when finished.', }, - textPatchTemplateReview: { - id: 'textPatchTemplateReview', - description: 'text for the patch template', - defaultMessage: 'Review the details of your template.', - }, textPatchTemplateSuccessfuly: { id: 'textPatchTemplateSuccessfuly', description: 'text for the patch template', defaultMessage: 'Patch template configuration successful', }, - textPatchTemplateSystems: { - id: 'textPatchTemplateSystems', - description: 'text for the patch template', - defaultMessage: 'Systems', - }, textRebootIsRequired: { id: 'textRebootIsRequired', description: 'Advisories table cell text', @@ -915,11 +818,6 @@ export default defineMessages({ description: 'title with capital letters', defaultMessage: 'No description available', }, - titlesTemplateNoDescriptionProvided: { - id: 'titlesTemplateNoDescriptionProvided', - description: 'title with capital letters', - defaultMessage: 'No description provided', - }, titlesTemplateRemoveFromSystems: { id: 'titlesTemplateRemoveMultipleButton', description: 'title with capital letters', diff --git a/src/PresentationalComponents/PatchSetWrapper/PatchSetWrapper.js b/src/PresentationalComponents/PatchSetWrapper/PatchSetWrapper.js index a27223c71..640233400 100644 --- a/src/PresentationalComponents/PatchSetWrapper/PatchSetWrapper.js +++ b/src/PresentationalComponents/PatchSetWrapper/PatchSetWrapper.js @@ -10,13 +10,10 @@ const PatchSetWrapper = ({ patchSetState, setPatchSetState, totalItems }) => ( )} - {patchSetState.isPatchSetWizardOpen && ( - - )} + {patchSetState.isPatchSetWizardOpen && } ); diff --git a/src/PresentationalComponents/Snippets/EmptyStates.js b/src/PresentationalComponents/Snippets/EmptyStates.js index 29eaae1d5..5dc85bc6d 100644 --- a/src/PresentationalComponents/Snippets/EmptyStates.js +++ b/src/PresentationalComponents/Snippets/EmptyStates.js @@ -43,16 +43,6 @@ export const EmptyCvesList = () => ( ); -export const EmptySystemsList = () => ( - - {intl.formatMessage(messages.textEmptyStateBody)} - -); - export const EmptyPatchSetList = () => ( { } /> {patchSetState.isPatchSetWizardOpen && ( - + )}
{rows.length === 0 && !status.isLoading ? ( diff --git a/src/SmartComponents/PatchSetDetail/PatchSetDetail.js b/src/SmartComponents/PatchSetDetail/PatchSetDetail.js index 7085f4272..a9aa6ec80 100644 --- a/src/SmartComponents/PatchSetDetail/PatchSetDetail.js +++ b/src/SmartComponents/PatchSetDetail/PatchSetDetail.js @@ -277,11 +277,7 @@ const PatchSetDetail = () => { onConfirm={deleteSet} /> {patchSetState.isPatchSetWizardOpen && ( - + )} { - const { renderForm } = useFormApi(); - - return ( - - {/* The form element always need to be rendered in order to correctly disable "Next" button, - that's why these are hidden using "display: none" instead of not rendering */} - - - - {renderForm(nameComponent)} - - - {renderForm(descriptionComponent)} - - - - ); -}; - -ConfigurationFields.propTypes = { - isLoading: propTypes.bool, -}; -export default ConfigurationFields; diff --git a/src/SmartComponents/PatchSetWizard/InputFields/ConfigurationFields.test.js b/src/SmartComponents/PatchSetWizard/InputFields/ConfigurationFields.test.js deleted file mode 100644 index e572ad8f0..000000000 --- a/src/SmartComponents/PatchSetWizard/InputFields/ConfigurationFields.test.js +++ /dev/null @@ -1,21 +0,0 @@ -import ConfigurationFields from './ConfigurationFields'; -import { render } from '@testing-library/react'; - -jest.mock('@data-driven-forms/react-form-renderer/use-form-api', () => - jest.fn(() => ({ - renderForm: () =>
test form
, - })), -); - -describe('ConfigurationFields.js', () => { - it('Should display Spinner on patch-set loading', () => { - const { container } = render(); - expect(container.querySelector('#test-config-fields-spinner')).toBeTruthy(); - }); - - it('Should display configuration fields', () => { - const { container } = render(); - const text = container.querySelector('#test-configuration-fields'); - expect(text).toBeTruthy(); - }); -}); diff --git a/src/SmartComponents/PatchSetWizard/InputFields/DescriptionField.js b/src/SmartComponents/PatchSetWizard/InputFields/DescriptionField.js deleted file mode 100644 index 57bfabf90..000000000 --- a/src/SmartComponents/PatchSetWizard/InputFields/DescriptionField.js +++ /dev/null @@ -1,35 +0,0 @@ -import React, { useState, useEffect } from 'react'; -import { FormGroup, TextInput } from '@patternfly/react-core'; -import useFormApi from '@data-driven-forms/react-form-renderer/use-form-api'; -import useFieldApi from '@data-driven-forms/react-form-renderer/use-field-api'; -import { intl } from '../../../Utilities/IntlProvider'; -import messages from '../../../Messages'; - -const DescriptionField = (props) => { - const { input } = useFieldApi(props); - const formOptions = useFormApi(); - const values = formOptions.getState()?.values; - - const [description, setDescription] = useState(values?.description); - - useEffect(() => { - setDescription(values.description); - }, [values.description]); - - return ( - - { - input.onChange(val); - setDescription(val); - }} - aria-label='description' - /> - - ); -}; - -export default DescriptionField; diff --git a/src/SmartComponents/PatchSetWizard/InputFields/DescriptionField.test.js b/src/SmartComponents/PatchSetWizard/InputFields/DescriptionField.test.js deleted file mode 100644 index a59c611f1..000000000 --- a/src/SmartComponents/PatchSetWizard/InputFields/DescriptionField.test.js +++ /dev/null @@ -1,44 +0,0 @@ -import DescriptionField from './DescriptionField'; -import useFormApi from '@data-driven-forms/react-form-renderer/use-form-api'; -import { render, screen } from '@testing-library/react'; - -jest.mock('@data-driven-forms/react-form-renderer/use-form-api', () => ({ - __esModule: true, - default: jest.fn(), -})); - -jest.mock('@data-driven-forms/react-form-renderer/use-field-api', () => - jest.fn(() => ({ - input: { - onChange: jest.fn(), - }, - })), -); - -describe('ConfigurationFields.js', () => { - it('Should description field have default value', () => { - useFormApi.mockReturnValue({ - getState: () => ({ - values: { description: 'testDescription' }, - }), - }); - - render(); - const input = screen.getByRole('textbox', { - name: /description/i, - }); - expect(input.value).toBe('testDescription'); - }); - - it('Should display configuration fields', () => { - useFormApi.mockReturnValue({ - getState: () => ({ values: {} }), - }); - - render(); - const input = screen.getByRole('textbox', { - name: /description/i, - }); - expect(input.value).toBe(''); - }); -}); diff --git a/src/SmartComponents/PatchSetWizard/InputFields/NameField.js b/src/SmartComponents/PatchSetWizard/InputFields/NameField.js deleted file mode 100644 index d1c0dcf86..000000000 --- a/src/SmartComponents/PatchSetWizard/InputFields/NameField.js +++ /dev/null @@ -1,92 +0,0 @@ -import React, { useState, useEffect } from 'react'; -import { - FormGroup, - FormHelperText, - HelperText, - HelperTextItem, - TextInput, - Spinner, -} from '@patternfly/react-core'; -import useFormApi from '@data-driven-forms/react-form-renderer/use-form-api'; -import useFieldApi from '@data-driven-forms/react-form-renderer/use-field-api'; -import { intl } from '../../../Utilities/IntlProvider'; -import messages from '../../../Messages'; -import { useFetchAllTemplateData } from '../WizardAssets'; -import { fetchPatchSets } from '../../../Utilities/api'; - -const NameField = (props) => { - const { input } = useFieldApi(props); - const formOptions = useFormApi(); - const values = formOptions.getState()?.values; - - const [name, setName] = useState(values?.name); - const [validated, setValidated] = useState(); - const [takenTemplateNames, setTakenTemplateNames] = useState([]); - const [areTakenTemplateNamesLoading, setAreTakenTemplateNamesLoading] = useState(true); - - const fetchTemplateNames = useFetchAllTemplateData( - fetchPatchSets, - ({ attributes }) => attributes.name, - ); - - useEffect(() => { - fetchTemplateNames().then(({ data, isLoading }) => { - setTakenTemplateNames(data); - setAreTakenTemplateNamesLoading(isLoading); - }); - }, []); - - useEffect(() => { - const validateName = () => { - if (values.name === undefined || values.name === values.previousName) { - return 'default'; - } - - if (takenTemplateNames.includes(values.name)) { - return 'error'; - } - - return 'success'; - }; - - setName(values.name); - setValidated(validateName()); - }, [values.name, takenTemplateNames]); - - useEffect(() => { - formOptions.change('takenTemplateNames', takenTemplateNames); - formOptions.change('areTakenTemplateNamesLoading', areTakenTemplateNamesLoading); - }, [takenTemplateNames, areTakenTemplateNamesLoading]); - - return ( - - { - input.onChange(val); - setName(val); - }} - aria-label='name' - autoFocus - validated={validated} - /> - {(validated === 'error' || areTakenTemplateNamesLoading) && ( - - - {areTakenTemplateNamesLoading ? ( - - ) : ( - - {intl.formatMessage(messages.templateWizardValidateNameTaken)} - - )} - - - )} - - ); -}; - -export default NameField; diff --git a/src/SmartComponents/PatchSetWizard/InputFields/NameField.test.js b/src/SmartComponents/PatchSetWizard/InputFields/NameField.test.js deleted file mode 100644 index b58390e0d..000000000 --- a/src/SmartComponents/PatchSetWizard/InputFields/NameField.test.js +++ /dev/null @@ -1,71 +0,0 @@ -import NameField from './NameField'; -import useFormApi from '@data-driven-forms/react-form-renderer/use-form-api'; -import { render, screen, waitFor, queryByLabelText } from '@testing-library/react'; -import '@testing-library/jest-dom'; - -jest.mock('@data-driven-forms/react-form-renderer/use-form-api', () => ({ - __esModule: true, - default: jest.fn(), -})); - -jest.mock('@data-driven-forms/react-form-renderer/use-field-api', () => - jest.fn(() => ({ - input: { - onChange: jest.fn(), - }, - })), -); - -jest.mock('../../../Utilities/api', () => ({ - ...jest.requireActual('../../../Utilities/api'), - fetchPatchSets: jest.fn(() => - Promise.resolve({ data: [{ attributes: { name: 'taken-template-name' } }] }), - ), -})); - -describe('NameField.js', () => { - it('Should description field have default value and fire input onChange', () => { - useFormApi.mockReturnValue({ - getState: () => ({ - values: { name: 'testName' }, - }), - change: () => {}, - }); - - render(); - expect( - screen.getByRole('textbox', { - name: /name/i, - }), - ).toBeTruthy(); - }); - - it('Should display configuration fields', () => { - useFormApi.mockReturnValue({ - getState: () => ({ values: {} }), - change: () => {}, - }); - - render(); - const input = screen.getByRole('textbox', { - name: /name/i, - }); - expect(input.value).toBe(''); - }); - - it('Should invalidate taken template names', async () => { - useFormApi.mockReturnValue({ - getState: () => ({ values: { name: 'taken-template-name' } }), - change: () => {}, - }); - - const { container } = render(); - - await waitFor(() => { - expect(queryByLabelText(container, 'Contents')).not.toBeInTheDocument(); - }); - await waitFor(() => - expect(screen.getByText('Template name already exists. Try a different name.')).toBeVisible(), - ); - }); -}); diff --git a/src/SmartComponents/PatchSetWizard/InputFields/ToDateField.js b/src/SmartComponents/PatchSetWizard/InputFields/ToDateField.js deleted file mode 100644 index aa0aa7885..000000000 --- a/src/SmartComponents/PatchSetWizard/InputFields/ToDateField.js +++ /dev/null @@ -1,45 +0,0 @@ -import React, { useState, useEffect } from 'react'; -import { FormGroup, DatePicker, Flex, FlexItem } from '@patternfly/react-core'; -import useFormApi from '@data-driven-forms/react-form-renderer/use-form-api'; -import useFieldApi from '@data-driven-forms/react-form-renderer/use-field-api'; -import dateValidator from '../../../Utilities/dateValidator'; -import { intl } from '../../../Utilities/IntlProvider'; -import messages from '../../../Messages'; - -const ToDateField = (props) => { - const { input } = useFieldApi(props); - const formOptions = useFormApi(); - const values = formOptions.getState()?.values; - - const [toDate, setToDate] = useState(values?.toDate); - - useEffect(() => { - setToDate(values.toDate); - }, [values.toDate]); - - return ( - - - - {intl.formatMessage(messages.templateDateUpto)} - - - { - input.onChange(val); - setToDate(val); - }} - popoverProps={{ position: 'right' }} - aria-label='toDate' - validators={[dateValidator]} - invalidFormatText={intl.formatMessage(messages.labelsErrorInvalidDate)} - /> - - - - ); -}; - -export default ToDateField; diff --git a/src/SmartComponents/PatchSetWizard/InputFields/ToDateField.test.js b/src/SmartComponents/PatchSetWizard/InputFields/ToDateField.test.js deleted file mode 100644 index abfd83c97..000000000 --- a/src/SmartComponents/PatchSetWizard/InputFields/ToDateField.test.js +++ /dev/null @@ -1,32 +0,0 @@ -import ToDateField from './ToDateField'; -import useFormApi from '@data-driven-forms/react-form-renderer/use-form-api'; -import { render, screen } from '@testing-library/react'; - -jest.mock('@data-driven-forms/react-form-renderer/use-form-api', () => ({ - __esModule: true, - default: jest.fn(), -})); - -jest.mock('@data-driven-forms/react-form-renderer/use-field-api', () => - jest.fn(() => ({ - input: { - onChange: jest.fn(), - }, - })), -); - -describe('ConfigurationFields.js', () => { - it('Should description field have default value', () => { - useFormApi.mockReturnValue({ - getState: () => ({ - values: { toDate: 'testToDate' }, - }), - }); - render(); - expect( - screen.getByRole('textbox', { - name: /todate/i, - }).value, - ).toEqual('testToDate'); - }); -}); diff --git a/src/SmartComponents/PatchSetWizard/PatchSetWizard.js b/src/SmartComponents/PatchSetWizard/PatchSetWizard.js index 580c4d6fa..168d636b1 100644 --- a/src/SmartComponents/PatchSetWizard/PatchSetWizard.js +++ b/src/SmartComponents/PatchSetWizard/PatchSetWizard.js @@ -1,30 +1,16 @@ import React, { Fragment, useState, memo, useEffect } from 'react'; import propTypes from 'prop-types'; -import FormRenderer from '@data-driven-forms/react-form-renderer/form-renderer'; -import Pf4FormTemplate from '@data-driven-forms/pf4-component-mapper/form-template'; -import componentTypes from '@data-driven-forms/react-form-renderer/component-types'; -import WizardMapper from '@data-driven-forms/pf4-component-mapper/wizard'; -import TextField from '@data-driven-forms/pf4-component-mapper/text-field'; -import DatePicker from '@data-driven-forms/pf4-component-mapper/date-picker'; import { Wizard, Modal } from '@patternfly/react-core/deprecated'; import { useDispatch } from 'react-redux'; -import ConfigurationStepFields from './steps/ConfigurationStepFields'; -import ContentStep from './steps/ContentStep'; -import NameField from './InputFields/NameField'; -import ToDateField from './InputFields/ToDateField'; -import DescriptionField from './InputFields/DescriptionField'; -import ReviewSystems from './steps/ReviewSystems'; -import ReviewPatchSet from './steps/ReviewPatchSet'; -import { schema, validatorMapper, getWizardTitle } from './WizardAssets'; +import { getWizardTitle } from './WizardAssets'; import RequestProgress from './steps/RequestProgress'; -import { usePatchSetApi } from '../../Utilities/hooks'; import { intl } from '../../Utilities/IntlProvider'; import messages from '../../Messages'; -import { fetchPatchSetAction, clearPatchSetAction } from '../../store/Actions/Actions'; +import { fetchPatchSetAction } from '../../store/Actions/Actions'; -export const PatchSetWizard = ({ systemsIDs, setBaselineState, patchSetID }) => { +export const PatchSetWizard = ({ setBaselineState, patchSetID }) => { // if system ids exist, those are being assigned. Likewise if patchSetID exists, it is being edited const wizardType = patchSetID ? 'edit' : 'create'; const [wizardState, setWizardState] = useState({ @@ -40,12 +26,8 @@ export const PatchSetWizard = ({ systemsIDs, setBaselineState, patchSetID }) => if (patchSetID) { dispatch(fetchPatchSetAction(patchSetID)); } - - return () => dispatch(clearPatchSetAction()); }, []); - const onSubmit = usePatchSetApi(wizardState, setWizardState, patchSetID); - const handleWizardClose = () => { const shouldRefresh = !wizardState.failed && wizardState.submitted; @@ -58,88 +40,37 @@ export const PatchSetWizard = ({ systemsIDs, setBaselineState, patchSetID }) => setWizardState({ formValues: {}, submitted: false }); }; - const mapperExtensions = { - nameField: { - component: NameField, - }, - descriptionField: { - component: DescriptionField, - }, - toDateField: { - component: ToDateField, - }, - contentStep: { - component: ContentStep, - patchSetID, - }, - configurationStep: { - component: ConfigurationStepFields, - patchSetID, - }, - reviewSystems: { - component: ReviewSystems, - systemsIDs: systemsIDs || [], - patchSetID, - }, - reviewPatchSet: { - component: ReviewPatchSet, - systemsIDs: systemsIDs || [], - }, - }; - return ( - {(!wizardState.submitted && ( - } - componentMapper={{ - [componentTypes.WIZARD]: { - component: WizardMapper, - className: 'patch-set', - 'data-ouia-component-id': 'patch-set-wizard', + + {intl.formatMessage(messages.templateDescription)}} + steps={[ + { + name: 'progress', + component: , + isFinishedStep: true, }, - [componentTypes.TEXT_FIELD]: TextField, - [componentTypes.DATE_PICKER]: DatePicker, - ...mapperExtensions, - }} - validatorMapper={validatorMapper} - onSubmit={onSubmit} - onCancel={handleWizardClose} + ]} + onClose={handleWizardClose} /> - )) || ( - - {intl.formatMessage(messages.templateDescription)}} - steps={[ - { - name: 'progress', - component: , - isFinishedStep: true, - }, - ]} - onClose={handleWizardClose} - /> - - )} + ); }; PatchSetWizard.propTypes = { setBaselineState: propTypes.func, - systemsIDs: propTypes.array, patchSetID: propTypes.string, }; diff --git a/src/SmartComponents/PatchSetWizard/WizardAssets.js b/src/SmartComponents/PatchSetWizard/WizardAssets.js index b18aeb6ab..40a7bbc0c 100644 --- a/src/SmartComponents/PatchSetWizard/WizardAssets.js +++ b/src/SmartComponents/PatchSetWizard/WizardAssets.js @@ -1,183 +1,13 @@ -import componentTypes from '@data-driven-forms/react-form-renderer/component-types'; -import validatorTypes from '@data-driven-forms/react-form-renderer/validator-types'; import { intl } from '../../Utilities/IntlProvider'; import messages from '../../Messages'; -import { filterSelectedActiveSystemIDs } from '../../Utilities/Helpers'; -import dateValidator from '../../Utilities/dateValidator'; -import { sortable } from '@patternfly/react-table/dist/js'; -import React, { Fragment } from 'react'; -import { useFetchBatched } from '../../Utilities/hooks'; - -export const REVIEW_SYSTEM_COLUMNS = [ - { - key: 'display_name', - title: 'Name', - props: { - width: 40, - }, - transforms: [sortable], - }, - { - title: 'OS', - key: 'operating_system', - props: { - width: 20, - }, - transforms: [sortable], - }, - { - key: 'template_name', - title: 'Template', - props: { - width: 20, - }, - transforms: [sortable], - }, - { - key: 'last_upload', - title: 'Last seen', - props: { - width: 20, - }, - transforms: [sortable], - }, -]; - -export const configurationFields = [ - { - name: 'configurationStep', - component: 'configurationStep', - }, - { - name: 'existing_patch_set', - component: componentTypes.TEXT_FIELD, - hidden: true, - }, -]; - -export const contentStep = [ - { - name: 'contentStep', - component: 'contentStep', - }, -]; - -export const nameComponent = [ - { - name: 'name', - component: 'nameField', - validate: [{ type: validatorTypes.REQUIRED }, { type: 'validate-name' }], - }, -]; - -export const descriptionComponent = [ - { - name: 'description', - component: 'descriptionField', - }, -]; - -export const toDateComponent = [ - { - name: 'toDate', - component: 'toDateField', - validate: [{ type: validatorTypes.REQUIRED }, { type: 'validate-date' }], - }, -]; export const getWizardTitle = (wizardType) => wizardType === 'edit' ? intl.formatMessage(messages.templateEdit) : intl.formatMessage(messages.templateTitle); -export const schema = (wizardType) => ({ - fields: [ - { - component: componentTypes.WIZARD, - name: 'patch-set-wizard', - isDynamic: true, - inModal: true, - title: getWizardTitle(wizardType), - description: {intl.formatMessage(messages.templateDescription)}, - fields: [ - { - name: 'template-content', - title: intl.formatMessage(messages.templateContentStepSidebarName), - fields: contentStep, - nextStep: 'template-details', - }, - { - name: 'template-details', - title: intl.formatMessage(messages.templateDetailStepSidebarName), - fields: configurationFields, - nextStep: 'template-systems', - }, - { - name: 'template-systems', - title: intl.formatMessage(messages.templateStepSystems), - fields: [ - { - name: 'systems', - component: 'reviewSystems', - // We can use this later in case UX wantes to prevent patch template s without zero systems - // validate: [{ type: 'validate-systems' }] - }, - ], - nextStep: 'template-review', - }, - { - name: 'template-review', - title: intl.formatMessage(messages.templateReview), - fields: [ - { - name: 'review', - component: 'reviewPatchSet', - }, - ], - }, - ], - }, - ], -}); - -export const validatorMapper = { - 'validate-systems': () => (formValueSystems) => { - const systems = filterSelectedActiveSystemIDs(formValueSystems); - - if (systems === undefined) { - return; - } else if (systems.length > 0) { - return; - } else { - return intl.formatMessage(messages.templateNoSystemSelected); - } - }, - 'validate-date': () => dateValidator, - 'validate-name': () => (name, formValues) => { - if (formValues.areTakenTemplateNamesLoading || formValues.templateDetailLoading) { - return intl.formatMessage(messages.templateWizardValidateLoading); - } - - if (formValues.previousName !== name && formValues.takenTemplateNames?.includes(name)) { - return intl.formatMessage(messages.templateWizardValidateNameTaken); - } - }, -}; - export const apiFailedNotification = (description) => ({ title: 'There was an error while processing your request', description, variant: 'danger', }); - -export const useFetchAllTemplateData = (fetchFunction, mapFunction) => { - const { fetchBatched, isLoading } = useFetchBatched(); - return async (params = {}) => { - const result = await fetchBatched(fetchFunction, params, undefined, 100); - - return { - isLoading, - data: result.flatMap(({ data }) => data).map(mapFunction), - }; - }; -}; diff --git a/src/SmartComponents/PatchSetWizard/steps/ConfigurationStepFields.js b/src/SmartComponents/PatchSetWizard/steps/ConfigurationStepFields.js deleted file mode 100644 index e0a554cba..000000000 --- a/src/SmartComponents/PatchSetWizard/steps/ConfigurationStepFields.js +++ /dev/null @@ -1,47 +0,0 @@ -import React, { useEffect } from 'react'; -import propTypes from 'prop-types'; -import { useSelector, shallowEqual } from 'react-redux'; -import useFormApi from '@data-driven-forms/react-form-renderer/use-form-api'; -import { Content, Stack, StackItem } from '@patternfly/react-core'; -import { intl } from '../../../Utilities/IntlProvider'; -import messages from '../../../Messages'; -import ConfigurationFields from '../InputFields/ConfigurationFields'; - -const ConfigurationStepFields = ({ patchSetID }) => { - const formOptions = useFormApi(); - - const { patchSet, status, areTakenTemplateNamesLoading } = useSelector( - ({ SpecificPatchSetReducer }) => SpecificPatchSetReducer, - shallowEqual, - ); - - useEffect(() => { - if (patchSetID) { - const { name, description } = patchSet; - - formOptions.change('name', name); - formOptions.change('description', description); - } - }, [patchSet]); - - return ( - - - - {intl.formatMessage(messages.templateDetailStepTitle)} - - - {intl.formatMessage(messages.templateDetailStepText)} - - - - - ); -}; - -ConfigurationStepFields.propTypes = { - patchSetID: propTypes.string, -}; -export default ConfigurationStepFields; diff --git a/src/SmartComponents/PatchSetWizard/steps/ContentStep.js b/src/SmartComponents/PatchSetWizard/steps/ContentStep.js deleted file mode 100644 index df2a37432..000000000 --- a/src/SmartComponents/PatchSetWizard/steps/ContentStep.js +++ /dev/null @@ -1,57 +0,0 @@ -import React, { useEffect } from 'react'; -import propTypes from 'prop-types'; -import { useSelector, shallowEqual } from 'react-redux'; -import useFormApi from '@data-driven-forms/react-form-renderer/use-form-api'; -import { Content, Stack, StackItem, ExpandableSection } from '@patternfly/react-core'; -import { intl } from '../../../Utilities/IntlProvider'; -import messages from '../../../Messages'; -import { convertIsoToDate } from '../../../Utilities/Helpers'; -import { toDateComponent } from '../WizardAssets'; - -const ContentStep = ({ patchSetID }) => { - const formOptions = useFormApi(); - - const { patchSet, status } = useSelector( - ({ SpecificPatchSetReducer }) => SpecificPatchSetReducer, - shallowEqual, - ); - - useEffect(() => { - if (patchSetID) { - const { - config: { to_time: toDate }, - name: previousName, - } = patchSet; - - formOptions.change('toDate', convertIsoToDate(toDate)); - formOptions.change('previousName', previousName); - formOptions.change('templateDetailLoading', status.isLoading); - } - }, [patchSet, status]); - - return ( - - - - {intl.formatMessage(messages.templateContentStepTitle)} - - - {intl.formatMessage(messages.templateContentStepText)} - - {formOptions.renderForm(toDateComponent)} - - - - {intl.formatMessage(messages.templateContentStepExpandable)} - - - - ); -}; - -ContentStep.propTypes = { - patchSetID: propTypes.string, -}; -export default ContentStep; diff --git a/src/SmartComponents/PatchSetWizard/steps/ReviewPatchSet.js b/src/SmartComponents/PatchSetWizard/steps/ReviewPatchSet.js deleted file mode 100644 index cc210b0a5..000000000 --- a/src/SmartComponents/PatchSetWizard/steps/ReviewPatchSet.js +++ /dev/null @@ -1,80 +0,0 @@ -import React, { Fragment } from 'react'; -import { Content, Stack, StackItem, ContentVariants } from '@patternfly/react-core'; -import useFormApi from '@data-driven-forms/react-form-renderer/use-form-api'; -import { intl } from '../../../Utilities/IntlProvider'; -import messages from '../../../Messages'; -import { templateDateFormat } from '../../../Utilities/Helpers'; - -const renderTextListItem = (label, text) => ( - - - {intl.formatMessage(messages[label])} - - {text} - -); - -const ReviewPatchSet = () => { - const formOptions = useFormApi(); - const { values } = formOptions.getState(); - const { name, description, toDate } = values.existing_patch_set || values; - const { systems } = values; - - return ( - - - - {intl.formatMessage(messages.templateReview)} - - - - - - {intl.formatMessage(messages.textPatchTemplateReview)} - - - - - - - {intl.formatMessage(messages.textPatchTemplateContent)} - - - {renderTextListItem('labelsColumnsUpToDate', templateDateFormat(toDate))} - - - - - - - {intl.formatMessage(messages.textPatchTemplateDetails)} - - - {renderTextListItem('labelsColumnsName', name)} - {renderTextListItem( - 'labelsDescription', - description || intl.formatMessage(messages.titlesTemplateNoDescriptionProvided), - )} - - - - - - - {intl.formatMessage(messages.textPatchTemplateSystems)} - - - {renderTextListItem( - 'labelsSelectedSystems', - intl.formatMessage(messages.labelsSystem, { - systemsCount: Object.values(systems).filter((system) => system).length, - }), - )} - - - - - ); -}; - -export default ReviewPatchSet; diff --git a/src/SmartComponents/PatchSetWizard/steps/ReviewPatchSet.test.js b/src/SmartComponents/PatchSetWizard/steps/ReviewPatchSet.test.js deleted file mode 100644 index 4c79328e3..000000000 --- a/src/SmartComponents/PatchSetWizard/steps/ReviewPatchSet.test.js +++ /dev/null @@ -1,44 +0,0 @@ -import ReviewPatchSet from './ReviewPatchSet'; -import { render } from '@testing-library/react'; -import useFormApi from '@data-driven-forms/react-form-renderer/use-form-api'; - -jest.mock('@data-driven-forms/react-form-renderer/use-form-api', () => ({ - __esModule: true, - default: jest.fn(), -})); - -describe('ReviewPatchSet.js', () => { - it('Should display all Patch Template configuration', () => { - useFormApi.mockReturnValue({ - getState: () => ({ - values: { - name: 'test-name', - description: 'test-description', - toDate: '2022-06-14', - systems: { - 'test-system-id-1': true, - 'test-system-id-2': true, - }, - }, - }), - }); - const { asFragment } = render(); - expect(asFragment()).toMatchSnapshot(); - }); - - it('Should display available configuration fields only', () => { - useFormApi.mockReturnValue({ - getState: () => ({ - values: { - name: 'test-name', - systems: { - 'test-system-id-1': true, - 'test-system-id-2': true, - }, - }, - }), - }); - const { asFragment } = render(); - expect(asFragment()).toMatchSnapshot(); - }); -}); diff --git a/src/SmartComponents/PatchSetWizard/steps/ReviewSystems.js b/src/SmartComponents/PatchSetWizard/steps/ReviewSystems.js deleted file mode 100644 index 86f292e8c..000000000 --- a/src/SmartComponents/PatchSetWizard/steps/ReviewSystems.js +++ /dev/null @@ -1,207 +0,0 @@ -import React, { useEffect, useState } from 'react'; -import propTypes from 'prop-types'; -import useFieldApi from '@data-driven-forms/react-form-renderer/use-field-api'; -import searchFilter from '../../../PresentationalComponents/Filters/SearchFilter'; -import { Content, Stack, StackItem, ContentVariants, Alert } from '@patternfly/react-core'; -import useFormApi from '@data-driven-forms/react-form-renderer/use-form-api'; - -import { createSortBy, buildSelectedSystemsObj } from '../../../Utilities/Helpers'; -import { createSystemsRowsReview } from '../../../Utilities/DataMappers'; -import { - usePerPageSelect, - useSetPage, - useSortColumn, - useOnSelect, - ID_API_ENDPOINTS, -} from '../../../Utilities/hooks'; -import TableView from '../../../PresentationalComponents/TableView/TableView'; -import staleFilter from '../../../PresentationalComponents/Filters/SystemStaleFilter'; -import systemsUpdatableFilter from '../../../PresentationalComponents/Filters/SystemsUpdatableFilter'; -import { fetchSystems, fetchPatchSetSystems } from '../../../Utilities/api'; -import { REVIEW_SYSTEM_COLUMNS, useFetchAllTemplateData } from '../WizardAssets'; -import messages from '../../../Messages'; -import { intl } from '../../../Utilities/IntlProvider'; -import { systemsListDefaultFilters } from '../../../Utilities/constants'; -import useOsVersionFilter from '../../../PresentationalComponents/Filters/OsVersionFilter'; - -export const ReviewSystems = ({ systemsIDs = [], patchSetID, ...props }) => { - const { input } = useFieldApi(props); - const formOptions = useFormApi(); - const { values } = formOptions.getState(); - const defaultSelectedSystems = buildSelectedSystemsObj(systemsIDs, values?.systems); - - const [isLoading, setLoading] = useState(true); - const [rawData, setRawData] = useState([]); - const [systems, setSystems] = useState([]); - const [selectedRows, setSelectedRows] = useState(defaultSelectedSystems); - const [metadata, setMetada] = useState({ - limit: 20, - offset: 0, - total_items: 0, - }); - const [assignedSystems, setAssignedSystems] = useState([]); - const [areAssignedSystemsLoading, setAssignedSystemsLoading] = useState(true); - - const [queryParams, setQueryParams] = useState({ - page: 1, - perPage: 20, - filter: { - stale: [true, false], - }, - }); - - const fetchAssignedSystems = useFetchAllTemplateData( - fetchPatchSetSystems, - (system) => system?.inventory_id, - ); - - useEffect(() => { - if (patchSetID) { - fetchAssignedSystems({ id: patchSetID }).then(({ isLoading, data }) => { - setAssignedSystems(data); - setAssignedSystemsLoading(isLoading); - }); - } - }, [patchSetID]); - - useEffect(() => { - fetchSystems({ - ...queryParams, - filter: { - ...queryParams.filter, - id: systemsIDs.length > 0 ? `in:${systemsIDs.join(',')}` : undefined, - satellite_managed: false, - }, - }).then((result) => { - setSystems( - createSystemsRowsReview(result.data, { - ...buildSelectedSystemsObj([...assignedSystems, ...systemsIDs]), - ...selectedRows, - }), - ); - setMetada(result.meta); - setRawData(result.data); - setLoading(false); - }); - }, [queryParams.filter, queryParams, assignedSystems]); - - useEffect(() => { - input.onChange(selectedRows); - - setSystems(createSystemsRowsReview(rawData, selectedRows)); - }, [selectedRows]); - - useEffect(() => { - setSelectedRows({ ...selectedRows, ...buildSelectedSystemsObj(assignedSystems) }); - }, [assignedSystems]); - - const apply = (params, shouldReset = true) => { - setLoading(true); - setQueryParams((prevQueryParams) => ({ - ...prevQueryParams, - ...params, - filter: { ...prevQueryParams.filter, ...params.filter }, - ...(shouldReset && { - page: 1, - offset: 0, - }), - })); - }; - - const osFilterConfig = useOsVersionFilter(queryParams.filter.os, apply); - const onSort = useSortColumn(REVIEW_SYSTEM_COLUMNS, apply, 1); - const sortBy = React.useMemo( - () => createSortBy(REVIEW_SYSTEM_COLUMNS, metadata.sort, 1), - [metadata.sort], - ); - - const onSetPage = useSetPage(metadata.limit, (params) => apply(params, false)); - - const onPerPageSelect = usePerPageSelect(apply); - - const selectRows = (toSelect) => { - const newSelections = toSelect.reduce((object, system) => { - object[system.id] = system.selected ? true : undefined; - return object; - }, {}); - - setSelectedRows({ ...selectedRows, ...newSelections }); - }; - - const onSelect = useOnSelect(systems, selectedRows, { - endpoint: ID_API_ENDPOINTS.systems, - queryParams: { - ...queryParams, - filter: { - ...queryParams.filter, - ...(systemsIDs.length > 0 && { id: `in:${systemsIDs.join(',')}` }), - satellite_managed: false, - }, - }, - customSelector: selectRows, - totalItems: metadata.total_items, - }); - - const isTableLoading = isLoading || (patchSetID && areAssignedSystemsLoading); - return ( - - - - {intl.formatMessage(messages.templateApplySystems)} - - - - - - Select systems to apply the new template to. The list of systems does not contain{' '} - systems managed by Satellite. - - - - - - - - - ); -}; - -ReviewSystems.propTypes = { - systemsIDs: propTypes.array, - patchSetID: propTypes.string, -}; - -export default ReviewSystems; diff --git a/src/Utilities/DataMappers.js b/src/Utilities/DataMappers.js index 4dc659d31..287bda648 100644 --- a/src/Utilities/DataMappers.js +++ b/src/Utilities/DataMappers.js @@ -9,14 +9,12 @@ import { EmptyCvesList, EmptyPackagesList, EmptyPatchSetList, - EmptySystemsList, } from '../PresentationalComponents/Snippets/EmptyStates'; import { SystemUpToDate } from '../PresentationalComponents/Snippets/SystemUpToDate'; import { advisorySeverities, entityTypes } from './constants'; import { createUpgradableColumn, handleLongSynopsis, handlePatchLink } from './Helpers'; import { intl } from './IntlProvider'; import { InsightsLink } from '@redhat-cloud-services/frontend-components/InsightsLink'; -import { ManagedBySatelliteCell } from '../SmartComponents/Systems/SystemsListAssets'; import AdvisorySeverity from '../PresentationalComponents/AdvisorySeverity/AdvisorySeverity'; export const createAdvisoriesRows = (rows, expandedRows, selectedRows) => { @@ -356,50 +354,6 @@ export const createCvesRows = (rows) => { } }; -export const createSystemsRowsReview = (rows, selectedRows) => { - if (rows.length !== 0) { - return rows.map((system) => { - const { attributes, id } = system; - - return { - id, - key: id, - selected: selectedRows[system.id] !== undefined, - cells: [ - { - title: attributes.display_name, - }, - { - title: attributes.os || 'N/A', - }, - { - title: attributes.satellite_managed ? ( - - ) : ( - attributes.baseline_name || 'No template' - ), - }, - { - title: processDate(attributes.last_upload), - }, - ], - }; - }); - } else { - return [ - { - heightAuto: true, - cells: [ - { - props: { colSpan: 4 }, - title: , - }, - ], - }, - ]; - } -}; - export const createPatchSetRows = (rows, selectedRows = {}, filters) => { const data = rows && diff --git a/src/Utilities/Helpers.js b/src/Utilities/Helpers.js index 3829183b7..0cb1af1c4 100644 --- a/src/Utilities/Helpers.js +++ b/src/Utilities/Helpers.js @@ -610,18 +610,6 @@ export const mapGlobalFilters = (tags, workloads = {}) => { return globalFilterConfig; }; -export const convertIsoToDate = (isoDate) => { - if (!isoDate) { - return ''; - } - - const dateObject = new Date(isoDate); - return ( - `${dateObject.getFullYear()}-${(dateObject.getMonth() + 1).toString().padStart(2, '0')}` + - `-${dateObject.getDate().toString().padStart(2, '0')}` - ); -}; - // 2023-03-05 -> 05 Mar 2023 // 2023-03-22T20:00:00-04:00 (ISO format) -> 23 Mar 2023 export const templateDateFormat = (dateString) => { @@ -667,26 +655,6 @@ export const filterSelectedActiveSystemIDs = (selectedSystemsObject) => { return formValueSystemIDs; }; -export const buildSelectedSystemsObj = (systemsIDs, formValueSystems) => { - const mergedSystems = [...systemsIDs, ...filterSelectedActiveSystemIDs(formValueSystems)]; - - const assignedSystemsObject = mergedSystems?.reduce((object, system) => { - object[system] = true; - return object; - }, {}); - - return assignedSystemsObject; -}; - -export const objUndefinedToFalse = (object) => - Object.keys(object).reduce((modifiedObject, key) => { - modifiedObject[key] = object[key] === undefined ? false : object[key]; - return modifiedObject; - }, {}); - -export const objOnlyWithTrue = (object) => - Object.keys(Object.fromEntries(Object.entries(object).filter(([, v]) => v === true))); - export const isObject = (variable) => typeof variable === 'object' && variable !== null ? true : false; diff --git a/src/Utilities/api.js b/src/Utilities/api.js index cd791bb3d..871832060 100644 --- a/src/Utilities/api.js +++ b/src/Utilities/api.js @@ -197,9 +197,6 @@ export const exportPackageSystemsJSON = (params, packageName) => { return fetchFile(params, endpoint, 'application/json'); }; -export const assignSystemToPatchSet = (payload) => - createApiCall(`/baselines`, 'v3', 'put', null, payload); - export const fetchPatchSets = (params) => createApiCall(`/baselines`, 'v3', 'get', params); export const deletePatchSet = (patchSetID) => diff --git a/src/Utilities/dateValidator.js b/src/Utilities/dateValidator.js deleted file mode 100644 index a18cdabc7..000000000 --- a/src/Utilities/dateValidator.js +++ /dev/null @@ -1,32 +0,0 @@ -import { intl } from './IntlProvider'; -import messages from '../Messages'; - -/* -validates date of a type YYYY-MM-DD with starting limit 1990-01-01. -regex is used to comply the Patternfly date format. -*/ -const dateValidator = (dateStr) => { - const regex = /^(\d{4})-(0[1-9]|1[012])-(0?[1-9]|[12][0-9]|3[01])$/; - - if (dateStr && typeof dateStr === 'string' && dateStr.match(regex) === null) { - return intl.formatMessage(messages.labelsErrorInvalidDate); - } - - const date = new Date(dateStr); - const timestamp = date.getTime(); - - // Month had to be set to equal 0 to get the first month of the year. - const minDate = new Date(1990, 0, 1); - - if (typeof timestamp !== 'number' || Number.isNaN(timestamp)) { - return intl.formatMessage(messages.labelsErrorInvalidDate); - } - - if (date < minDate) { - return intl.formatMessage(messages.labelsErrorDateLimit); - } - - return; -}; - -export default dateValidator; diff --git a/src/Utilities/dateValidator.test.js b/src/Utilities/dateValidator.test.js deleted file mode 100644 index b34a88f2d..000000000 --- a/src/Utilities/dateValidator.test.js +++ /dev/null @@ -1,17 +0,0 @@ -import dateValidator from './dateValidator'; - -describe('dateValidator', () => { - it.each` - date | result - ${'1990-01-01'} | ${undefined} - ${'2022-01-01'} | ${undefined} - ${'2022-12-01'} | ${undefined} - ${'1428-02-03'} | ${'Date is before the allowable range.'} - ${'1989-12-31'} | ${'Date is before the allowable range.'} - ${'2022-1-01'} | ${'The date should be valid of a type YYYY-MM-DD'} - ${'random-text'} | ${'The date should be valid of a type YYYY-MM-DD'} - `('dateValidator: Should match validate date', ({ date, result }) => { - let validatedResult = dateValidator(date); - expect(validatedResult).toEqual(result); - }); -}); diff --git a/src/Utilities/hooks/Hooks.js b/src/Utilities/hooks/Hooks.js index d6921ec83..44e5963f7 100644 --- a/src/Utilities/hooks/Hooks.js +++ b/src/Utilities/hooks/Hooks.js @@ -14,11 +14,8 @@ import { getOffsetFromPageLimit, encodeURLParams, mapGlobalFilters, - objUndefinedToFalse, - objOnlyWithTrue, } from '../Helpers'; import { intl } from '../IntlProvider'; -import { assignSystemToPatchSet } from '../api'; import { createSystemsSortBy } from '../SystemsHelpers'; import { ColumnManagementModal } from '@patternfly/react-component-groups'; @@ -303,51 +300,6 @@ export const useOnExport = (prefix, queryParams, formatHandlers) => { return onExport; }; -export const usePatchSetApi = (wizardState, setWizardState, patchSetID) => { - const handleApiResponse = (response) => - response - .then(() => { - setWizardState({ ...wizardState, submitted: true, failed: false, requestPending: false }); - }) - .catch((error) => { - setWizardState({ - ...wizardState, - submitted: true, - failed: true, - requestPending: false, - error, - }); - }); - - const onSubmit = React.useCallback((formValues) => { - const { name, description, toDate, id } = formValues.existing_patch_set || formValues; - const { systems } = formValues; - - const gmtMidnightDate = new Date(toDate); // get last midnight GMT - gmtMidnightDate.setDate(gmtMidnightDate.getDate() + 1); // get next midnight GMT - const localTimezoneOffset = gmtMidnightDate.getTimezoneOffset() * 60000; - - // get next local midnight minus 1 second (23:59:59) - const localMidnightDate = new Date(gmtMidnightDate.getTime() + localTimezoneOffset - 1000); - - const requestConfig = { - name, - description, - inventory_ids: patchSetID || id ? objUndefinedToFalse(systems) : objOnlyWithTrue(systems), - config: { - to_time: localMidnightDate.toISOString(), - }, - }; - - setWizardState({ ...wizardState, submitted: true, failed: false, requestPending: true }); - - const response = assignSystemToPatchSet(requestConfig); - - handleApiResponse(response); - }); - return onSubmit; -}; - /** * * Returns readly available user entitelments * @returns {getEntitlements} function that returns entitlements diff --git a/src/Utilities/hooks/useFeatureFlag.js b/src/Utilities/hooks/useFeatureFlag.js index a125bbaf9..89cc6c291 100644 --- a/src/Utilities/hooks/useFeatureFlag.js +++ b/src/Utilities/hooks/useFeatureFlag.js @@ -8,5 +8,4 @@ const useFeatureFlag = (flag) => { export default useFeatureFlag; -export const useKesselFeatureFlag = () => - useFeatureFlag('patch-frontend.kessel-enabled'); +export const useKesselFeatureFlag = () => useFeatureFlag('patch-frontend.kessel-enabled'); diff --git a/src/store/ActionTypes.js b/src/store/ActionTypes.js index 5c41ec296..a5c74be04 100644 --- a/src/store/ActionTypes.js +++ b/src/store/ActionTypes.js @@ -43,7 +43,6 @@ export const FETCH_ALL_PATCH_SETS = 'FETCH_ALL_PATCH_SETS'; export const SELECT_PATCH_SET_ROW = 'SELECT_PATCH_SET_ROW'; export const CHANGE_PATCH_SET_PARAMS = 'CHANGE_PATCH_SET_PARAMS'; export const FETCH_PATCH_SET = 'FETCH_PATCH_SET'; -export const CLEAR_PATCH_SET = 'CLEAR_PATCH_SET'; export const FETCH_PATCH_SET_SYSTEMS_NO_FILTERS = 'FETCH_PATCH_SET_SYSTEMS_NO_FILTERS'; export const CLEAR_PATCH_SETS = 'CLEAR_PATCH_SETS'; diff --git a/src/store/Actions/Actions.js b/src/store/Actions/Actions.js index 38c99cd05..d77cf5e6e 100644 --- a/src/store/Actions/Actions.js +++ b/src/store/Actions/Actions.js @@ -277,11 +277,6 @@ export const clearPatchSetDetailsSystems = () => ({ payload: [], }); -export const clearPatchSetAction = () => ({ - type: ActionTypes.CLEAR_PATCH_SET, - payload: [], -}); - export const fetchPatchSetSystemsNoFiltersAction = (params) => ({ type: ActionTypes.FETCH_PATCH_SET_SYSTEMS_NO_FILTERS, payload: new Promise((resolve) => { diff --git a/src/store/Reducers/SpecificPatchSetReducer.js b/src/store/Reducers/SpecificPatchSetReducer.js deleted file mode 100644 index 414125c46..000000000 --- a/src/store/Reducers/SpecificPatchSetReducer.js +++ /dev/null @@ -1,40 +0,0 @@ -import * as ActionTypes from '../ActionTypes'; -import { fetchPending, fetchRejected } from './HelperReducers'; - -export const initialState = { - patchSet: { - config: {}, - }, - assignedSystems: [], - status: {}, - error: {}, -}; - -export const SpecificPatchSetReducer = (state = initialState, action) => { - switch (action.type) { - case ActionTypes.FETCH_PATCH_SET + '_FULFILLED': { - const { - attributes: { config, name, description }, - id, - } = action.payload?.data || { config: {} }; - - return { - ...state, - patchSet: { name, description, config: config || {}, id }, - status: { code: action.payload.status, isLoading: false, hasError: false }, - }; - } - - case ActionTypes.FETCH_PATCH_SET + '_PENDING': - return fetchPending(state); - - case ActionTypes.FETCH_PATCH_SET + '_REJECTED': - return fetchRejected(state, action); - - case ActionTypes.CLEAR_PATCH_SET: - return initialState; - - default: - return state; - } -}; diff --git a/src/store/index.js b/src/store/index.js index 6db043203..22951b82b 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -14,7 +14,6 @@ import { GlobalFilterStore } from './Reducers/GlobalFilterStore'; import { PatchSetsReducer } from './Reducers/PatchSetsReducer'; import { PatchSetDetailStore } from './Reducers/PatchSetDetailStore'; import { PatchSetDetailSystemsStore } from './Reducers/PatchSetDetailSystemsStore'; -import { SpecificPatchSetReducer } from './Reducers/SpecificPatchSetReducer'; import { legacy_createStore as createStore, applyMiddleware, @@ -40,7 +39,6 @@ export const defaultReducers = { PatchSetsStore: PatchSetsReducer, PatchSetDetailStore, PatchSetDetailSystemsStore, - SpecificPatchSetReducer, }; export const store = createStore( From 87383c5b7ac9e1dd039b451d451db5da1737de7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Dugovi=C4=8D?= Date: Mon, 16 Feb 2026 18:59:32 +0100 Subject: [PATCH 3/8] refactor: remove unassignSystemFromPatchSet cascad --- src/Messages.js | 15 - .../PatchSetWrapper/PatchSetWrapper.js | 11 +- .../PatchSetWrapper/PatchSetWrapper.test.js | 23 - src/SmartComponents/Modals/Helpers.js | 32 -- .../Modals/UnassignSystemsModal.js | 107 ----- .../Modals/UnassignSystemsModal.test.js | 102 ----- .../Modals/useUnassignSystemsHook.js | 29 -- .../PatchSet/PatchSetAssets.js | 21 - .../PatchSetDetail/PatchSetDetail.js | 28 -- .../__snapshots__/ReviewPatchSet.test.js.snap | 431 ------------------ .../SystemDetail/InventoryDetail.test.js | 101 ---- .../Systems/SystemsMainContent.js | 6 +- .../Systems/SystemsMainContent.test.js | 6 - src/Utilities/api.js | 3 - 14 files changed, 2 insertions(+), 913 deletions(-) delete mode 100644 src/SmartComponents/Modals/Helpers.js delete mode 100644 src/SmartComponents/Modals/UnassignSystemsModal.js delete mode 100644 src/SmartComponents/Modals/UnassignSystemsModal.test.js delete mode 100644 src/SmartComponents/Modals/useUnassignSystemsHook.js delete mode 100644 src/SmartComponents/PatchSetWizard/steps/__snapshots__/ReviewPatchSet.test.js.snap diff --git a/src/Messages.js b/src/Messages.js index 1e6e854f6..0d831a12e 100644 --- a/src/Messages.js +++ b/src/Messages.js @@ -380,11 +380,6 @@ export default defineMessages({ description: 'Button label', defaultMessage: 'Plan remediation', }, - labelsRemove: { - id: 'labelsRemove', - description: 'Button label', - defaultMessage: 'Remove', - }, labelsReturnToLandingPage: { id: 'returnToLandingPage', description: 'Return to landing page label for general usage', @@ -731,11 +726,6 @@ export default defineMessages({ defaultMessage: 'Do you want to remove the {systemsCount, plural, one { # selected system } other { # selected systems }} from assigned Patch templates?', }, - textUnassignSystemsTitle: { - id: 'textUnassignSystemsTitle', - description: 'text about systems being removed', - defaultMessage: 'Remove systems from patch template ', - }, textUnassignSystemsWarning: { id: 'textUnassignSystemsWarning', description: 'warning about systems without patch template assigned', @@ -818,11 +808,6 @@ export default defineMessages({ description: 'title with capital letters', defaultMessage: 'No description available', }, - titlesTemplateRemoveFromSystems: { - id: 'titlesTemplateRemoveMultipleButton', - description: 'title with capital letters', - defaultMessage: 'Remove from {systemsCount, plural, one {system} other {systems}}', - }, titlesTemplateRemoveMultipleButton: { id: 'titlesTemplateRemoveMultipleButton', description: 'title with capital letters', diff --git a/src/PresentationalComponents/PatchSetWrapper/PatchSetWrapper.js b/src/PresentationalComponents/PatchSetWrapper/PatchSetWrapper.js index 640233400..46fce97f7 100644 --- a/src/PresentationalComponents/PatchSetWrapper/PatchSetWrapper.js +++ b/src/PresentationalComponents/PatchSetWrapper/PatchSetWrapper.js @@ -2,17 +2,9 @@ import React from 'react'; import propTypes from 'prop-types'; import PatchSetWizard from '../../SmartComponents/PatchSetWizard/PatchSetWizard'; -import UnassignSystemsModal from '../../SmartComponents/Modals/UnassignSystemsModal'; -const PatchSetWrapper = ({ patchSetState, setPatchSetState, totalItems }) => ( +const PatchSetWrapper = ({ patchSetState, setPatchSetState }) => ( <> - {patchSetState.isUnassignSystemsModalOpen && ( - - )} {patchSetState.isPatchSetWizardOpen && } ); @@ -20,6 +12,5 @@ const PatchSetWrapper = ({ patchSetState, setPatchSetState, totalItems }) => ( PatchSetWrapper.propTypes = { patchSetState: propTypes.object, setPatchSetState: propTypes.func, - totalItems: propTypes.number, }; export default PatchSetWrapper; diff --git a/src/PresentationalComponents/PatchSetWrapper/PatchSetWrapper.test.js b/src/PresentationalComponents/PatchSetWrapper/PatchSetWrapper.test.js index ad0a59edb..01c747f6a 100644 --- a/src/PresentationalComponents/PatchSetWrapper/PatchSetWrapper.test.js +++ b/src/PresentationalComponents/PatchSetWrapper/PatchSetWrapper.test.js @@ -6,9 +6,6 @@ import { mountWithRouterAndProviderAndIntl } from '../../../config/rtlwrapper'; jest.mock('../../SmartComponents/PatchSetWizard/PatchSetWizard', () => () => (
)); -jest.mock('../../SmartComponents/Modals/UnassignSystemsModal', () => () => ( -
-)); const mockState = {}; @@ -53,24 +50,4 @@ describe('PatchSetWrapper', () => { ); expect(container.querySelector('#test-patch-set-wizard')).toBeFalsy(); }); - - it('should display UnassignSystemsModal when isUnassignSystemsModalOpen prop is true', () => { - const { container } = mountWithRouterAndProviderAndIntl( - , - store, - ); - expect(container.querySelector('#test-unassign-systems-modal')).toBeTruthy(); - }); - - it('should hide UnassignSystemsModal when isUnassignSystemsModalOpen prop is false', () => { - const testHiddenState = { - patchSetState: { ...testProps.patchSetState, isUnassignSystemsModalOpen: false }, - ...testProps.setPatchSetState, - }; - const { container } = mountWithRouterAndProviderAndIntl( - , - store, - ); - expect(container.querySelector('#test-unassign-systems-modal')).toBeFalsy(); - }); }); diff --git a/src/SmartComponents/Modals/Helpers.js b/src/SmartComponents/Modals/Helpers.js deleted file mode 100644 index 94573dd44..000000000 --- a/src/SmartComponents/Modals/Helpers.js +++ /dev/null @@ -1,32 +0,0 @@ -import React from 'react'; -import { GridItem } from '@patternfly/react-core'; - -import messages from '../../Messages'; -import { fetchIDs } from '../../Utilities/api'; - -const filterChosenSystems = (urlFilter, systemsIDs, fetchBatched, totalItems) => - fetchBatched( - (filter) => fetchIDs('/ids/systems', filter), - { - ...urlFilter, - filter: { stale: [true, false] }, - }, - totalItems, - 100, - ).then((systemsNotManagedBySatellite) => { - const aggregatedResult = systemsNotManagedBySatellite.flatMap(({ data }) => data); - return systemsIDs.filter((systemID) => - aggregatedResult?.some((system) => system.id === systemID), - ); - }); - -export const filterSystemsWithoutTemplates = (systemsIDs, fetchBatched, totalItems) => { - const urlFilter = { [`filter[template_name]`]: 'neq:' }; - return filterChosenSystems(urlFilter, systemsIDs, fetchBatched, totalItems); -}; - -export const renderUnassignModalMessages = (bodyMessage, systemsCount, intl) => ( - - {intl.formatMessage(messages[bodyMessage], { systemsCount, b: (...chunks) => {chunks} })} - -); diff --git a/src/SmartComponents/Modals/UnassignSystemsModal.js b/src/SmartComponents/Modals/UnassignSystemsModal.js deleted file mode 100644 index bb836d46a..000000000 --- a/src/SmartComponents/Modals/UnassignSystemsModal.js +++ /dev/null @@ -1,107 +0,0 @@ -import React, { Fragment, useEffect, useState } from 'react'; -import propTypes from 'prop-types'; -import { Button, Grid, Skeleton } from '@patternfly/react-core'; -import { Modal } from '@patternfly/react-core/deprecated'; -import { injectIntl } from 'react-intl'; - -import messages from '../../Messages'; -import { useUnassignSystemsHook } from './useUnassignSystemsHook'; -import { renderUnassignModalMessages, filterSystemsWithoutTemplates } from './Helpers'; -import { useFetchBatched } from '../../Utilities/hooks'; - -const UnassignSystemsModal = ({ - unassignSystemsModalState = {}, - setUnassignSystemsModalOpen, - intl, - totalItems, -}) => { - const { systemsIDs, isUnassignSystemsModalOpen } = unassignSystemsModalState; - const [systemsWithPatchSet, setSystemWithPatchSet] = useState([]); - const [systemsLoading, setSystemsLoading] = useState(true); - const { fetchBatched } = useFetchBatched(); - - const handleModalToggle = (shouldRefresh) => { - setUnassignSystemsModalOpen({ - isUnassignSystemsModalOpen: !isUnassignSystemsModalOpen, - systemsIDs: [], - shouldRefresh, - }); - }; - - const handleModalClose = () => { - handleModalToggle(false); - }; - - const handleUnassignment = useUnassignSystemsHook(handleModalToggle, systemsWithPatchSet); - - useEffect(() => { - setSystemsLoading(true); - - filterSystemsWithoutTemplates(systemsIDs, fetchBatched, totalItems).then((result) => { - setSystemWithPatchSet(result); - setSystemsLoading(false); - }); - }, [systemsIDs]); - - const systemsWithoutPatchSetCount = systemsIDs.length - systemsWithPatchSet.length; - - return ( - - {intl.formatMessage(messages.labelsRemove)} - , - , - ]} - data-testid='unassign-systems-modal' - > - - {systemsLoading ? ( - - ) : ( - - {systemsWithPatchSet.length === 0 && - renderUnassignModalMessages( - 'textUnassignSystemsNoAssignedSystems', - systemsWithPatchSet.length, - intl, - )} - {systemsWithPatchSet.length > 0 && - renderUnassignModalMessages( - 'textUnassignSystemsStatement', - systemsWithPatchSet.length, - intl, - )} - {systemsWithPatchSet.length > 0 && - systemsWithoutPatchSetCount > 0 && - renderUnassignModalMessages( - 'textUnassignSystemsWarning', - systemsWithoutPatchSetCount, - intl, - )} - - )} - - - ); -}; - -UnassignSystemsModal.propTypes = { - intl: propTypes.any, - setUnassignSystemsModalOpen: propTypes.func, - unassignSystemsModalState: propTypes.object, - totalItems: propTypes.number, -}; -export default injectIntl(UnassignSystemsModal); diff --git a/src/SmartComponents/Modals/UnassignSystemsModal.test.js b/src/SmartComponents/Modals/UnassignSystemsModal.test.js deleted file mode 100644 index 162ef58e4..000000000 --- a/src/SmartComponents/Modals/UnassignSystemsModal.test.js +++ /dev/null @@ -1,102 +0,0 @@ -import { useAddNotification } from '@redhat-cloud-services/frontend-components-notifications'; -import UnassignSystemsModal from './UnassignSystemsModal'; -import { unassignSystemFromPatchSet } from '../../Utilities/api'; -import { initMocks } from '../../Utilities/unitTestingUtilities'; -import { patchSetUnassignSystemsNotifications } from '../PatchSet/PatchSetAssets'; -import { render, waitFor, screen } from '@testing-library/react'; -import { IntlProvider } from '@redhat-cloud-services/frontend-components-translations'; -import userEvent from '@testing-library/user-event'; - -initMocks(); - -jest.mock('../../Utilities/api', () => ({ - ...jest.requireActual('../../Utilities/api'), - unassignSystemFromPatchSet: jest.fn(), - fetchIDs: jest.fn(() => Promise.resolve({ data: [{ id: 'test_1' }] })), -})); - -jest.mock('react-redux', () => ({ - useDispatch: jest.fn(() => () => {}), -})); - -jest.mock('@redhat-cloud-services/frontend-components-notifications', () => ({ - useAddNotification: jest.fn(() => {}), -})); - -const mockAddNotification = jest.fn(); - -let unassignSystemsModalState = { - isUnassignSystemsModalOpen: true, - systemsIDs: ['test_1', 'test_2', 'test_3'], -}; -const setUnassignSystemsModalOpen = (modalState) => { - unassignSystemsModalState = modalState; -}; - -beforeEach(() => { - unassignSystemsModalState.isUnassignSystemsModalOpen = true; - useAddNotification.mockReturnValue(mockAddNotification); - - render( - - - , - ); -}); - -const user = userEvent.setup(); - -describe('UnassignSystemsModal', () => { - it('Should remove systems from a patch set and handle success notification', async () => { - unassignSystemsModalState.isUnassignSystemsModalOpen = true; - unassignSystemFromPatchSet.mockReturnValueOnce( - new Promise((resolve) => { - resolve({ status: 200 }); - }), - ); - - await user.click(screen.getByText('Remove')); - - await waitFor(() => { - expect(mockAddNotification).toHaveBeenCalledWith( - patchSetUnassignSystemsNotifications(1).success, - ); - expect(unassignSystemsModalState).toEqual({ - isUnassignSystemsModalOpen: false, - shouldRefresh: true, - systemsIDs: [], - }); - expect(unassignSystemFromPatchSet).toHaveBeenCalledWith({ inventory_ids: ['test_1'] }); - }); - }); - - it('should close the modal', async () => { - unassignSystemsModalState.isUnassignSystemsModalOpen = true; - await user.click(screen.getByLabelText('Close')); - - await waitFor(() => { - expect(unassignSystemsModalState.isUnassignSystemsModalOpen).toBeFalsy(); - }); - }); - - it('Should return correct notification text with 1 system', () => { - const result = patchSetUnassignSystemsNotifications(1); - expect(result.success).toEqual({ - title: `Systems succesfully removed from this Patch template.`, - description: `1 system removed from Patch template(s)`, - variant: 'success', - }); - }); - - it('Should return correct notification text with multiple systems', () => { - const result = patchSetUnassignSystemsNotifications(2); - expect(result.success).toEqual({ - title: `Systems succesfully removed from this Patch template.`, - description: `2 systems removed from Patch template(s)`, - variant: 'success', - }); - }); -}); diff --git a/src/SmartComponents/Modals/useUnassignSystemsHook.js b/src/SmartComponents/Modals/useUnassignSystemsHook.js deleted file mode 100644 index 8e137bab0..000000000 --- a/src/SmartComponents/Modals/useUnassignSystemsHook.js +++ /dev/null @@ -1,29 +0,0 @@ -import { useAddNotification } from '@redhat-cloud-services/frontend-components-notifications'; - -import { unassignSystemFromPatchSet } from '../../Utilities/api'; -import { patchSetUnassignSystemsNotifications } from '../PatchSet/PatchSetAssets'; - -/** - *Handles removing one or more systems from different patch sets. - * @param {Function} [handleModalToggle] function to close the modal on callback - * @param {Array} [systemsWithPatchSet] array of systems to be removed - * @returns {handleSystemsRemoval} - */ -export const useUnassignSystemsHook = (handleModalToggle, systemsWithPatchSet) => { - const addNotification = useAddNotification(); - - const handleSystemsRemoval = async () => { - const result = await unassignSystemFromPatchSet({ inventory_ids: systemsWithPatchSet }); - handleModalToggle(true); - - if (result.status === 200) { - addNotification( - patchSetUnassignSystemsNotifications(systemsWithPatchSet?.length || 0).success, - ); - } else { - addNotification(patchSetUnassignSystemsNotifications().failure); - } - }; - - return handleSystemsRemoval; -}; diff --git a/src/SmartComponents/PatchSet/PatchSetAssets.js b/src/SmartComponents/PatchSet/PatchSetAssets.js index 40f28156f..2fe1f55e6 100644 --- a/src/SmartComponents/PatchSet/PatchSetAssets.js +++ b/src/SmartComponents/PatchSet/PatchSetAssets.js @@ -61,15 +61,6 @@ export const patchSetRowActions = (openPatchSetEditModal, handlePatchSetDelete) }, ]; -export const patchSetDetailRowActions = (handleSystemUnassign) => [ - { - title: intl.formatMessage(messages.titlesTemplateRemoveFromSystems, { systemsCount: 1 }), - onClick: (_event, _rowId, rowData) => { - handleSystemUnassign([rowData.id]); - }, - }, -]; - export const CustomActionsToggle = () => ( - ) : ( - - - - )} - - -); - -NoAppliedSystems.propTypes = { - onButtonClick: PropTypes.func, - hasAccess: PropTypes.bool, -}; diff --git a/src/SmartComponents/PatchSetDetail/PatchSetDetail.js b/src/SmartComponents/PatchSetDetail/PatchSetDetail.js deleted file mode 100644 index c6c6effb9..000000000 --- a/src/SmartComponents/PatchSetDetail/PatchSetDetail.js +++ /dev/null @@ -1,435 +0,0 @@ -import { Main } from '@redhat-cloud-services/frontend-components/Main'; -import React, { useEffect, useState, Fragment, useRef } from 'react'; -import { useIntl } from 'react-intl'; -import { shallowEqual, useDispatch, useSelector, useStore } from 'react-redux'; -import { useNavigate, useParams, useSearchParams } from 'react-router-dom'; -import messages from '../../Messages'; -import Header from '../../PresentationalComponents/Header/Header'; -import { NoAppliedSystems } from '../../PresentationalComponents/Snippets/EmptyStates'; -import { - useBulkSelectConfig, - useDeepCompareEffect, - useGetEntities, - useRemoveFilter, - ID_API_ENDPOINTS, - useOnSelect, -} from '../../Utilities/hooks'; -import { - changePatchSetDetailsSystemsMetadata, - changePatchSetDetailsSystemsParams, - changeTags, - clearInventoryReducer, - clearTemplateDetail, - fetchPatchSetSystemsNoFiltersAction, - fetchTemplateDetail, - systemSelectAction, -} from '../../store/Actions/Actions'; -import { - Bullseye, - Skeleton, - Spinner, - Content, - Tooltip, - Dropdown, - DropdownItem, - DropdownPosition, - DropdownToggle, -} from '@patternfly/react-core'; -import DeleteSetModal from '../Modals/DeleteSetModal'; -import { deletePatchSet, fetchPatchSetSystems } from '../../Utilities/api'; -import { useAddNotification } from '@redhat-cloud-services/frontend-components-notifications'; -import { patchSetDeleteNotifications } from '../../Utilities/constants'; -import ErrorHandler from '../../PresentationalComponents/Snippets/ErrorHandler'; -import { - arrayFromObj, - decodeQueryparams, - encodeURLParams, - persistantParams, -} from '../../Utilities/Helpers'; -import PatchSetWizard from '../PatchSetWizard/PatchSetWizard'; -import { usePermissionsWithContext } from '@redhat-cloud-services/frontend-components-utilities/RBACHook'; -import { TableVariant } from '@patternfly/react-table'; -import { InventoryTable } from '@redhat-cloud-services/frontend-components/Inventory'; -import { - buildActiveFiltersConfig, - buildTemplateFilterConfig, - templateSystemsColumnsMerger, -} from '../../Utilities/SystemsHelpers'; -import { combineReducers } from 'redux'; -import { defaultReducers } from '../../store'; -import { - inventoryEntitiesReducer, - modifyTemplateDetailSystems, -} from '../../store/Reducers/InventoryEntitiesReducer'; -import { SYSTEMS_LIST_COLUMNS } from '../Systems/SystemsListAssets'; -import { processDate } from '@redhat-cloud-services/frontend-components-utilities/helpers'; -import { useChrome } from '@redhat-cloud-services/frontend-components/useChrome'; - -const PatchSetDetail = () => { - const intl = useIntl(); - const dispatch = useDispatch(); - const chrome = useChrome(); - const [searchParams, setSearchParams] = useSearchParams(); - const navigate = useNavigate(); - - const store = useStore(); - const inventory = useRef(null); - - const { templateName: patchSetId } = useParams(); - const addNotification = useAddNotification(); - - const [firstMount, setFirstMount] = React.useState(true); - const [isHeaderDropdownOpen, setHeaderDropdownOpen] = useState(false); - const [isDeleteConfirmModalOpen, setDeleteConfirmModalOpen] = useState(false); - const [patchSetState, setPatchSetState] = useState({ - isPatchSetWizardOpen: false, - systemsIDs: [], - shouldRefresh: false, - }); - - const templateDetails = useSelector(({ PatchSetDetailStore }) => PatchSetDetailStore); - - const isHeaderLoading = useSelector( - ({ PatchSetDetailStore }) => PatchSetDetailStore?.status?.isLoading ?? true, - ); - - const detailStatus = useSelector(({ PatchSetDetailStore }) => PatchSetDetailStore.status); - - const systems = useSelector(({ entities }) => entities?.rows || [], shallowEqual); - - const selectedRows = useSelector(({ entities }) => entities?.selectedRows || []); - - const systemStatus = useSelector(({ entities }) => entities?.status || {}); - - const totalItems = useSelector(({ entities }) => entities?.total || 0); - - const queryParams = useSelector( - ({ PatchSetDetailSystemsStore }) => PatchSetDetailSystemsStore?.queryParams || {}, - ); - - const templateHasSystemsLoading = useSelector( - ({ PatchSetDetailSystemsStore }) => PatchSetDetailSystemsStore?.templateHasSystemsLoading, - ); - - const templateHasSystems = useSelector( - ({ PatchSetDetailSystemsStore }) => PatchSetDetailSystemsStore?.templateHasSystems, - ); - - const { hasAccess } = usePermissionsWithContext(['patch:*:*', 'patch:template:write']); - - const patchSetName = templateDetails.data.attributes.name; - - useEffect(() => { - patchSetName && chrome.updateDocumentTitle(`${patchSetName} - Templates - Patch | RHEL`, true); - }, [chrome, patchSetName]); - - const onSelect = useOnSelect(systems, selectedRows, { - endpoint: ID_API_ENDPOINTS.templateSystems(patchSetId), - queryParams, - selectionDispatcher: systemSelectAction, - totalItems, - }); - - const apply = (params) => { - dispatch(changePatchSetDetailsSystemsParams(params)); - }; - - const openPatchSetAssignWizard = () => { - setPatchSetState({ - ...patchSetState, - isPatchSetWizardOpen: true, - }); - }; - - const refreshTable = () => { - // timestamp is used to force inventory to refresh - // if it wasn't there inventory might ignore request to refresh because parameters are the same - inventory?.current?.onRefreshData({ timestamp: Date.now() }); - - onSelect('none'); - - dispatch(fetchTemplateDetail(patchSetId)); - }; - - useEffect(() => { - dispatch(fetchPatchSetSystemsNoFiltersAction({ id: patchSetId, limit: 1 })); - - return () => { - dispatch(clearTemplateDetail()); - dispatch(clearInventoryReducer()); - }; - }, []); - - useEffect(() => { - if (patchSetState.shouldRefresh === true) { - refreshTable(); - setPatchSetState({ ...patchSetState, shouldRefresh: false }); - dispatch(fetchPatchSetSystemsNoFiltersAction({ id: patchSetId, limit: 1 })); - } - }, [patchSetState.shouldRefresh]); - - useDeepCompareEffect(() => { - if (firstMount) { - apply(decodeQueryparams('?' + searchParams.toString())); - - dispatch(fetchTemplateDetail(patchSetId)); - - setFirstMount(false); - } else { - setSearchParams(encodeURLParams(queryParams)); - } - }, [queryParams, firstMount]); - - const deleteSet = () => { - deletePatchSet(patchSetId) - .then(() => { - addNotification(patchSetDeleteNotifications(patchSetName).success); - navigate('../templates'); - }) - .catch(() => { - addNotification(patchSetDeleteNotifications(patchSetName).error); - }); - }; - - const applyMetadata = (metadata) => { - dispatch(changePatchSetDetailsSystemsMetadata(metadata)); - }; - - const applyGlobalFilter = (tags) => { - dispatch(changeTags(tags)); - }; - - const getEntities = useGetEntities( - fetchPatchSetSystems, - apply, - { id: patchSetId }, - setSearchParams, - applyMetadata, - applyGlobalFilter, - ); - - const addTooltip = (children, key) => ( - - {children} - - ); - - const editTemplateButton = ( - openPatchSetAssignWizard()} - isDisabled={!hasAccess} - > - {intl.formatMessage(messages.labelsButtonEditTemplate)} - - ); - - const deleteTemplateButton = ( - setDeleteConfirmModalOpen(true)} - isDisabled={!hasAccess} - > - {intl.formatMessage(messages.labelsButtonRemoveTemplate)} - - ); - - const dropdownItems = [ - hasAccess ? editTemplateButton : addTooltip(editTemplateButton, 'edit-template'), - hasAccess ? deleteTemplateButton : addTooltip(deleteTemplateButton, 'delete-template'), - ]; - - const decodedParams = decodeQueryparams('?' + searchParams.toString()); - - const { systemProfile, selectedTags, filter, search, page, perPage, sort } = queryParams; - - const selectedCount = selectedRows && arrayFromObj(selectedRows).length; - - const bulkSelectConfig = useBulkSelectConfig( - selectedCount, - onSelect, - { total_items: totalItems }, - systems, - ); - - const [deleteFilters] = useRemoveFilter({ search, ...filter }, apply); - - const filterConfig = buildTemplateFilterConfig(search, apply); - - const activeFiltersConfig = buildActiveFiltersConfig(filter, search, deleteFilters); - - return detailStatus?.hasError ? ( - - ) : ( - - - {patchSetState.isPatchSetWizardOpen && ( - - )} -
: patchSetName} - headerOUIA='template-details' - breadcrumbs={[ - { - title: intl.formatMessage(messages.templateDetailHeaderBreadcrumb), - to: '/templates', - isActive: false, - }, - { - title: isHeaderLoading ? : patchSetName, - isActive: true, - }, - ]} - actions={ - { - setHeaderDropdownOpen(false); - document.getElementById('patch-set-detail-header-kebab').focus(); - }} - toggle={ - setHeaderDropdownOpen(isOpen)} - style={{ minWidth: 150 }} - > - {intl.formatMessage(messages.labelsActions)} - - } - isOpen={isHeaderDropdownOpen} - dropdownItems={dropdownItems} - /> - } - > - - - - - - - - - - - - - - - - - - - - - - - -
- {intl.formatMessage(messages.templateDetailTableDescription)} - - {isHeaderLoading ? ( - - ) : ( - templateDetails.data.attributes.description || - intl.formatMessage(messages.titlesTemplateNoDescription) - )} -
{intl.formatMessage(messages.templateDetailTableUpToDate)} - {isHeaderLoading ? ( - - ) : ( - processDate(templateDetails.data.attributes.config.to_time) - )} -
{intl.formatMessage(messages.templateDetailTableCreatedBy)} - {isHeaderLoading ? ( - - ) : ( - templateDetails.data.attributes.creator - )} -
{intl.formatMessage(messages.templateDetailTablePublished)} - {isHeaderLoading ? ( - - ) : ( - processDate(templateDetails.data.attributes.published) - )} -
{intl.formatMessage(messages.templateDetailTableLastEdited)} - {isHeaderLoading ? ( - - ) : ( - processDate(templateDetails.data.attributes.last_edited) - )} -
-
-
- - - {intl.formatMessage(messages.templateDetailTableTitle)} - - - {templateHasSystemsLoading ? ( - - - - ) : templateHasSystems ? ( - systemStatus.hasError ? ( - - ) : ( - templateSystemsColumnsMerger(defaultColumns)} - showTags - onLoad={({ mergeWithEntities }) => { - store.replaceReducer( - combineReducers({ - ...defaultReducers, - ...mergeWithEntities( - inventoryEntitiesReducer(SYSTEMS_LIST_COLUMNS, modifyTemplateDetailSystems), - persistantParams({ page, perPage, sort, search }, decodedParams), - ), - }), - ); - }} - customFilters={{ - patchParams: { - search, - filter, - systemProfile, - selectedTags, - }, - }} - paginationProps={{ - isDisabled: totalItems === 0, - }} - getEntities={getEntities} - bulkSelect={bulkSelectConfig} - tableProps={{ - canSelectAll: false, - variant: TableVariant.compact, - className: 'patchCompactInventory', - isStickyHeader: true, - }} - filterConfig={filterConfig} - activeFiltersConfig={activeFiltersConfig} - /> - ) - ) : ( - openPatchSetAssignWizard()} - /> - )} -
-
- ); -}; - -export default PatchSetDetail; diff --git a/src/SmartComponents/PatchSetDetail/PatchSetDetailAssets.js b/src/SmartComponents/PatchSetDetail/PatchSetDetailAssets.js deleted file mode 100644 index 8dd67edd8..000000000 --- a/src/SmartComponents/PatchSetDetail/PatchSetDetailAssets.js +++ /dev/null @@ -1,38 +0,0 @@ -import { sortable } from '@patternfly/react-table/dist/js'; -import { createAdvisoriesIcons, createOSColumn } from '../../Utilities/Helpers'; - -export const patchSetDetailColumns = [ - { - key: 'os', - title: 'OS', - renderFunc: (value) => createOSColumn(value), - transforms: [sortable], - }, - { - key: 'installable_rhsa_count', - title: 'Installable advisories', - renderFunc: (_a, _b, row) => - createAdvisoriesIcons( - [ - row.installable_rhea_count, - row.installable_rhba_count, - row.installable_rhsa_count, - row.installable_other_count, - ], - 'installable', - ), - transforms: [sortable], - }, - { - key: 'applicable_rhsa_count', - title: 'Applicable advisories', - transforms: [sortable], - renderFunc: (_a, _b, row) => - createAdvisoriesIcons([ - row.applicable_rhea_count, - row.applicable_rhba_count, - row.applicable_rhsa_count, - row.applicable_other_count, - ]), - }, -]; diff --git a/src/Utilities/DataMappers.js b/src/Utilities/DataMappers.js index 287bda648..17497911a 100644 --- a/src/Utilities/DataMappers.js +++ b/src/Utilities/DataMappers.js @@ -391,26 +391,3 @@ export const createPatchSetRows = (rows, selectedRows = {}, filters) => { ] : []; }; - -export const createPatchSetDetailRows = (rows) => { - const data = - rows && - rows.map((row) => { - row = { ...row, ...row.attributes }; - - return { - ...row, - id: row.inventory_id, - display_name: row.display_name, - key: row.inventory_id, - os: { - osName: row.os || 'N/A', - rhsm: row.rhsm, - }, - last_upload: row.last_upload, - tags: row.tags, - }; - }); - - return data; -}; diff --git a/src/Utilities/Helpers.js b/src/Utilities/Helpers.js index 0cb1af1c4..82b98449d 100644 --- a/src/Utilities/Helpers.js +++ b/src/Utilities/Helpers.js @@ -610,38 +610,6 @@ export const mapGlobalFilters = (tags, workloads = {}) => { return globalFilterConfig; }; -// 2023-03-05 -> 05 Mar 2023 -// 2023-03-22T20:00:00-04:00 (ISO format) -> 23 Mar 2023 -export const templateDateFormat = (dateString) => { - if (!dateString) { - return 'N/A'; - } - - // handle ISO format - convert timezone to GMT and slice off the time - if (dateString.includes('T')) { - const gmtTime = new Date(dateString).toISOString(); - [dateString] = gmtTime.split('T'); - } - - const MONTHS = [ - 'Jan', - 'Feb', - 'Mar', - 'Apr', - 'May', - 'June', - 'July', - 'Aug', - 'Sept', - 'Oct', - 'Nov', - 'Dec', - ]; - const [year, month, day] = dateString.split('-'); - - return `${day} ${MONTHS[parseInt(month) - 1]} ${year}`; -}; - export const filterSelectedActiveSystemIDs = (selectedSystemsObject) => { const formValueSystemIDs = []; if (typeof selectedSystemsObject === 'object') { diff --git a/src/Utilities/Helpers.test.js b/src/Utilities/Helpers.test.js index 87f9f72c7..2fcf6e13b 100644 --- a/src/Utilities/Helpers.test.js +++ b/src/Utilities/Helpers.test.js @@ -24,7 +24,6 @@ import { mapGlobalFilters, persistantParams, remediationProvider, - templateDateFormat, transformPairs, } from './Helpers'; import { render } from '@testing-library/react'; @@ -398,14 +397,6 @@ describe('Helpers tests', () => { ], }); }); - - test('templateDateFormat function should correctly parse dates', () => { - expect(templateDateFormat('2023-03-05')).toEqual('05 Mar 2023'); - expect(templateDateFormat('2023-03-22T20:00:00-04:00')).toEqual('23 Mar 2023'); - expect(templateDateFormat('2023-03-22T20:00:00-00:00')).toEqual('22 Mar 2023'); - expect(templateDateFormat('2023-03-22T20:00:00+04:00')).toEqual('22 Mar 2023'); - expect(templateDateFormat('2023-03-22T20:00:00Z')).toEqual('22 Mar 2023'); - }); }); describe('Test global filters', () => { diff --git a/src/Utilities/SystemsHelpers.js b/src/Utilities/SystemsHelpers.js index 8bb355dcf..c0bad8547 100644 --- a/src/Utilities/SystemsHelpers.js +++ b/src/Utilities/SystemsHelpers.js @@ -1,13 +1,10 @@ -import React from 'react'; import searchFilter from '../PresentationalComponents/Filters/SearchFilter'; import staleFilter from '../PresentationalComponents/Filters/SystemStaleFilter'; import systemsUpdatableFilter from '../PresentationalComponents/Filters/SystemsUpdatableFilter'; -import { buildFilterChips, templateDateFormat } from './Helpers'; +import { buildFilterChips } from './Helpers'; import { intl } from './IntlProvider'; import messages from '../Messages'; import { defaultCompoundSortValues } from './constants'; -import { patchSetDetailColumns } from '../SmartComponents/PatchSetDetail/PatchSetDetailAssets'; -import { InsightsLink } from '@redhat-cloud-services/frontend-components/InsightsLink'; export const buildFilterConfig = (search, filter, apply) => ({ items: [ @@ -22,17 +19,6 @@ export const buildFilterConfig = (search, filter, apply) => ({ ], }); -export const buildTemplateFilterConfig = (search, apply) => ({ - items: [ - searchFilter( - apply, - search, - intl.formatMessage(messages.labelsFiltersSystemsSearchTitle), - intl.formatMessage(messages.labelsFiltersSystemsSearchPlaceholder), - ), - ], -}); - export const buildActiveFiltersConfig = (filter, search, deleteFilters) => { if (filter?.group_name?.length === 0) { delete filter.group_name; @@ -57,32 +43,6 @@ export const mergeInventoryColumns = (patchmanColumns, inventoryColumns) => ...column, })); -export const templateSystemsColumnsMerger = (defaultColumns) => { - let lastSeen = defaultColumns.filter(({ key }) => key === 'updated'); - lastSeen = [ - { - ...lastSeen[0], - key: 'last_upload', - sortKey: 'last_upload', - renderFunc: (value) => templateDateFormat(value), - }, - ]; - - let name = defaultColumns.filter(({ key }) => key === 'display_name'); - let tag = defaultColumns.filter(({ key }) => key === 'tags'); - - name = [ - { - ...name[0], - renderFunc: (displayName, id) => ( - {displayName} - ), - }, - ]; - - return [...name, ...tag, ...patchSetDetailColumns, lastSeen[0]]; -}; - export const createSystemsSortBy = (orderBy, orderDirection, hasLastUpload) => { if (orderBy === 'updated') { if (!hasLastUpload) { diff --git a/src/Utilities/api.js b/src/Utilities/api.js index ea92b5bb1..5aea79ea0 100644 --- a/src/Utilities/api.js +++ b/src/Utilities/api.js @@ -204,13 +204,6 @@ export const deletePatchSet = (patchSetID) => export const fetchPatchSet = (id) => createApiCall(`/baselines/${id}`, 'v3', 'get'); -export const fetchPatchSetSystems = (params) => { - const id = params.id; - delete params.id; - - return createApiCall(`/baselines/${id}/systems`, 'v3', 'get', prepareEntitiesParams(params)); -}; - export const getOperatingSystems = () => hostInventoryApi.apiSystemProfileGetOperatingSystem(); export const fetchIDs = (endpoint, queryParams) => diff --git a/src/store/ActionTypes.js b/src/store/ActionTypes.js index a5c74be04..65947ab67 100644 --- a/src/store/ActionTypes.js +++ b/src/store/ActionTypes.js @@ -43,15 +43,8 @@ export const FETCH_ALL_PATCH_SETS = 'FETCH_ALL_PATCH_SETS'; export const SELECT_PATCH_SET_ROW = 'SELECT_PATCH_SET_ROW'; export const CHANGE_PATCH_SET_PARAMS = 'CHANGE_PATCH_SET_PARAMS'; export const FETCH_PATCH_SET = 'FETCH_PATCH_SET'; -export const FETCH_PATCH_SET_SYSTEMS_NO_FILTERS = 'FETCH_PATCH_SET_SYSTEMS_NO_FILTERS'; export const CLEAR_PATCH_SETS = 'CLEAR_PATCH_SETS'; -export const FETCH_TEMPLATE_DETAIL = 'FETCH_TEMPLATE_DETAIL'; -export const CLEAR_TEMPLATE_DETAIL = 'CLEAR_TEMPLATE_DETAIL'; - -export const FETCH_PATCH_SET_DETAIL_SYSTEMS = 'FETCH_PATCH_SET_DETAIL_SYSTEMS'; -export const CHANGE_PATCH_SET_DETAIL_SYSTEMS_PARAMS = 'CHANGE_PATCH_SET_DETAIL_SYSTEMS_PARAMS'; -export const CHANGE_PATCH_SET_DETAIL_SYSTEMS_METADATA = 'CHANGE_PATCH_SET_DETAIL_SYSTEMS_METADATA'; export const CLEAR_PATCH_SET_DETAIL_SYSTEMS = 'CLEAR_PATCH_SET_DETAIL_SYSTEMS'; export const TOGGLE_ALL_SELECTED = 'TOGGLE_ALL_SELECTED'; diff --git a/src/store/Actions/Actions.js b/src/store/Actions/Actions.js index d77cf5e6e..2e0c0885c 100644 --- a/src/store/Actions/Actions.js +++ b/src/store/Actions/Actions.js @@ -10,7 +10,6 @@ import { fetchSystemDetails, fetchPatchSets, fetchPatchSet, - fetchPatchSetSystems, } from '../../Utilities/api'; import * as ActionTypes from '../ActionTypes'; @@ -243,47 +242,11 @@ export const fetchPatchSetAction = (id) => ({ }).then((result) => result), }); -export const fetchTemplateDetail = (id) => ({ - type: ActionTypes.FETCH_TEMPLATE_DETAIL, - payload: new Promise((resolve) => { - resolve(fetchPatchSet(id)); - }).then((result) => result), -}); - -export const clearTemplateDetail = () => ({ - type: ActionTypes.CLEAR_TEMPLATE_DETAIL, - payload: [], -}); - -export const fetchPatchSetDetailSystemsAction = (id, params) => ({ - type: ActionTypes.FETCH_PATCH_SET_DETAIL_SYSTEMS, - payload: new Promise((resolve) => { - resolve(fetchPatchSetSystems(id, params)); - }).then((result) => result), -}); - -export const changePatchSetDetailsSystemsParams = (params) => ({ - type: ActionTypes.CHANGE_PATCH_SET_DETAIL_SYSTEMS_PARAMS, - payload: params, -}); - -export const changePatchSetDetailsSystemsMetadata = (params) => ({ - type: ActionTypes.CHANGE_PATCH_SET_DETAIL_SYSTEMS_METADATA, - payload: params, -}); - export const clearPatchSetDetailsSystems = () => ({ type: ActionTypes.CLEAR_PATCH_SET_DETAIL_SYSTEMS, payload: [], }); -export const fetchPatchSetSystemsNoFiltersAction = (params) => ({ - type: ActionTypes.FETCH_PATCH_SET_SYSTEMS_NO_FILTERS, - payload: new Promise((resolve) => { - resolve(fetchPatchSetSystems(params)); - }).then((result) => result), -}); - export const clearPatchSetsAction = () => ({ type: ActionTypes.CLEAR_PATCH_SETS, payload: [], diff --git a/src/store/Reducers/InventoryEntitiesReducer.js b/src/store/Reducers/InventoryEntitiesReducer.js index d2bb0ba34..a01f897f4 100644 --- a/src/store/Reducers/InventoryEntitiesReducer.js +++ b/src/store/Reducers/InventoryEntitiesReducer.js @@ -1,7 +1,6 @@ import { createAdvisorySystemsRows, createSystemsRows, - createPatchSetDetailRows, createPackageSystemsRows, } from '../../Utilities/DataMappers'; import { selectRows, fetchRejected } from './HelperReducers'; @@ -74,18 +73,6 @@ export const modifyPackageSystems = (columns, state, lastAction) => { return state; }; -export const modifyTemplateDetailSystems = (columns, state) => { - if (state.loaded) { - return { - ...state, - status: { isLoading: false, hasError: false }, - rows: createPatchSetDetailRows(state.rows, state.selectedRows), - }; - } - - return state; -}; - export const modifyAdvisorySystems = (columns, state) => { if (state.loaded) { return { diff --git a/src/store/Reducers/PatchSetDetailStore.js b/src/store/Reducers/PatchSetDetailStore.js deleted file mode 100644 index c1e6809b3..000000000 --- a/src/store/Reducers/PatchSetDetailStore.js +++ /dev/null @@ -1,33 +0,0 @@ -import { FETCH_TEMPLATE_DETAIL, CLEAR_TEMPLATE_DETAIL } from '../ActionTypes'; -import { fetchPending, fetchRejected } from './HelperReducers'; - -export let initialState = { - data: { attributes: {} }, - status: { isLoading: true }, -}; - -export const PatchSetDetailStore = (state = initialState, action) => { - let newState = { ...state }; - - switch (action.type) { - case FETCH_TEMPLATE_DETAIL + '_FULFILLED': - return { - ...state, - status: { isLoading: false }, - data: action.payload.data, - error: {}, - }; - - case FETCH_TEMPLATE_DETAIL + '_PENDING': - return fetchPending(newState); - - case FETCH_TEMPLATE_DETAIL + '_REJECTED': - return fetchRejected(newState, action); - - case CLEAR_TEMPLATE_DETAIL: - return initialState; - - default: - return state; - } -}; diff --git a/src/store/Reducers/PatchSetDetailSystemsStore.js b/src/store/Reducers/PatchSetDetailSystemsStore.js deleted file mode 100644 index 568b6b97c..000000000 --- a/src/store/Reducers/PatchSetDetailSystemsStore.js +++ /dev/null @@ -1,60 +0,0 @@ -import { changeListParams } from '../../Utilities/Helpers'; -import { - CHANGE_PATCH_SET_DETAIL_SYSTEMS_PARAMS, - TRIGGER_GLOBAL_FILTER, - CHANGE_PATCH_SET_DETAIL_SYSTEMS_METADATA, - FETCH_PATCH_SET_SYSTEMS_NO_FILTERS, -} from '../ActionTypes'; -import { changeFilters } from './HelperReducers'; - -const initialState = { - selectedRows: {}, - queryParams: { - page: 1, - perPage: 20, - }, - templateHasSystemsLoading: true, - templateHasSystems: null, -}; - -export const PatchSetDetailSystemsStore = (state = initialState, action) => { - let newState = { ...state }; - - switch (action.type) { - case CHANGE_PATCH_SET_DETAIL_SYSTEMS_PARAMS: - newState.queryParams = changeListParams(newState.queryParams, action.payload); - return newState; - - case TRIGGER_GLOBAL_FILTER: - return changeFilters(newState, action); - - case CHANGE_PATCH_SET_DETAIL_SYSTEMS_METADATA: - newState.metadata = action.payload; - return newState; - - case FETCH_PATCH_SET_SYSTEMS_NO_FILTERS + '_PENDING': - return { - ...state, - templateHasSystemsLoading: true, - templateHasSystems: null, - }; - - case FETCH_PATCH_SET_SYSTEMS_NO_FILTERS + '_FULFILLED': - return { - ...state, - templateHasSystemsLoading: false, - templateHasSystems: action.payload.data.length > 0, - }; - - case FETCH_PATCH_SET_SYSTEMS_NO_FILTERS + '_REJECTED': - return { - ...state, - templateHasSystemsLoading: false, - // if we set this to true, Inventory table is shown, which has better error handling - templateHasSystems: true, - }; - - default: - return state; - } -}; diff --git a/src/store/index.js b/src/store/index.js index 22951b82b..e6bffcaea 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -12,8 +12,6 @@ import { PackageSystemsStore } from './Reducers/PackageSystemsStore'; import { AdvisorySystemsStore } from './Reducers/AdvisorySystemsStore'; import { GlobalFilterStore } from './Reducers/GlobalFilterStore'; import { PatchSetsReducer } from './Reducers/PatchSetsReducer'; -import { PatchSetDetailStore } from './Reducers/PatchSetDetailStore'; -import { PatchSetDetailSystemsStore } from './Reducers/PatchSetDetailSystemsStore'; import { legacy_createStore as createStore, applyMiddleware, @@ -37,8 +35,6 @@ export const defaultReducers = { AdvisorySystemsStore, GlobalFilterStore, PatchSetsStore: PatchSetsReducer, - PatchSetDetailStore, - PatchSetDetailSystemsStore, }; export const store = createStore( From 099e6e660bf6d08ac78b43f34164df237bbf6470 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Dugovi=C4=8D?= Date: Tue, 17 Feb 2026 14:12:18 +0100 Subject: [PATCH 5/8] refactor: remove deletePatchSet cascade --- src/Messages.js | 26 -------- src/SmartComponents/Modals/DeleteSetModal.js | 63 ------------------- src/SmartComponents/PatchSet/PatchSet.js | 39 +++--------- .../PatchSet/PatchSetAssets.js | 15 ----- src/Utilities/api.js | 3 - src/Utilities/constants.js | 11 ---- 6 files changed, 8 insertions(+), 149 deletions(-) delete mode 100644 src/SmartComponents/Modals/DeleteSetModal.js diff --git a/src/Messages.js b/src/Messages.js index 2d3ca16ea..89d209f20 100644 --- a/src/Messages.js +++ b/src/Messages.js @@ -38,11 +38,6 @@ export default defineMessages({ description: 'button label', defaultMessage: 'Edit template', }, - labelsButtonRemoveTemplate: { - id: 'labelsButtonRemoveTemplate', - description: 'button label', - defaultMessage: 'Delete template', - }, labelsCancel: { id: 'labelsCancel', description: 'Button label', @@ -173,11 +168,6 @@ export default defineMessages({ description: 'Label', defaultMessage: 'Date', }, - labelsDelete: { - id: 'labelsDelete', - description: 'button label', - defaultMessage: 'Delete', - }, labelsDescription: { id: 'labelsDescription', description: 'Label', @@ -737,22 +727,6 @@ export default defineMessages({ description: 'title with capital letters', defaultMessage: 'Assign to a template', }, - titlesTemplateDeleteModalCheckbox: { - id: 'titlesTemplateDeleteModalCheckbox', - description: 'page title with capital letter', - defaultMessage: 'I understand that this action cannot be undone.', - }, - titlesTemplateDeleteModalText: { - id: 'titlesTemplateDeleteModalText', - description: 'page title with capital letter', - defaultMessage: - '{templateName} and all its data will be permanently deleted. Associated systems will be removed from the template but will not be deleted.', - }, - titlesTemplateDeleteModalTitle: { - id: 'titlesTemplateDeleteModalTitle', - description: 'page title with capital letter', - defaultMessage: 'Delete template?', - }, titlesTemplateRemoveMultipleButton: { id: 'titlesTemplateRemoveMultipleButton', description: 'title with capital letters', diff --git a/src/SmartComponents/Modals/DeleteSetModal.js b/src/SmartComponents/Modals/DeleteSetModal.js deleted file mode 100644 index 720de77db..000000000 --- a/src/SmartComponents/Modals/DeleteSetModal.js +++ /dev/null @@ -1,63 +0,0 @@ -import React, { useState } from 'react'; -import propTypes from 'prop-types'; -import { Button, Checkbox } from '@patternfly/react-core'; -import { Modal } from '@patternfly/react-core/deprecated'; -import messages from '../../Messages'; -import { intl } from '../../Utilities/IntlProvider'; - -const DeleteSetModal = ({ isModalOpen, setModalOpen, templateName, onConfirm }) => { - const [isCheckboxChecked, setCheckboxChecked] = useState(false); - - const onClose = () => { - setModalOpen(false); - setCheckboxChecked(false); - }; - - return ( - { - onClose(); - onConfirm(); - }} - isDisabled={!isCheckboxChecked} - > - {intl.formatMessage(messages.labelsDelete)} - , - , - ]} - > - {intl.formatMessage(messages.titlesTemplateDeleteModalText, { - templateName, - b: (...chunks) => {chunks}, - })} - setCheckboxChecked(value)} - label={intl.formatMessage(messages.titlesTemplateDeleteModalCheckbox)} - id='template-delete-modal-checkbox' - /> - - ); -}; - -DeleteSetModal.propTypes = { - isModalOpen: propTypes.bool, - setModalOpen: propTypes.func, - templateName: propTypes.string, - onConfirm: propTypes.func, -}; - -export default DeleteSetModal; diff --git a/src/SmartComponents/PatchSet/PatchSet.js b/src/SmartComponents/PatchSet/PatchSet.js index 37d292553..bf24b45e7 100644 --- a/src/SmartComponents/PatchSet/PatchSet.js +++ b/src/SmartComponents/PatchSet/PatchSet.js @@ -13,7 +13,6 @@ import { selectPatchSetRow, clearPatchSetsAction, } from '../../store/Actions/Actions'; -import { deletePatchSet } from '../../Utilities/api'; import { createPatchSetRows } from '../../Utilities/DataMappers'; import { createSortBy, decodeQueryparams, encodeURLParams } from '../../Utilities/Helpers'; import { @@ -26,19 +25,15 @@ import { ID_API_ENDPOINTS, } from '../../Utilities/hooks'; import { intl } from '../../Utilities/IntlProvider'; -import { useAddNotification } from '@redhat-cloud-services/frontend-components-notifications'; import { patchSetColumns, CreatePatchSetButton as createPatchSetButton, - patchSetRowActions, CustomActionsToggle, } from './PatchSetAssets'; import PatchSetWizard from '../PatchSetWizard/PatchSetWizard'; -import { patchSetDeleteNotifications } from '../../Utilities/constants'; import { usePermissionsWithContext } from '@redhat-cloud-services/frontend-components-utilities/RBACHook'; import { OutlinedQuestionCircleIcon } from '@patternfly/react-icons'; import { Icon, Popover } from '@patternfly/react-core'; -import DeleteSetModal from '../Modals/DeleteSetModal'; import { NoPatchSetList } from '../../PresentationalComponents/Snippets/EmptyStates'; import { useChrome } from '@redhat-cloud-services/frontend-components/useChrome'; @@ -52,9 +47,6 @@ const PatchSet = () => { const dispatch = useDispatch(); const [searchParams, setSearchParams] = useSearchParams(); const [firstMount, setFirstMount] = React.useState(true); - const [isDeleteConfirmModalOpen, setDeleteConfirmModalOpen] = React.useState(false); - const [patchSetToDelete, setPatchSetToDelete] = React.useState(null); - const addNotification = useAddNotification(); const patchSets = useSelector(({ PatchSetsStore }) => PatchSetsStore.rows); @@ -117,25 +109,16 @@ const PatchSet = () => { const onSetPage = useSetPage(metadata.limit, apply); const onPerPageSelect = usePerPageSelect(apply); - const openPatchDeleteModal = (rowData) => { - setDeleteConfirmModalOpen(true); - setPatchSetToDelete(rowData); - }; - - const handlePatchSetDelete = () => { - deletePatchSet(patchSetToDelete.id) - .then(() => { - addNotification(patchSetDeleteNotifications(patchSetToDelete.displayName).success); - refreshTable(); - }) - .catch(() => { - addNotification(patchSetDeleteNotifications(patchSetToDelete.displayName).error); - }); - }; - const { hasAccess } = usePermissionsWithContext(['patch:*:*', 'patch:template:write']); const CreatePatchSetButton = createPatchSetButton(setPatchSetState, hasAccess); - const actionsConfig = patchSetRowActions(openPatchSetEditModal, openPatchDeleteModal); + const actionsConfig = [ + { + title: intl.formatMessage(messages.labelsButtonEditTemplate), + onClick: (_event, _rowId, rowData) => { + openPatchSetEditModal(rowData?.id); + }, + }, + ]; // TODO: refactor search filter to be able to wrap this into useMemo const filterConfig = { @@ -152,12 +135,6 @@ const PatchSet = () => { return ( -
[ - { - title: intl.formatMessage(messages.labelsButtonEditTemplate), - onClick: (_event, _rowId, rowData) => { - openPatchSetEditModal(rowData?.id); - }, - }, - { - title: intl.formatMessage(messages.labelsButtonRemoveTemplate), - onClick: (_event, _rowId, rowData) => { - handlePatchSetDelete(rowData); - }, - }, -]; - export const CustomActionsToggle = () => ( - - ) : ( - - ); - -export const patchSetColumns = [ - { - key: 'name', - title: 'Name', - transforms: [sortable], - }, - { - key: 'systems', - title: 'Systems applied', - transforms: [sortable], - }, - { - key: 'last_edited', - title: 'Last edited', - transforms: [sortable], - }, - { - key: 'published', - title: 'Published', - transforms: [sortable], - }, - { - key: 'creator', - title: 'Created by', - transforms: [sortable], - }, -]; - -export const CustomActionsToggle = () => ( - - , - , - ] - } - appendTo={[Function]} - aria-describedby="" - aria-label="" - aria-labelledby="" - className="" - hasNoBodyWrapper={false} - isOpen={false} - onClose={[Function]} - ouiaSafe={true} - showClose={true} - title="Delete template?" - titleIconVariant="warning" - titleLabel="" - variant="small" - > - } - > - - Delete - , - , - ] - } - aria-describedby="" - aria-label="" - aria-labelledby="" - boxId="pf-modal-part-0" - className="" - descriptorId="pf-modal-part-2" - hasNoBodyWrapper={false} - isOpen={false} - labelId="pf-modal-part-1" - onClose={[Function]} - ouiaId="OUIA-Generated-Modal-small-1" - ouiaSafe={true} - showClose={true} - title="Delete template?" - titleIconVariant="warning" - titleLabel="" - variant="small" - /> - - - -
- Templates - - - - - } - > - -
- -
- -
- - Templates - - - - - } - > - - <h1 - className="pf-c-title pf-m-2xl" - data-ouia-component-id="OUIA-Generated-Title-1" - data-ouia-component-type="PF4/Title" - data-ouia-safe={true} - widget-type="InsightsPageHeaderTitle" - > - <span> - Templates - <Popover - aria-describedby="template-header-title-popover" - aria-labelledby="template-header-title-popover" - bodyContent="Templates allow you to control the scope of package and advisory updates to be installed on selected systems." - enableFlip={true} - hasAutoWidth={true} - headerContent="About Templates" - id="template-header-title-popover" - maxWidth="320px" - position="right" - > - <Popper - appendTo={[Function]} - distance={25} - enableFlip={true} - flipBehavior={ - Array [ - "top", - "bottom", - "left", - "right", - "top-start", - "top-end", - "bottom-start", - "bottom-end", - "left-start", - "left-end", - "right-start", - "right-end", - ] - } - isVisible={false} - onDocumentClick={[Function]} - onDocumentKeyDown={[Function]} - onTriggerClick={[Function]} - placement="right" - popper={ - <ForwardRef - active={false} - aria-describedby="template-header-title-popover" - aria-labelledby="template-header-title-popover" - aria-modal="true" - className="pf-c-popover pf-m-width-auto" - focusTrapOptions={ - Object { - "clickOutsideDeactivates": true, - "fallbackFocus": [Function], - "returnFocusOnDeactivate": true, - "tabbableOptions": Object { - "displayCheck": "none", - }, - } - } - onMouseDown={[Function]} - preventScrollOnDeactivate={true} - role="dialog" - style={ - Object { - "maxWidth": "320px", - "minWidth": null, - "opacity": 0, - "transition": "opacity 300ms cubic-bezier(.54, 1.5, .38, 1.11)", - } - } - > - <PopoverArrow /> - <PopoverContent> - <PopoverCloseButton - aria-label="Close" - onClose={[Function]} - /> - <PopoverHeader - alertSeverityScreenReaderText="undefined alert:" - icon={null} - id="popover-template-header-title-popover-header" - titleHeadingLevel="h6" - > - About Templates - </PopoverHeader> - <PopoverBody - id="popover-template-header-title-popover-body" - > - Templates allow you to control the scope of package and advisory updates to be installed on selected systems. - </PopoverBody> - </PopoverContent> - </ForwardRef> - } - popperMatchesTriggerWidth={false} - positionModifiers={ - Object { - "bottom": "pf-m-bottom", - "bottom-end": "pf-m-bottom-right", - "bottom-start": "pf-m-bottom-left", - "left": "pf-m-left", - "left-end": "pf-m-left-bottom", - "left-start": "pf-m-left-top", - "right": "pf-m-right", - "right-end": "pf-m-right-bottom", - "right-start": "pf-m-right-top", - "top": "pf-m-top", - "top-end": "pf-m-top-right", - "top-start": "pf-m-top-left", - } - } - removeFindDomNode={false} - trigger={ - <OutlinedQuestionCircleIcon - className="pf-u-ml-sm" - color="var(--pf-global--secondary-color--100)" - noVerticalAlign={false} - size="sm" - style={ - Object { - "cursor": "pointer", - "fontSize": 16, - "verticalAlign": "0", - } - } - /> - } - zIndex={9999} - > - <FindRefWrapper - onFoundRef={[Function]} - > - <OutlinedQuestionCircleIcon - className="pf-u-ml-sm" - color="var(--pf-global--secondary-color--100)" - noVerticalAlign={false} - size="sm" - style={ - Object { - "cursor": "pointer", - "fontSize": 16, - "verticalAlign": "0", - } - } - > - <svg - aria-hidden={true} - aria-labelledby={null} - className="pf-u-ml-sm" - fill="var(--pf-global--secondary-color--100)" - height="1em" - role="img" - style={ - Object { - "cursor": "pointer", - "fontSize": 16, - "verticalAlign": "0", - } - } - viewBox="0 0 512 512" - width="1em" - > - <path - d="M256 8C119.043 8 8 119.083 8 256c0 136.997 111.043 248 248 248s248-111.003 248-248C504 119.083 392.957 8 256 8zm0 448c-110.532 0-200-89.431-200-200 0-110.495 89.472-200 200-200 110.491 0 200 89.471 200 200 0 110.53-89.431 200-200 200zm107.244-255.2c0 67.052-72.421 68.084-72.421 92.863V300c0 6.627-5.373 12-12 12h-45.647c-6.627 0-12-5.373-12-12v-8.659c0-35.745 27.1-50.034 47.579-61.516 17.561-9.845 28.324-16.541 28.324-29.579 0-17.246-21.999-28.693-39.784-28.693-23.189 0-33.894 10.977-48.942 29.969-4.057 5.12-11.46 6.071-16.666 2.124l-27.824-21.098c-5.107-3.872-6.251-11.066-2.644-16.363C184.846 131.491 214.94 112 261.794 112c49.071 0 101.45 38.304 101.45 88.8zM298 368c0 23.159-18.841 42-42 42s-42-18.841-42-42 18.841-42 42-42 42 18.841 42 42z" - /> - </svg> - </OutlinedQuestionCircleIcon> - </FindRefWrapper> - </Popper> - </Popover> - </span> - </h1> - - -
-
- -
- - -
- -
- -
-
-
- - -
- , - }, - Object { - "title": "No systems applied", - }, - Object { - "title": "N/A", - }, - Object { - "title": "N/A", - }, - Object { - "title": undefined, - }, - ], - "displayName": undefined, - "id": 1, - "key": 1, - "selected": false, - }, - Object { - "cells": Array [ - Object { - "title": , - }, - Object { - "title": "No systems applied", - }, - Object { - "title": "N/A", - }, - Object { - "title": "N/A", - }, - Object { - "title": undefined, - }, - ], - "displayName": undefined, - "id": 2, - "key": 2, - "selected": false, - }, - Object { - "cells": Array [ - Object { - "title": , - }, - Object { - "title": "No systems applied", - }, - Object { - "title": "N/A", - }, - Object { - "title": "N/A", - }, - Object { - "title": undefined, - }, - ], - "displayName": undefined, - "id": 3, - "key": 3, - "selected": false, - }, - Object { - "cells": Array [ - Object { - "title": , - }, - Object { - "title": "No systems applied", - }, - Object { - "title": "N/A", - }, - Object { - "title": "N/A", - }, - Object { - "title": undefined, - }, - ], - "displayName": undefined, - "id": 4, - "key": 4, - "selected": false, - }, - Object { - "cells": Array [ - Object { - "title": , - }, - Object { - "title": "No systems applied", - }, - Object { - "title": "N/A", - }, - Object { - "title": "N/A", - }, - Object { - "title": undefined, - }, - ], - "displayName": undefined, - "id": 5, - "key": 5, - "selected": false, - }, - ], - "status": Object { - "code": 200, - "hasError": false, - "isLoading": false, - }, - } - } - tableOUIA="patch-set-table" - > - - -
- -
-
- - -
- -
- - -
- -
- - Template - , - - Creator - , - ] - } - isOpen={false} - onSelect={[Function]} - ouiaId="ConditionalFilter" - toggle={ - - - - Template - - - } - > - - Template - , - - Creator - , - ] - } - isFlipEnabled={true} - isGrouped={false} - isOpen={false} - isPlain={false} - isText={false} - menuAppendTo="inline" - onSelect={[Function]} - position="left" - removeFindDomNode={false} - toggle={ - - - - Template - - - } - zIndex={9999} - > -
- - - - - -
-
-
-
-
- -
- - - - - - - - - - - - -
-
-
-
-
-
-
-
-
-
- - -
- - } - > - - } - zIndex={9999} - > -
- - - - - -
-
-
-
-
-
- -
- - - - - - For editing access, contact your administrator. - -
- } - popperMatchesTriggerWidth={false} - positionModifiers={ - Object { - "bottom": "pf-m-bottom", - "bottom-end": "pf-m-bottom-right", - "bottom-start": "pf-m-bottom-left", - "left": "pf-m-left", - "left-end": "pf-m-left-bottom", - "left-start": "pf-m-left-top", - "right": "pf-m-right", - "right-end": "pf-m-right-bottom", - "right-start": "pf-m-right-top", - "top": "pf-m-top", - "top-end": "pf-m-top-right", - "top-start": "pf-m-top-left", - } - } - removeFindDomNode={false} - trigger={ - - } - zIndex={9999} - > - - - - - - - - -
- - -
- -
-
- - - 1 - - - 10 - - - of - - - 10 - - - -
- - - 10 - per page - , - - 20 - per page - , - - 50 - per page - , - - 100 - per page - , - ] - } - isFlipEnabled={true} - isGrouped={false} - isOpen={false} - isPlain={true} - isText={false} - menuAppendTo="inline" - onSelect={[Function]} - position="left" - toggle={ - - } - > -
- -
- - - - 1 - - - 10 - - - of - - - 10 - - - - - - - - - -
-
-
-
-
- - - -
-
-
-
-
- -
- - -
- - -
- -
-
- - - - - , - }, - Object { - "title": "No systems applied", - }, - Object { - "title": "N/A", - }, - Object { - "title": "N/A", - }, - Object { - "title": undefined, - }, - ], - "displayName": undefined, - "id": 1, - "key": 1, - "selected": false, - }, - Object { - "cells": Array [ - Object { - "title": , - }, - Object { - "title": "No systems applied", - }, - Object { - "title": "N/A", - }, - Object { - "title": "N/A", - }, - Object { - "title": undefined, - }, - ], - "displayName": undefined, - "id": 2, - "key": 2, - "selected": false, - }, - Object { - "cells": Array [ - Object { - "title": , - }, - Object { - "title": "No systems applied", - }, - Object { - "title": "N/A", - }, - Object { - "title": "N/A", - }, - Object { - "title": undefined, - }, - ], - "displayName": undefined, - "id": 3, - "key": 3, - "selected": false, - }, - Object { - "cells": Array [ - Object { - "title": , - }, - Object { - "title": "No systems applied", - }, - Object { - "title": "N/A", - }, - Object { - "title": "N/A", - }, - Object { - "title": undefined, - }, - ], - "displayName": undefined, - "id": 4, - "key": 4, - "selected": false, - }, - Object { - "cells": Array [ - Object { - "title": , - }, - Object { - "title": "No systems applied", - }, - Object { - "title": "N/A", - }, - Object { - "title": "N/A", - }, - Object { - "title": undefined, - }, - ], - "displayName": undefined, - "id": 5, - "key": 5, - "selected": false, - }, - ] - } - selectVariant="checkbox" - sortBy={Object {}} - variant="compact" - > - - - -
- - -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - , - }, - Object { - "title": "No systems applied", - }, - Object { - "title": "N/A", - }, - Object { - "title": "N/A", - }, - Object { - "title": undefined, - }, - ], - "displayName": undefined, - "id": 1, - "key": 1, - "selected": false, - }, - Object { - "cells": Array [ - Object { - "title": , - }, - Object { - "title": "No systems applied", - }, - Object { - "title": "N/A", - }, - Object { - "title": "N/A", - }, - Object { - "title": undefined, - }, - ], - "displayName": undefined, - "id": 2, - "key": 2, - "selected": false, - }, - Object { - "cells": Array [ - Object { - "title": , - }, - Object { - "title": "No systems applied", - }, - Object { - "title": "N/A", - }, - Object { - "title": "N/A", - }, - Object { - "title": undefined, - }, - ], - "displayName": undefined, - "id": 3, - "key": 3, - "selected": false, - }, - Object { - "cells": Array [ - Object { - "title": , - }, - Object { - "title": "No systems applied", - }, - Object { - "title": "N/A", - }, - Object { - "title": "N/A", - }, - Object { - "title": undefined, - }, - ], - "displayName": undefined, - "id": 4, - "key": 4, - "selected": false, - }, - Object { - "cells": Array [ - Object { - "title": , - }, - Object { - "title": "No systems applied", - }, - Object { - "title": "N/A", - }, - Object { - "title": "N/A", - }, - Object { - "title": undefined, - }, - ], - "displayName": undefined, - "id": 5, - "key": 5, - "selected": false, - }, - ] - } - > - , - }, - Object { - "title": "No systems applied", - }, - Object { - "title": "N/A", - }, - Object { - "title": "N/A", - }, - Object { - "title": undefined, - }, - ], - "created-by": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": undefined, - }, - "displayName": undefined, - "id": 1, - "isExpanded": undefined, - "isFirst": true, - "isFirstVisible": true, - "isHeightAuto": false, - "isLast": false, - "isLastVisible": false, - "key": 1, - "last-edited": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": "N/A", - }, - "name": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": , - }, - "published": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": "N/A", - }, - "secretTableRowKeyId": 1, - "selected": false, - "systems-applied": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": "No systems applied", - }, - }, - Object { - "cells": Array [ - Object { - "title": , - }, - Object { - "title": "No systems applied", - }, - Object { - "title": "N/A", - }, - Object { - "title": "N/A", - }, - Object { - "title": undefined, - }, - ], - "created-by": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": undefined, - }, - "displayName": undefined, - "id": 2, - "isExpanded": undefined, - "isFirst": false, - "isFirstVisible": false, - "isHeightAuto": false, - "isLast": false, - "isLastVisible": false, - "key": 2, - "last-edited": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": "N/A", - }, - "name": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": , - }, - "published": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": "N/A", - }, - "secretTableRowKeyId": 2, - "selected": false, - "systems-applied": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": "No systems applied", - }, - }, - Object { - "cells": Array [ - Object { - "title": , - }, - Object { - "title": "No systems applied", - }, - Object { - "title": "N/A", - }, - Object { - "title": "N/A", - }, - Object { - "title": undefined, - }, - ], - "created-by": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": undefined, - }, - "displayName": undefined, - "id": 3, - "isExpanded": undefined, - "isFirst": false, - "isFirstVisible": false, - "isHeightAuto": false, - "isLast": false, - "isLastVisible": false, - "key": 3, - "last-edited": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": "N/A", - }, - "name": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": , - }, - "published": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": "N/A", - }, - "secretTableRowKeyId": 3, - "selected": false, - "systems-applied": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": "No systems applied", - }, - }, - Object { - "cells": Array [ - Object { - "title": , - }, - Object { - "title": "No systems applied", - }, - Object { - "title": "N/A", - }, - Object { - "title": "N/A", - }, - Object { - "title": undefined, - }, - ], - "created-by": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": undefined, - }, - "displayName": undefined, - "id": 4, - "isExpanded": undefined, - "isFirst": false, - "isFirstVisible": false, - "isHeightAuto": false, - "isLast": false, - "isLastVisible": false, - "key": 4, - "last-edited": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": "N/A", - }, - "name": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": , - }, - "published": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": "N/A", - }, - "secretTableRowKeyId": 4, - "selected": false, - "systems-applied": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": "No systems applied", - }, - }, - Object { - "cells": Array [ - Object { - "title": , - }, - Object { - "title": "No systems applied", - }, - Object { - "title": "N/A", - }, - Object { - "title": "N/A", - }, - Object { - "title": undefined, - }, - ], - "created-by": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": undefined, - }, - "displayName": undefined, - "id": 5, - "isExpanded": undefined, - "isFirst": false, - "isFirstVisible": false, - "isHeightAuto": false, - "isLast": true, - "isLastVisible": true, - "key": 5, - "last-edited": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": "N/A", - }, - "name": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": , - }, - "published": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": "N/A", - }, - "secretTableRowKeyId": 5, - "selected": false, - "systems-applied": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": "No systems applied", - }, - }, - ] - } - onRow={[Function]} - rowKey="secretTableRowKeyId" - rows={ - Array [ - Object { - "cells": Array [ - Object { - "title": , - }, - Object { - "title": "No systems applied", - }, - Object { - "title": "N/A", - }, - Object { - "title": "N/A", - }, - Object { - "title": undefined, - }, - ], - "created-by": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": undefined, - }, - "displayName": undefined, - "id": 1, - "isExpanded": undefined, - "isFirst": true, - "isFirstVisible": true, - "isHeightAuto": false, - "isLast": false, - "isLastVisible": false, - "key": 1, - "last-edited": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": "N/A", - }, - "name": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": , - }, - "published": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": "N/A", - }, - "secretTableRowKeyId": 1, - "selected": false, - "systems-applied": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": "No systems applied", - }, - }, - Object { - "cells": Array [ - Object { - "title": , - }, - Object { - "title": "No systems applied", - }, - Object { - "title": "N/A", - }, - Object { - "title": "N/A", - }, - Object { - "title": undefined, - }, - ], - "created-by": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": undefined, - }, - "displayName": undefined, - "id": 2, - "isExpanded": undefined, - "isFirst": false, - "isFirstVisible": false, - "isHeightAuto": false, - "isLast": false, - "isLastVisible": false, - "key": 2, - "last-edited": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": "N/A", - }, - "name": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": , - }, - "published": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": "N/A", - }, - "secretTableRowKeyId": 2, - "selected": false, - "systems-applied": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": "No systems applied", - }, - }, - Object { - "cells": Array [ - Object { - "title": , - }, - Object { - "title": "No systems applied", - }, - Object { - "title": "N/A", - }, - Object { - "title": "N/A", - }, - Object { - "title": undefined, - }, - ], - "created-by": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": undefined, - }, - "displayName": undefined, - "id": 3, - "isExpanded": undefined, - "isFirst": false, - "isFirstVisible": false, - "isHeightAuto": false, - "isLast": false, - "isLastVisible": false, - "key": 3, - "last-edited": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": "N/A", - }, - "name": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": , - }, - "published": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": "N/A", - }, - "secretTableRowKeyId": 3, - "selected": false, - "systems-applied": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": "No systems applied", - }, - }, - Object { - "cells": Array [ - Object { - "title": , - }, - Object { - "title": "No systems applied", - }, - Object { - "title": "N/A", - }, - Object { - "title": "N/A", - }, - Object { - "title": undefined, - }, - ], - "created-by": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": undefined, - }, - "displayName": undefined, - "id": 4, - "isExpanded": undefined, - "isFirst": false, - "isFirstVisible": false, - "isHeightAuto": false, - "isLast": false, - "isLastVisible": false, - "key": 4, - "last-edited": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": "N/A", - }, - "name": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": , - }, - "published": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": "N/A", - }, - "secretTableRowKeyId": 4, - "selected": false, - "systems-applied": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": "No systems applied", - }, - }, - Object { - "cells": Array [ - Object { - "title": , - }, - Object { - "title": "No systems applied", - }, - Object { - "title": "N/A", - }, - Object { - "title": "N/A", - }, - Object { - "title": undefined, - }, - ], - "created-by": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": undefined, - }, - "displayName": undefined, - "id": 5, - "isExpanded": undefined, - "isFirst": false, - "isFirstVisible": false, - "isHeightAuto": false, - "isLast": true, - "isLastVisible": true, - "key": 5, - "last-edited": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": "N/A", - }, - "name": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": , - }, - "published": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": "N/A", - }, - "secretTableRowKeyId": 5, - "selected": false, - "systems-applied": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": "No systems applied", - }, - }, - ] - } - > - , - }, - Object { - "title": "No systems applied", - }, - Object { - "title": "N/A", - }, - Object { - "title": "N/A", - }, - Object { - "title": undefined, - }, - ], - "created-by": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": undefined, - }, - "displayName": undefined, - "id": 1, - "isExpanded": undefined, - "isFirst": true, - "isFirstVisible": true, - "isHeightAuto": false, - "isLast": false, - "isLastVisible": false, - "key": 1, - "last-edited": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": "N/A", - }, - "name": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": , - }, - "published": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": "N/A", - }, - "secretTableRowKeyId": 1, - "selected": false, - "systems-applied": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": "No systems applied", - }, - }, - Object { - "cells": Array [ - Object { - "title": , - }, - Object { - "title": "No systems applied", - }, - Object { - "title": "N/A", - }, - Object { - "title": "N/A", - }, - Object { - "title": undefined, - }, - ], - "created-by": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": undefined, - }, - "displayName": undefined, - "id": 2, - "isExpanded": undefined, - "isFirst": false, - "isFirstVisible": false, - "isHeightAuto": false, - "isLast": false, - "isLastVisible": false, - "key": 2, - "last-edited": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": "N/A", - }, - "name": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": , - }, - "published": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": "N/A", - }, - "secretTableRowKeyId": 2, - "selected": false, - "systems-applied": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": "No systems applied", - }, - }, - Object { - "cells": Array [ - Object { - "title": , - }, - Object { - "title": "No systems applied", - }, - Object { - "title": "N/A", - }, - Object { - "title": "N/A", - }, - Object { - "title": undefined, - }, - ], - "created-by": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": undefined, - }, - "displayName": undefined, - "id": 3, - "isExpanded": undefined, - "isFirst": false, - "isFirstVisible": false, - "isHeightAuto": false, - "isLast": false, - "isLastVisible": false, - "key": 3, - "last-edited": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": "N/A", - }, - "name": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": , - }, - "published": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": "N/A", - }, - "secretTableRowKeyId": 3, - "selected": false, - "systems-applied": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": "No systems applied", - }, - }, - Object { - "cells": Array [ - Object { - "title": , - }, - Object { - "title": "No systems applied", - }, - Object { - "title": "N/A", - }, - Object { - "title": "N/A", - }, - Object { - "title": undefined, - }, - ], - "created-by": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": undefined, - }, - "displayName": undefined, - "id": 4, - "isExpanded": undefined, - "isFirst": false, - "isFirstVisible": false, - "isHeightAuto": false, - "isLast": false, - "isLastVisible": false, - "key": 4, - "last-edited": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": "N/A", - }, - "name": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": , - }, - "published": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": "N/A", - }, - "secretTableRowKeyId": 4, - "selected": false, - "systems-applied": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": "No systems applied", - }, - }, - Object { - "cells": Array [ - Object { - "title": , - }, - Object { - "title": "No systems applied", - }, - Object { - "title": "N/A", - }, - Object { - "title": "N/A", - }, - Object { - "title": undefined, - }, - ], - "created-by": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": undefined, - }, - "displayName": undefined, - "id": 5, - "isExpanded": undefined, - "isFirst": false, - "isFirstVisible": false, - "isHeightAuto": false, - "isLast": true, - "isLastVisible": true, - "key": 5, - "last-edited": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": "N/A", - }, - "name": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": , - }, - "published": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": "N/A", - }, - "secretTableRowKeyId": 5, - "selected": false, - "systems-applied": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": "No systems applied", - }, - }, - ] - } - onRow={[Function]} - renderers={ - Object { - "body": Object { - "cell": [Function], - "row": [Function], - "wrapper": [Function], - }, - "header": Object { - "cell": [Function], - "row": Object { - "$$typeof": Symbol(react.forward_ref), - "render": [Function], - }, - "wrapper": Object { - "$$typeof": Symbol(react.forward_ref), - "render": [Function], - }, - }, - "table": Object { - "$$typeof": Symbol(react.forward_ref), - "render": [Function], - }, - } - } - rowKey="secretTableRowKeyId" - rows={ - Array [ - Object { - "cells": Array [ - Object { - "title": , - }, - Object { - "title": "No systems applied", - }, - Object { - "title": "N/A", - }, - Object { - "title": "N/A", - }, - Object { - "title": undefined, - }, - ], - "created-by": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": undefined, - }, - "displayName": undefined, - "id": 1, - "isExpanded": undefined, - "isFirst": true, - "isFirstVisible": true, - "isHeightAuto": false, - "isLast": false, - "isLastVisible": false, - "key": 1, - "last-edited": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": "N/A", - }, - "name": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": , - }, - "published": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": "N/A", - }, - "secretTableRowKeyId": 1, - "selected": false, - "systems-applied": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": "No systems applied", - }, - }, - Object { - "cells": Array [ - Object { - "title": , - }, - Object { - "title": "No systems applied", - }, - Object { - "title": "N/A", - }, - Object { - "title": "N/A", - }, - Object { - "title": undefined, - }, - ], - "created-by": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": undefined, - }, - "displayName": undefined, - "id": 2, - "isExpanded": undefined, - "isFirst": false, - "isFirstVisible": false, - "isHeightAuto": false, - "isLast": false, - "isLastVisible": false, - "key": 2, - "last-edited": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": "N/A", - }, - "name": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": , - }, - "published": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": "N/A", - }, - "secretTableRowKeyId": 2, - "selected": false, - "systems-applied": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": "No systems applied", - }, - }, - Object { - "cells": Array [ - Object { - "title": , - }, - Object { - "title": "No systems applied", - }, - Object { - "title": "N/A", - }, - Object { - "title": "N/A", - }, - Object { - "title": undefined, - }, - ], - "created-by": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": undefined, - }, - "displayName": undefined, - "id": 3, - "isExpanded": undefined, - "isFirst": false, - "isFirstVisible": false, - "isHeightAuto": false, - "isLast": false, - "isLastVisible": false, - "key": 3, - "last-edited": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": "N/A", - }, - "name": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": , - }, - "published": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": "N/A", - }, - "secretTableRowKeyId": 3, - "selected": false, - "systems-applied": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": "No systems applied", - }, - }, - Object { - "cells": Array [ - Object { - "title": , - }, - Object { - "title": "No systems applied", - }, - Object { - "title": "N/A", - }, - Object { - "title": "N/A", - }, - Object { - "title": undefined, - }, - ], - "created-by": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": undefined, - }, - "displayName": undefined, - "id": 4, - "isExpanded": undefined, - "isFirst": false, - "isFirstVisible": false, - "isHeightAuto": false, - "isLast": false, - "isLastVisible": false, - "key": 4, - "last-edited": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": "N/A", - }, - "name": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": , - }, - "published": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": "N/A", - }, - "secretTableRowKeyId": 4, - "selected": false, - "systems-applied": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": "No systems applied", - }, - }, - Object { - "cells": Array [ - Object { - "title": , - }, - Object { - "title": "No systems applied", - }, - Object { - "title": "N/A", - }, - Object { - "title": "N/A", - }, - Object { - "title": undefined, - }, - ], - "created-by": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": undefined, - }, - "displayName": undefined, - "id": 5, - "isExpanded": undefined, - "isFirst": false, - "isFirstVisible": false, - "isHeightAuto": false, - "isLast": true, - "isLastVisible": true, - "key": 5, - "last-edited": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": "N/A", - }, - "name": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": , - }, - "published": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": "N/A", - }, - "secretTableRowKeyId": 5, - "selected": false, - "systems-applied": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": "No systems applied", - }, - }, - ] - } - > - , - }, - Object { - "title": "No systems applied", - }, - Object { - "title": "N/A", - }, - Object { - "title": "N/A", - }, - Object { - "title": undefined, - }, - ], - "created-by": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": undefined, - }, - "displayName": undefined, - "id": 1, - "isExpanded": undefined, - "isFirst": true, - "isFirstVisible": true, - "isHeightAuto": false, - "isLast": false, - "isLastVisible": false, - "key": 1, - "last-edited": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": "N/A", - }, - "name": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": , - }, - "published": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": "N/A", - }, - "secretTableRowKeyId": 1, - "selected": false, - "systems-applied": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": "No systems applied", - }, - }, - Object { - "cells": Array [ - Object { - "title": , - }, - Object { - "title": "No systems applied", - }, - Object { - "title": "N/A", - }, - Object { - "title": "N/A", - }, - Object { - "title": undefined, - }, - ], - "created-by": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": undefined, - }, - "displayName": undefined, - "id": 2, - "isExpanded": undefined, - "isFirst": false, - "isFirstVisible": false, - "isHeightAuto": false, - "isLast": false, - "isLastVisible": false, - "key": 2, - "last-edited": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": "N/A", - }, - "name": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": , - }, - "published": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": "N/A", - }, - "secretTableRowKeyId": 2, - "selected": false, - "systems-applied": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": "No systems applied", - }, - }, - Object { - "cells": Array [ - Object { - "title": , - }, - Object { - "title": "No systems applied", - }, - Object { - "title": "N/A", - }, - Object { - "title": "N/A", - }, - Object { - "title": undefined, - }, - ], - "created-by": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": undefined, - }, - "displayName": undefined, - "id": 3, - "isExpanded": undefined, - "isFirst": false, - "isFirstVisible": false, - "isHeightAuto": false, - "isLast": false, - "isLastVisible": false, - "key": 3, - "last-edited": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": "N/A", - }, - "name": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": , - }, - "published": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": "N/A", - }, - "secretTableRowKeyId": 3, - "selected": false, - "systems-applied": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": "No systems applied", - }, - }, - Object { - "cells": Array [ - Object { - "title": , - }, - Object { - "title": "No systems applied", - }, - Object { - "title": "N/A", - }, - Object { - "title": "N/A", - }, - Object { - "title": undefined, - }, - ], - "created-by": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": undefined, - }, - "displayName": undefined, - "id": 4, - "isExpanded": undefined, - "isFirst": false, - "isFirstVisible": false, - "isHeightAuto": false, - "isLast": false, - "isLastVisible": false, - "key": 4, - "last-edited": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": "N/A", - }, - "name": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": , - }, - "published": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": "N/A", - }, - "secretTableRowKeyId": 4, - "selected": false, - "systems-applied": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": "No systems applied", - }, - }, - Object { - "cells": Array [ - Object { - "title": , - }, - Object { - "title": "No systems applied", - }, - Object { - "title": "N/A", - }, - Object { - "title": "N/A", - }, - Object { - "title": undefined, - }, - ], - "created-by": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": undefined, - }, - "displayName": undefined, - "id": 5, - "isExpanded": undefined, - "isFirst": false, - "isFirstVisible": false, - "isHeightAuto": false, - "isLast": true, - "isLastVisible": true, - "key": 5, - "last-edited": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": "N/A", - }, - "name": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": , - }, - "published": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": "N/A", - }, - "secretTableRowKeyId": 5, - "selected": false, - "systems-applied": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": "No systems applied", - }, - }, - ] - } - > - - - - , - }, - Object { - "title": "No systems applied", - }, - Object { - "title": "N/A", - }, - Object { - "title": "N/A", - }, - Object { - "title": undefined, - }, - ], - "created-by": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": undefined, - }, - "displayName": undefined, - "id": 1, - "isExpanded": undefined, - "isFirst": true, - "isFirstVisible": true, - "isHeightAuto": false, - "isLast": false, - "isLastVisible": false, - "key": 1, - "last-edited": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": "N/A", - }, - "name": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": , - }, - "published": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": "N/A", - }, - "secretTableRowKeyId": 1, - "selected": false, - "systems-applied": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": "No systems applied", - }, - } - } - rowIndex={0} - rowKey="1-row" - > - , - }, - Object { - "title": "No systems applied", - }, - Object { - "title": "N/A", - }, - Object { - "title": "N/A", - }, - Object { - "title": undefined, - }, - ], - "created-by": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": undefined, - }, - "displayName": undefined, - "id": 1, - "isExpanded": undefined, - "isFirst": true, - "isFirstVisible": true, - "isHeightAuto": false, - "isLast": false, - "isLastVisible": false, - "key": 1, - "last-edited": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": "N/A", - }, - "name": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": , - }, - "published": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": "N/A", - }, - "secretTableRowKeyId": 1, - "selected": false, - "systems-applied": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": "No systems applied", - }, - } - } - rowProps={ - Object { - "rowIndex": 0, - "rowKey": "1-row", - } - } - > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - , - }, - Object { - "title": "No systems applied", - }, - Object { - "title": "N/A", - }, - Object { - "title": "N/A", - }, - Object { - "title": undefined, - }, - ], - "created-by": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": undefined, - }, - "displayName": undefined, - "id": 2, - "isExpanded": undefined, - "isFirst": false, - "isFirstVisible": false, - "isHeightAuto": false, - "isLast": false, - "isLastVisible": false, - "key": 2, - "last-edited": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": "N/A", - }, - "name": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": , - }, - "published": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": "N/A", - }, - "secretTableRowKeyId": 2, - "selected": false, - "systems-applied": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": "No systems applied", - }, - } - } - rowIndex={1} - rowKey="2-row" - > - , - }, - Object { - "title": "No systems applied", - }, - Object { - "title": "N/A", - }, - Object { - "title": "N/A", - }, - Object { - "title": undefined, - }, - ], - "created-by": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": undefined, - }, - "displayName": undefined, - "id": 2, - "isExpanded": undefined, - "isFirst": false, - "isFirstVisible": false, - "isHeightAuto": false, - "isLast": false, - "isLastVisible": false, - "key": 2, - "last-edited": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": "N/A", - }, - "name": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": , - }, - "published": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": "N/A", - }, - "secretTableRowKeyId": 2, - "selected": false, - "systems-applied": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": "No systems applied", - }, - } - } - rowProps={ - Object { - "rowIndex": 1, - "rowKey": "2-row", - } - } - > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - , - }, - Object { - "title": "No systems applied", - }, - Object { - "title": "N/A", - }, - Object { - "title": "N/A", - }, - Object { - "title": undefined, - }, - ], - "created-by": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": undefined, - }, - "displayName": undefined, - "id": 3, - "isExpanded": undefined, - "isFirst": false, - "isFirstVisible": false, - "isHeightAuto": false, - "isLast": false, - "isLastVisible": false, - "key": 3, - "last-edited": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": "N/A", - }, - "name": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": , - }, - "published": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": "N/A", - }, - "secretTableRowKeyId": 3, - "selected": false, - "systems-applied": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": "No systems applied", - }, - } - } - rowIndex={2} - rowKey="3-row" - > - , - }, - Object { - "title": "No systems applied", - }, - Object { - "title": "N/A", - }, - Object { - "title": "N/A", - }, - Object { - "title": undefined, - }, - ], - "created-by": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": undefined, - }, - "displayName": undefined, - "id": 3, - "isExpanded": undefined, - "isFirst": false, - "isFirstVisible": false, - "isHeightAuto": false, - "isLast": false, - "isLastVisible": false, - "key": 3, - "last-edited": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": "N/A", - }, - "name": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": , - }, - "published": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": "N/A", - }, - "secretTableRowKeyId": 3, - "selected": false, - "systems-applied": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": "No systems applied", - }, - } - } - rowProps={ - Object { - "rowIndex": 2, - "rowKey": "3-row", - } - } - > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - , - }, - Object { - "title": "No systems applied", - }, - Object { - "title": "N/A", - }, - Object { - "title": "N/A", - }, - Object { - "title": undefined, - }, - ], - "created-by": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": undefined, - }, - "displayName": undefined, - "id": 4, - "isExpanded": undefined, - "isFirst": false, - "isFirstVisible": false, - "isHeightAuto": false, - "isLast": false, - "isLastVisible": false, - "key": 4, - "last-edited": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": "N/A", - }, - "name": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": , - }, - "published": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": "N/A", - }, - "secretTableRowKeyId": 4, - "selected": false, - "systems-applied": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": "No systems applied", - }, - } - } - rowIndex={3} - rowKey="4-row" - > - , - }, - Object { - "title": "No systems applied", - }, - Object { - "title": "N/A", - }, - Object { - "title": "N/A", - }, - Object { - "title": undefined, - }, - ], - "created-by": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": undefined, - }, - "displayName": undefined, - "id": 4, - "isExpanded": undefined, - "isFirst": false, - "isFirstVisible": false, - "isHeightAuto": false, - "isLast": false, - "isLastVisible": false, - "key": 4, - "last-edited": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": "N/A", - }, - "name": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": , - }, - "published": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": "N/A", - }, - "secretTableRowKeyId": 4, - "selected": false, - "systems-applied": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": "No systems applied", - }, - } - } - rowProps={ - Object { - "rowIndex": 3, - "rowKey": "4-row", - } - } - > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - , - }, - Object { - "title": "No systems applied", - }, - Object { - "title": "N/A", - }, - Object { - "title": "N/A", - }, - Object { - "title": undefined, - }, - ], - "created-by": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": undefined, - }, - "displayName": undefined, - "id": 5, - "isExpanded": undefined, - "isFirst": false, - "isFirstVisible": false, - "isHeightAuto": false, - "isLast": true, - "isLastVisible": true, - "key": 5, - "last-edited": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": "N/A", - }, - "name": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": , - }, - "published": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": "N/A", - }, - "secretTableRowKeyId": 5, - "selected": false, - "systems-applied": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": "No systems applied", - }, - } - } - rowIndex={4} - rowKey="5-row" - > - , - }, - Object { - "title": "No systems applied", - }, - Object { - "title": "N/A", - }, - Object { - "title": "N/A", - }, - Object { - "title": undefined, - }, - ], - "created-by": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": undefined, - }, - "displayName": undefined, - "id": 5, - "isExpanded": undefined, - "isFirst": false, - "isFirstVisible": false, - "isHeightAuto": false, - "isLast": true, - "isLastVisible": true, - "key": 5, - "last-edited": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": "N/A", - }, - "name": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": , - }, - "published": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": "N/A", - }, - "secretTableRowKeyId": 5, - "selected": false, - "systems-applied": Object { - "formatters": Array [], - "props": Object { - "isVisible": true, - }, - "title": "No systems applied", - }, - } - } - rowProps={ - Object { - "rowIndex": 4, - "rowKey": "5-row", - } - } - > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - -
- - - 10 - per page - , - - 20 - per page - , - - 50 - per page - , - - 100 - per page - , - ] - } - isFlipEnabled={true} - isGrouped={false} - isOpen={false} - isPlain={true} - isText={false} - menuAppendTo="inline" - onSelect={[Function]} - position="left" - toggle={ - - } - > -
- -
- - - - 1 - - - 10 - - - of - - - 10 - - - - - - - - - -
-
-
-
-
- - - -
-
-
- -
-
-
- - - - -`; diff --git a/src/SmartComponents/PatchSetWizard/PatchSetWizard.js b/src/SmartComponents/PatchSetWizard/PatchSetWizard.js deleted file mode 100644 index 91b5e14de..000000000 --- a/src/SmartComponents/PatchSetWizard/PatchSetWizard.js +++ /dev/null @@ -1,71 +0,0 @@ -import React, { Fragment, useState, memo } from 'react'; -import propTypes from 'prop-types'; - -import { Wizard, Modal } from '@patternfly/react-core/deprecated'; - -import { getWizardTitle } from './WizardAssets'; -import RequestProgress from './steps/RequestProgress'; -import { intl } from '../../Utilities/IntlProvider'; -import messages from '../../Messages'; - -export const PatchSetWizard = ({ setBaselineState, patchSetID }) => { - // if system ids exist, those are being assigned. Likewise if patchSetID exists, it is being edited - const wizardType = patchSetID ? 'edit' : 'create'; - const [wizardState, setWizardState] = useState({ - submitted: false, - formValues: {}, - requestPending: true, - failed: false, - shouldRefresh: false, - }); - - const handleWizardClose = () => { - const shouldRefresh = !wizardState.failed && wizardState.submitted; - - setBaselineState({ - isPatchSetWizardOpen: false, - systemsIDs: [], - patchSetID: undefined, - shouldRefresh, - }); - setWizardState({ formValues: {}, submitted: false }); - }; - - return ( - - - {intl.formatMessage(messages.templateDescription)}} - steps={[ - { - name: 'progress', - component: , - isFinishedStep: true, - }, - ]} - onClose={handleWizardClose} - /> - - - ); -}; - -PatchSetWizard.propTypes = { - setBaselineState: propTypes.func, - patchSetID: propTypes.string, -}; - -export default memo( - PatchSetWizard, - (prevProps, nextProps) => JSON.stringify(prevProps) === JSON.stringify(nextProps), -); diff --git a/src/SmartComponents/PatchSetWizard/WizardAssets.js b/src/SmartComponents/PatchSetWizard/WizardAssets.js deleted file mode 100644 index 40a7bbc0c..000000000 --- a/src/SmartComponents/PatchSetWizard/WizardAssets.js +++ /dev/null @@ -1,13 +0,0 @@ -import { intl } from '../../Utilities/IntlProvider'; -import messages from '../../Messages'; - -export const getWizardTitle = (wizardType) => - wizardType === 'edit' - ? intl.formatMessage(messages.templateEdit) - : intl.formatMessage(messages.templateTitle); - -export const apiFailedNotification = (description) => ({ - title: 'There was an error while processing your request', - description, - variant: 'danger', -}); diff --git a/src/SmartComponents/PatchSetWizard/steps/RequestProgress.js b/src/SmartComponents/PatchSetWizard/steps/RequestProgress.js deleted file mode 100644 index bd20f8b30..000000000 --- a/src/SmartComponents/PatchSetWizard/steps/RequestProgress.js +++ /dev/null @@ -1,97 +0,0 @@ -import React from 'react'; -import propTypes from 'prop-types'; -import { - EmptyState, - EmptyStateVariant, - EmptyStateBody, - Grid, - GridItem, - HelperText, - HelperTextItem, - Button, -} from '@patternfly/react-core'; -import { CheckCircleIcon, ExclamationCircleIcon, InProgressIcon } from '@patternfly/react-icons'; -import { intl } from '../../../Utilities/IntlProvider'; -import messages from '../../../Messages'; -import { apiFailedNotification } from '../WizardAssets'; -import { useAddNotification } from '@redhat-cloud-services/frontend-components-notifications'; - -const RequestProgress = ({ onClose, state }) => { - const { requestPending, failed, error } = state; - const addNotification = useAddNotification(); - - if (failed) { - addNotification(apiFailedNotification(error.detail)); - } - - return ( - - - - {requestPending && ( - <> - - - - {intl.formatMessage(messages.textPatchTemplatePending)} - - - - - {' '} - - - )} - {!requestPending && !failed && ( - - - - )} - {!requestPending && failed && ( - <> - - - - {intl.formatMessage(messages.templateError, { - a: (chunks) => ( - {chunks} - ), - })} - - - - - - - - )} - - - - ); -}; - -RequestProgress.propTypes = { - onClose: propTypes.func, - state: propTypes.object, -}; - -export default RequestProgress; diff --git a/src/SmartComponents/SystemDetail/InventoryDetail.js b/src/SmartComponents/SystemDetail/InventoryDetail.js index 65f19cc1b..880f513ec 100644 --- a/src/SmartComponents/SystemDetail/InventoryDetail.js +++ b/src/SmartComponents/SystemDetail/InventoryDetail.js @@ -13,8 +13,6 @@ import { } from '@redhat-cloud-services/frontend-components/Inventory'; import { Alert, Grid, GridItem, Content } from '@patternfly/react-core'; import { fetchSystemDetailsAction } from '../../store/Actions/Actions'; -import PatchSetWrapper from '../../PresentationalComponents/PatchSetWrapper/PatchSetWrapper'; -import { usePatchSetState } from '../../Utilities/hooks'; import { useParams } from 'react-router-dom'; import SystemDetail from './SystemDetail'; import { useChrome } from '@redhat-cloud-services/frontend-components/useChrome'; @@ -33,18 +31,10 @@ const InventoryDetail = () => { ({ entityDetails }) => entityDetails?.entity ?? {}, ); - const { patchSetState, setPatchSetState } = usePatchSetState(); - useEffect(() => { dispatch(fetchSystemDetailsAction(inventoryId)); }, []); - useEffect(() => { - if (patchSetState.shouldRefresh) { - dispatch(fetchSystemDetailsAction(inventoryId)); - } - }, [patchSetState.shouldRefresh]); - const chrome = useChrome(); useEffect(() => { displayName && chrome.updateDocumentTitle(`${displayName} - Systems - Patch | RHEL`, true); @@ -62,7 +52,6 @@ const InventoryDetail = () => { }} inventoryId={inventoryId} > -
{
- +
); diff --git a/src/SmartComponents/SystemDetail/InventoryDetail.test.js b/src/SmartComponents/SystemDetail/InventoryDetail.test.js index bf387f6d7..c67186a49 100644 --- a/src/SmartComponents/SystemDetail/InventoryDetail.test.js +++ b/src/SmartComponents/SystemDetail/InventoryDetail.test.js @@ -3,10 +3,8 @@ import { render } from '@testing-library/react'; import { Provider, useSelector } from 'react-redux'; import { entityDetail } from '../../Utilities/RawDataForTesting'; import configureStore from 'redux-mock-store'; -import { initMocks, mountWithIntl } from '../../Utilities/unitTestingUtilities.js'; +import { initMocks } from '../../Utilities/unitTestingUtilities.js'; import { BrowserRouter as Router } from 'react-router-dom'; -import { InventoryDetailHead } from '@redhat-cloud-services/frontend-components/Inventory'; -import { useFeatureFlag } from '../../Utilities/hooks'; initMocks(); @@ -72,18 +70,4 @@ describe('InventoryPage.js', () => { ); expect(asFragment()).toMatchSnapshot(); }); - - it('Should hide all dropdown actions when patch template flag is disabled', () => { - useFeatureFlag.mockReturnValueOnce(false); - const tempWrapper = mountWithIntl( - - - - - , - ); - - const { actions } = tempWrapper.find(InventoryDetailHead).props(); - expect(actions.length).toEqual(undefined); - }); }); diff --git a/src/SmartComponents/Systems/SystemListAssets.test.js b/src/SmartComponents/Systems/SystemListAssets.test.js index dcc656832..efbc860d2 100644 --- a/src/SmartComponents/Systems/SystemListAssets.test.js +++ b/src/SmartComponents/Systems/SystemListAssets.test.js @@ -73,7 +73,7 @@ describe('SystemListAssets.js', () => { }); it('Should disable "Apply all applicable advisories" action when there is no applicable advisories ', () => { const testRow = { applicable_advisories: [0, 0, 0, 0] }; - const actions = systemsRowActions(null, null, null, testRow); + const actions = systemsRowActions(null, testRow); expect(actions).toEqual([ { isDisabled: true, diff --git a/src/SmartComponents/Systems/SystemTable.test.js b/src/SmartComponents/Systems/SystemTable.test.js index 117d3c2da..3b4803f73 100644 --- a/src/SmartComponents/Systems/SystemTable.test.js +++ b/src/SmartComponents/Systems/SystemTable.test.js @@ -30,7 +30,7 @@ const initStore = (state) => { const renderComponent = async (mockedStore) => { render( - + , ); diff --git a/src/SmartComponents/Systems/SystemsListAssets.js b/src/SmartComponents/Systems/SystemsListAssets.js index 599575ec6..3460f2b4d 100644 --- a/src/SmartComponents/Systems/SystemsListAssets.js +++ b/src/SmartComponents/Systems/SystemsListAssets.js @@ -266,11 +266,6 @@ const isRemediationDisabled = (row) => { ); }; -const isPatchSetRemovalDisabled = (row) => { - const { baseline_name: baselineName } = row || {}; - return !baselineName || (typeof baselineName === 'string' && baselineName === ''); -}; - export const useActivateRemediationModal = (setRemediationIssues, setRemediationOpen) => { const { fetchBatched } = useFetchBatched(); @@ -307,13 +302,7 @@ export const useActivateRemediationModal = (setRemediationIssues, setRemediation }, []); }; -export const systemsRowActions = ( - activateRemediationModal, - showTemplateAssignSystemsModal, - openUnassignSystemsModal, - row, - hasTemplateAccess, -) => [ +export const systemsRowActions = (activateRemediationModal, row) => [ { title: 'Apply all applicable advisories', isDisabled: isRemediationDisabled(row), @@ -321,22 +310,4 @@ export const systemsRowActions = ( activateRemediationModal(rowData); }, }, - ...(showTemplateAssignSystemsModal - ? [ - { - title: 'Assign to a template', - isDisabled: !hasTemplateAccess || row.satellite_managed, - onClick: (event, rowId, rowData) => { - showTemplateAssignSystemsModal({ [rowData.id]: true }); - }, - }, - { - title: 'Remove from a template', - isDisabled: !hasTemplateAccess || isPatchSetRemovalDisabled(row) || row.satellite_managed, - onClick: (event, rowId, rowData) => { - openUnassignSystemsModal([rowData.id]); - }, - }, - ] - : []), ]; diff --git a/src/SmartComponents/Systems/SystemsMainContent.js b/src/SmartComponents/Systems/SystemsMainContent.js index c06b99540..5b01a164c 100644 --- a/src/SmartComponents/Systems/SystemsMainContent.js +++ b/src/SmartComponents/Systems/SystemsMainContent.js @@ -3,11 +3,9 @@ import { Main } from '@redhat-cloud-services/frontend-components/Main'; import { useSelector, useDispatch } from 'react-redux'; import ErrorHandler from '../../PresentationalComponents/Snippets/ErrorHandler'; import { changeSystemsParams, clearInventoryReducer } from '../../store/Actions/Actions'; -import { usePatchSetState } from '../../Utilities/hooks'; import { decodeQueryparams } from '../../Utilities/Helpers'; import { useActivateRemediationModal } from './SystemsListAssets'; import SystemsStatusReport from '../../PresentationalComponents/StatusReports/SystemsStatusReport'; -import PatchSetWrapper from '../../PresentationalComponents/PatchSetWrapper/PatchSetWrapper'; import RemediationWizard from '../Remediation/RemediationWizard'; import SystemsTable from './SystemsTable'; import { useSearchParams } from 'react-router-dom'; @@ -19,7 +17,6 @@ const SystemsMainContent = () => { const decodedParams = decodeQueryparams('?' + searchParams.toString()); const [remediationIssues, setRemediationIssues] = useState([]); - const selectedRows = useSelector(({ entities }) => entities?.selectedRows || []); const { hasError, code } = useSelector(({ entities }) => entities?.status || {}); const metadata = useSelector(({ SystemsStore }) => SystemsStore?.metadata || {}); @@ -34,9 +31,6 @@ const SystemsMainContent = () => { return () => dispatch(clearInventoryReducer()); }, []); - const { patchSetState, setPatchSetState, openUnassignSystemsModal, openAssignSystemsModal } = - usePatchSetState(selectedRows); - const activateRemediationModal = useActivateRemediationModal( setRemediationIssues, setRemediationOpen, @@ -49,7 +43,6 @@ const SystemsMainContent = () => { return ( - {(isRemediationOpen && ( {
({ __esModule: true, - default: jest.fn( - ({ openAssignSystemsModal, openUnassignSystemsModal, activateRemediationModal, ...props }) => ( -
-
- ), - ), + default: jest.fn(({ activateRemediationModal, ...props }) => ( +
+
+ )), })); jest.mock('../../PresentationalComponents/Filters/OsVersionFilter'); diff --git a/src/SmartComponents/Systems/SystemsTable.js b/src/SmartComponents/Systems/SystemsTable.js index e86ee328e..6869d5efc 100644 --- a/src/SmartComponents/Systems/SystemsTable.js +++ b/src/SmartComponents/Systems/SystemsTable.js @@ -1,4 +1,4 @@ -import React, { Fragment, useEffect, useRef, useState } from 'react'; +import React, { Fragment, useRef, useState } from 'react'; import { TableVariant } from '@patternfly/react-table'; import { InventoryTable } from '@redhat-cloud-services/frontend-components/Inventory'; import { shallowEqual, useDispatch, useSelector, useStore } from 'react-redux'; @@ -29,17 +29,9 @@ import { mergeInventoryColumns, } from '../../Utilities/SystemsHelpers'; import { combineReducers } from 'redux'; -import { usePermissionsWithContext } from '@redhat-cloud-services/frontend-components-utilities/RBACHook'; import propTypes from 'prop-types'; -const SystemsTable = ({ - apply, - patchSetState, - openUnassignSystemsModal, - setSearchParams, - activateRemediationModal, - decodedParams, -}) => { +const SystemsTable = ({ apply, setSearchParams, activateRemediationModal, decodedParams }) => { const store = useStore(); const inventory = useRef(null); @@ -52,11 +44,6 @@ const SystemsTable = ({ const areAllSelected = useSelector(({ SystemsStore }) => SystemsStore?.areAllSelected); const queryParams = useSelector(({ SystemsStore }) => SystemsStore?.queryParams || {}); - const { hasAccess: hasTemplateAccess } = usePermissionsWithContext([ - 'patch:*:*', - 'patch:template:write', - ]); - const [appliedColumns, setAppliedColumns] = React.useState(SYSTEMS_LIST_COLUMNS); const [ColumnManagementModal, setColumnManagementModalOpen] = useColumnManagement( appliedColumns, @@ -110,15 +97,6 @@ const SystemsTable = ({ totalItems, }); - useEffect(() => { - if (patchSetState.shouldRefresh) { - onSelect('none'); - // timestamp is used to force inventory to refresh - // if it wasn't there inventory might ignore request to refresh because parameters are the same - inventory?.current?.onRefreshData({ timestamp: Date.now() }); - } - }, [patchSetState.shouldRefresh]); - const onExport = useOnExport( 'systems', queryParams, @@ -200,14 +178,7 @@ const SystemsTable = ({ }} getEntities={getEntities} tableProps={{ - actionResolver: (row) => - systemsRowActions( - activateRemediationModal, - false, - openUnassignSystemsModal, - row, - hasTemplateAccess, - ), + actionResolver: (row) => systemsRowActions(activateRemediationModal, row), canSelectAll: false, variant: TableVariant.compact, className: 'patchCompactInventory', @@ -243,8 +214,6 @@ const SystemsTable = ({ SystemsTable.propTypes = { apply: propTypes.func.isRequired, - patchSetState: propTypes.object.isRequired, - openUnassignSystemsModal: propTypes.func.isRequired, setSearchParams: propTypes.func.isRequired, activateRemediationModal: propTypes.func.isRequired, decodedParams: propTypes.func.isRequired, diff --git a/src/Utilities/DataMappers.js b/src/Utilities/DataMappers.js index 34e74dcdf..072ee5a58 100644 --- a/src/Utilities/DataMappers.js +++ b/src/Utilities/DataMappers.js @@ -203,10 +203,8 @@ export const createPackageSystemsRows = (rows, selectedRows = {}) => { osName: row.os?.osName || row.os || 'N/A', rhsm: row.rhsm, }, - baseline_name: row.baseline_name, // ToBeDeprecated template_name: row.template_name, template_uuid: row.template_uuid, - baseline_id: row.baseline_id, satellite_managed: row.satellite_managed, })); return data || []; diff --git a/src/Utilities/Helpers.js b/src/Utilities/Helpers.js index 82b98449d..1df7d3159 100644 --- a/src/Utilities/Helpers.js +++ b/src/Utilities/Helpers.js @@ -610,19 +610,6 @@ export const mapGlobalFilters = (tags, workloads = {}) => { return globalFilterConfig; }; -export const filterSelectedActiveSystemIDs = (selectedSystemsObject) => { - const formValueSystemIDs = []; - if (typeof selectedSystemsObject === 'object') { - Object.keys(selectedSystemsObject).forEach((key) => { - if (selectedSystemsObject[key]) { - formValueSystemIDs.push(key); - } - }); - } - - return formValueSystemIDs; -}; - export const isObject = (variable) => typeof variable === 'object' && variable !== null ? true : false; diff --git a/src/Utilities/hooks/index.js b/src/Utilities/hooks/index.js index 301bf3ad0..e2e0a66f6 100644 --- a/src/Utilities/hooks/index.js +++ b/src/Utilities/hooks/index.js @@ -1,6 +1,5 @@ export * from './Hooks'; export * from './useFeatureFlag'; export * from './useOnSelect'; -export * from './usePatchSetState'; export { useRemediationDataProvider } from './useRemediationDataProvider'; export * from './useFetchBatched'; diff --git a/src/Utilities/hooks/useOnSelect.js b/src/Utilities/hooks/useOnSelect.js index cd5d781d5..d0a6be02b 100644 --- a/src/Utilities/hooks/useOnSelect.js +++ b/src/Utilities/hooks/useOnSelect.js @@ -9,12 +9,10 @@ import isArray from 'lodash/isArray'; export const ID_API_ENDPOINTS = { advisories: '/ids/advisories', systems: '/ids/systems', - templates: '/baselines', advisorySystems: (advisoryID) => `/ids/advisories/${advisoryID}/systems`, systemAdvisories: (systemID) => `/ids/systems/${systemID}/advisories`, packageSystems: (packageName) => `/packages/${packageName}/systems`, systemPackages: (systemID) => `/systems/${systemID}/packages`, - templateSystems: (templateId) => `/ids/baselines/${templateId}/systems`, }; const isArrayWithData = (dataStructure) => isArray(dataStructure) && dataStructure.length; diff --git a/src/Utilities/hooks/usePatchSetState.js b/src/Utilities/hooks/usePatchSetState.js deleted file mode 100644 index 295f7ebb4..000000000 --- a/src/Utilities/hooks/usePatchSetState.js +++ /dev/null @@ -1,57 +0,0 @@ -import { useState } from 'react'; -import { filterSelectedActiveSystemIDs } from '../Helpers'; - -/** - * Manages unified state for patch set wizard and unassign modal. - * @param {Object} [selectedRows] selected rows object to be removed. - * @returns {patchSetState, setPatchSetState, openPatchSetAssignWizard, openUnassignSystemsModal, openPatchSetEditModal} - */ -export const usePatchSetState = (selectedRows) => { - const [patchSetState, setPatchSetState] = useState({ - isPatchSetWizardOpen: false, - isUnassignSystemsModalOpen: false, - isAssignSystemsModalOpen: false, - shouldRefresh: false, - systemsIDs: {}, - }); - - const openPatchSetAssignWizard = (systemID) => { - setPatchSetState({ - isPatchSetWizardOpen: true, - systemsIDs: - typeof systemID === 'string' && systemID !== '' - ? [systemID] - : filterSelectedActiveSystemIDs(selectedRows), - shouldRefresh: false, - }); - }; - - const openUnassignSystemsModal = (systemsIDs) => { - setPatchSetState({ - isUnassignSystemsModalOpen: true, - systemsIDs, - shouldRefresh: false, - }); - }; - - const openAssignSystemsModal = (systemsIDs) => { - setPatchSetState({ - isAssignSystemsModalOpen: true, - systemsIDs, - shouldRefresh: false, - }); - }; - - const openPatchSetEditModal = (patchSetID) => { - setPatchSetState({ isPatchSetWizardOpen: true, patchSetID }); - }; - - return { - patchSetState, - setPatchSetState, - openPatchSetAssignWizard, - openUnassignSystemsModal, - openAssignSystemsModal, - openPatchSetEditModal, - }; -}; diff --git a/src/store/ActionTypes.js b/src/store/ActionTypes.js index a99ecd38c..2b365b064 100644 --- a/src/store/ActionTypes.js +++ b/src/store/ActionTypes.js @@ -39,6 +39,4 @@ export const CHANGE_PROFILE = 'CHANGE_PROFILE'; export const CHANGE_GLOBAL_TAGS = 'CHANGE_GLOBAL_TAGS'; export const CHANGE_WORKLOADS = 'CHANGE_WORKLOADS'; -export const CLEAR_PATCH_SET_DETAIL_SYSTEMS = 'CLEAR_PATCH_SET_DETAIL_SYSTEMS'; - export const TOGGLE_ALL_SELECTED = 'TOGGLE_ALL_SELECTED'; diff --git a/src/store/Actions/Actions.js b/src/store/Actions/Actions.js index 0bf22f6e9..da8d0cb07 100644 --- a/src/store/Actions/Actions.js +++ b/src/store/Actions/Actions.js @@ -216,11 +216,6 @@ export const changeSystemsMetadata = (params) => ({ payload: params, }); -export const clearPatchSetDetailsSystems = () => ({ - type: ActionTypes.CLEAR_PATCH_SET_DETAIL_SYSTEMS, - payload: [], -}); - export const toggleAllSelectedAction = (state) => ({ type: ActionTypes.TOGGLE_ALL_SELECTED, payload: state, diff --git a/src/store/Reducers/SystemDetailStore.js b/src/store/Reducers/SystemDetailStore.js index e6a7cf2c8..f178359f4 100644 --- a/src/store/Reducers/SystemDetailStore.js +++ b/src/store/Reducers/SystemDetailStore.js @@ -10,8 +10,6 @@ export const SystemDetailStore = (state = initialState, { type, payload }) => { ...state, hasThirdPartyRepo: payload.data?.attributes.third_party, satelliteManaged: payload.data?.attributes.satellite_managed, - patchSetName: payload.data?.attributes.baseline_name, - patchSetId: payload.data?.attributes.baseline_id, templateName: payload.data?.attributes.template_name, templateUUID: payload.data?.attributes.template_uuid, };