Skip to content

Commit 746ff92

Browse files
committed
fixup Next button on first wizard step
1 parent 8b6fe91 commit 746ff92

1 file changed

Lines changed: 31 additions & 24 deletions

File tree

src/openshift/actions/DeploymentLabelAction/DeploymentLabelActionModal.tsx

Lines changed: 31 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import {
3232
WizardStep,
3333
WizardHeader,
3434
WizardFooterWrapper,
35+
useWizardContext,
3536
ValidatedOptions,
3637
} from '@patternfly/react-core';
3738
import * as React from 'react';
@@ -575,6 +576,35 @@ export const DeploymentLabelActionModal: React.FC<CryostatModalProps> = ({ kind,
575576
const selectedInstance = formData.cryostatInstance !== EMPTY_VALUE ? cryostats[formData.cryostatInstance] : null;
576577
const selectedContainer = containers[formData.selectedContainerIndex] || null;
577578

579+
const InstanceSelectionFooter = () => {
580+
const { goToNextStep } = useWizardContext();
581+
582+
return (
583+
<WizardFooterWrapper>
584+
<Button
585+
variant="primary"
586+
onClick={handleQuickRegister}
587+
isDisabled={
588+
!(
589+
(formSelectValue === EMPTY_VALUE && initialValue !== EMPTY_VALUE) ||
590+
(formSelectValue !== EMPTY_VALUE && !isDisabled)
591+
)
592+
}
593+
>
594+
{formSelectValue === EMPTY_VALUE && initialValue !== EMPTY_VALUE
595+
? t('DEPLOYMENT_ACTION_DEREGISTER')
596+
: t('DEPLOYMENT_ACTION_QUICK_REGISTER')}
597+
</Button>
598+
<Button variant="secondary" onClick={goToNextStep} isDisabled={formSelectValue === EMPTY_VALUE || isDisabled}>
599+
{t('NEXT')}
600+
</Button>
601+
<Button variant="link" onClick={closeModal}>
602+
{t('CANCEL')}
603+
</Button>
604+
</WizardFooterWrapper>
605+
);
606+
};
607+
578608
return (
579609
<Modal
580610
variant={ModalVariant.large}
@@ -593,30 +623,7 @@ export const DeploymentLabelActionModal: React.FC<CryostatModalProps> = ({ kind,
593623
<WizardStep
594624
id="instance-selection"
595625
name={t('DEPLOYMENT_ACTION_WIZARD_STEP_INSTANCE')}
596-
footer={
597-
<WizardFooterWrapper>
598-
<Button
599-
variant="primary"
600-
onClick={handleQuickRegister}
601-
isDisabled={
602-
!(
603-
(formSelectValue === EMPTY_VALUE && initialValue !== EMPTY_VALUE) ||
604-
(formSelectValue !== EMPTY_VALUE && !isDisabled)
605-
)
606-
}
607-
>
608-
{formSelectValue === EMPTY_VALUE && initialValue !== EMPTY_VALUE
609-
? t('DEPLOYMENT_ACTION_DEREGISTER')
610-
: t('DEPLOYMENT_ACTION_QUICK_REGISTER')}
611-
</Button>
612-
<Button variant="secondary" type="submit" isDisabled={formSelectValue === EMPTY_VALUE || isDisabled}>
613-
{t('NEXT')}
614-
</Button>
615-
<Button variant="link" onClick={closeModal}>
616-
{t('CANCEL')}
617-
</Button>
618-
</WizardFooterWrapper>
619-
}
626+
footer={<InstanceSelectionFooter />}
620627
>
621628
<InstanceSelectionStep
622629
cryostats={cryostats}

0 commit comments

Comments
 (0)