From eee1f78d27131948746d3d1a55aa60895392d4fd Mon Sep 17 00:00:00 2001 From: regexowl Date: Thu, 7 Aug 2025 11:44:09 +0200 Subject: [PATCH] Wizard: Fix lint warnings and snapshot button behaviour This fixes lint warnings for Review step and updates behaviour of the snapshot button. The button for reviewing repeatable build was permanently disabled, now it should be disabled only when there are no snapshotable repositories selected. The content of snapshot popover has updated rendering of states. --- .../steps/Review/ReviewStepTables.tsx | 14 ++++++++------ .../steps/Review/ReviewStepTextLists.tsx | 17 ++++++++--------- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/src/Components/CreateImageWizard/steps/Review/ReviewStepTables.tsx b/src/Components/CreateImageWizard/steps/Review/ReviewStepTables.tsx index d7211413..431cc9ff 100644 --- a/src/Components/CreateImageWizard/steps/Review/ReviewStepTables.tsx +++ b/src/Components/CreateImageWizard/steps/Review/ReviewStepTables.tsx @@ -159,10 +159,12 @@ export const SnapshotTable = ({ .padStart(2, '0')}/${date.getFullYear()}`; }; - return ( - (isError && ) || - (isLoading && ) || - (isSuccess && ( + if (isError) return ; + + if (isLoading) return ; + + if (isSuccess) { + return ( @@ -200,8 +202,8 @@ export const SnapshotTable = ({
- )) - ); + ); + } }; export const PackagesTable = () => { diff --git a/src/Components/CreateImageWizard/steps/Review/ReviewStepTextLists.tsx b/src/Components/CreateImageWizard/steps/Review/ReviewStepTextLists.tsx index a7720778..3665f3c7 100644 --- a/src/Components/CreateImageWizard/steps/Review/ReviewStepTextLists.tsx +++ b/src/Components/CreateImageWizard/steps/Review/ReviewStepTextLists.tsx @@ -448,7 +448,7 @@ export const ContentList = () => { [customRepositories, recommendedRepositories], ); - const [listSnapshotsByDate, { data, isSuccess, isLoading, isError }] = + const [listSnapshotsByDate, { data, isSuccess, isLoading }] = useListSnapshotsByDateMutation(); useEffect(() => { @@ -536,8 +536,7 @@ export const ContentList = () => { isInline aria-label='Snapshot method' className='popover-button pf-v6-u-p-0' - isDisabled={noRepositoriesSelected || isLoading || isError} - isLoading={isLoading} + isDisabled={noRepositoriesSelected} > {snapshottingText} @@ -558,7 +557,7 @@ export const ContentList = () => { Custom repositories - {customRepositories?.length + recommendedRepositories.length > 0 ? ( + {customRepositories.length + recommendedRepositories.length > 0 ? ( { aria-label='About custom repositories' className='popover-button pf-v6-u-p-0' > - {customRepositories?.length + - recommendedRepositories.length || 0} + {customRepositories.length + recommendedRepositories.length || + 0} ) : ( @@ -583,7 +582,7 @@ export const ContentList = () => { Additional packages - {packages?.length > 0 || groups?.length > 0 ? ( + {packages.length > 0 || groups.length > 0 ? ( { aria-label='About packages' className='popover-button pf-v6-u-p-0' > - {packages?.length + groups?.length} + {packages.length + groups.length} ) : ( @@ -671,7 +670,7 @@ export const RegisterNowList = () => { data-testid='review-registration' > - {registrationType?.startsWith('register-now') && ( + {registrationType.startsWith('register-now') && ( Register with Red Hat Subscription Manager (RHSM)