diff --git a/locales/en/plugin__odf-console.json b/locales/en/plugin__odf-console.json index 501a48d05..751dcee35 100644 --- a/locales/en/plugin__odf-console.json +++ b/locales/en/plugin__odf-console.json @@ -76,6 +76,8 @@ "You have selected {{count}} namespaces, to view or change your selection go back to the previous step._other": "You have selected {{count}} namespaces, to view or change your selection go back to the previous step.", "Secure selected namespace by defining resource label expressions.": "Secure selected namespace by defining resource label expressions.", "Resource label": "Resource label", + "Secure namespaces as per Recipe definition.": "Secure namespaces as per Recipe definition.", + "Recipe": "Recipe", "Recipe list": "Recipe list", "Only recipes of the selected namespaces will appear in the list.": "Only recipes of the selected namespaces will appear in the list.", "Select a recipe": "Select a recipe", @@ -124,7 +126,6 @@ "Name:": "Name:", "Configuration": "Configuration", "Type:": "Type:", - "Recipe": "Recipe", "Recipe name:": "Recipe name:", "Recipe namespace:": "Recipe namespace:", "Label expressions:": "Label expressions:", diff --git a/packages/mco/components/discovered-application-wizard/enroll-discovered-application.spec.tsx b/packages/mco/components/discovered-application-wizard/enroll-discovered-application.spec.tsx index 87972ced0..1e0d64708 100644 --- a/packages/mco/components/discovered-application-wizard/enroll-discovered-application.spec.tsx +++ b/packages/mco/components/discovered-application-wizard/enroll-discovered-application.spec.tsx @@ -288,12 +288,11 @@ const moveToStep = async (step: number) => { fireEvent.click(screen.getByText('Next')); } - // Commented out recipe-based steps if (step > 2) { // Select recipe - // fireEvent.click(screen.getByText('Recipe')); - // fireEvent.click(screen.getByText('Select a recipe')); - // fireEvent.click(screen.getByText('mock-recipe-1')); + fireEvent.click(screen.getByText('Recipe')); + fireEvent.click(screen.getByText('Select a recipe')); + fireEvent.click(screen.getByText('mock-recipe-1')); // Next wizard step fireEvent.click(screen.getByText('Next')); @@ -441,10 +440,7 @@ describe('Test namespace step', () => { }); }); -// The Recipe-bsaed dr protection is in Dev Preview for ODF 4.16. -// All Recipe-based test cases are skipped. -// https://bugzilla.redhat.com/show_bug.cgi?id=2291301 -describe.skip('Test configure step', () => { +describe('Test configure step', () => { beforeEach(() => { render(); }); @@ -476,7 +472,7 @@ describe.skip('Test configure step', () => { // Recipe selection fireEvent.click(screen.getByText('Recipe')); - expect(screen.getByText('Recipe list')).toBeInTheDocument(); + /*expect(screen.getByText('Recipe list')).toBeInTheDocument(); expect( screen.getByText( 'Only recipes of the selected namespaces will appear in the list.' @@ -506,11 +502,11 @@ describe.skip('Test configure step', () => { expect(screen.getByText('namespace-2')).toBeInTheDocument(); fireEvent.click(screen.getByText('mock-recipe-1')); // Ensure recipe selection - expect(screen.getByText('mock-recipe-1')).toBeInTheDocument(); + expect(screen.getByText('mock-recipe-1')).toBeInTheDocument();*/ }); }); -describe.skip('Test replication step', () => { +describe('Test replication step', () => { beforeEach(() => { render(); }); @@ -576,7 +572,7 @@ describe.skip('Test replication step', () => { expect(screen.getByText('days')).toBeInTheDocument(); }); }); -describe.skip('Test review step', () => { +describe('Test review step', () => { beforeEach(() => { render(); }); diff --git a/packages/mco/components/discovered-application-wizard/wizard-steps/configuration-step/configuration-step.tsx b/packages/mco/components/discovered-application-wizard/wizard-steps/configuration-step/configuration-step.tsx index da78d9ee1..2d74bb249 100644 --- a/packages/mco/components/discovered-application-wizard/wizard-steps/configuration-step/configuration-step.tsx +++ b/packages/mco/components/discovered-application-wizard/wizard-steps/configuration-step/configuration-step.tsx @@ -76,14 +76,11 @@ export const Configuration: React.FC = ({ onChange={(event, _unUsed) => setProtectionMethod(_unUsed, event) } - checked={ + isChecked={ protectionMethod === ProtectionMethodType.RESOURCE_LABEL } /> - {/* The Recipe-bsaed dr protection is in Dev Preview for ODF 4.16. - https://bugzilla.redhat.com/show_bug.cgi?id=2291301 - = ({ onChange={(event, _unUsed) => setProtectionMethod(_unUsed, event) } - checked={protectionMethod === ProtectionMethodType.RECIPE} + isChecked={protectionMethod === ProtectionMethodType.RECIPE} /> - */} + {protectionMethod === ProtectionMethodType.RECIPE && ( diff --git a/packages/mco/components/modals/app-manage-policies/helper/pvc-details-wizard-content.tsx b/packages/mco/components/modals/app-manage-policies/helper/pvc-details-wizard-content.tsx index 27f3a890b..f99eb190b 100644 --- a/packages/mco/components/modals/app-manage-policies/helper/pvc-details-wizard-content.tsx +++ b/packages/mco/components/modals/app-manage-policies/helper/pvc-details-wizard-content.tsx @@ -28,7 +28,6 @@ import { Button, Form, FormGroup, - Text, Grid, GridItem, Popover, @@ -295,23 +294,23 @@ export const PVCDetailsWizardContent: React.FC = return (
- + {t( 'Use PVC label selectors to effortlessly specify the application resources that need protection. You can also create a custom PVC label selector if one doesn’t exists. For more information, ' )} - + + - - + {t('see PVC label selector requirements.')} + + {loaded && !error ? ( { const selectableRows = - sortedRows?.filter(isRowSelectable || hasNoDeletionTimestamp) || []; + sortedRows?.filter((selectedRow) => + !!isRowSelectable + ? isRowSelectable(selectedRow) + : true && hasNoDeletionTimestamp(selectedRow) + ) || []; const rowIds = new Set(selectableRows?.map(getUID)); return [selectableRows, rowIds]; }, [sortedRows, isRowSelectable]); @@ -152,7 +156,7 @@ export const SelectableTable: SelectableTableProps = < onSelect: onSelect, isSelected: isRowSelected(getUID(row), selectedRows), isDisabled: - !isRowSelectable?.(row) || + (!!isRowSelectable && !isRowSelectable?.(row)) || !hasNoDeletionTimestamp(row), props: { id: getUID(row), diff --git a/packages/shared/src/utils/AsyncLoader.tsx b/packages/shared/src/utils/AsyncLoader.tsx index 77d39e51d..918f457aa 100644 --- a/packages/shared/src/utils/AsyncLoader.tsx +++ b/packages/shared/src/utils/AsyncLoader.tsx @@ -47,13 +47,18 @@ const useAsynchronousLoading: UseAsynchronousLoading = ( const Component = React.useRef(null); const [loadingStarted, setLoadingStarted] = React.useState(false); const [loaded, setLoaded] = React.useState(false); + // Mount status for safty state updates + const mounted = React.useRef(true); + React.useEffect(() => () => (mounted.current = false), []); const prevLoader = React.useRef(null); const setComponent = React.useCallback( (value) => { Component.current = value; - setLoaded(true); + if (mounted.current) { + setLoaded(true); + } }, [Component] );