Skip to content

Commit

Permalink
Rename buttons and fix processing state
Browse files Browse the repository at this point in the history
  • Loading branch information
kimlisa committed Jan 7, 2025
1 parent 872d829 commit 1c33122
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ export default function Container(props: AgentStepProps) {
setClusterName={setClusterName}
labels={labels}
onChangeLabels={setLabels}
processing={true}
/>
<ActionButtons
onProceed={() => null}
Expand Down Expand Up @@ -197,7 +198,7 @@ export function HelmChart(
<Heading />
<StepOne />
<StepTwo
disabled={true}
showHelmChart={true}
onEdit={() => props.onEdit()}
generateScript={reloadJoinToken}
namespace={props.namespace}
Expand Down Expand Up @@ -268,22 +269,26 @@ const StepTwo = ({
setClusterName,
error,
generateScript,
disabled,
showHelmChart,
onEdit,
labels,
onChangeLabels,
processing,
}: {
error?: Error;
generateScript?(): void;
namespace: string;
setNamespace(n: string): void;
clusterName: string;
setClusterName(c: string): void;
disabled?: boolean;
showHelmChart?: boolean;
processing?: boolean;
onEdit: () => void;
labels: ResourceLabel[];
onChangeLabels(l: ResourceLabel[]): void;
}) => {
const disabled = showHelmChart || processing;

function handleSubmit(
inputFieldValidator: Validator,
labelsValidator: Validator
Expand Down Expand Up @@ -343,11 +348,11 @@ const StepTwo = ({
labels={labels}
setLabels={onChangeLabels}
isLabelOptional={true}
disableBtns={disabled}
disableBtns={showHelmChart}
noDuplicateKey={true}
/>
</Box>
{disabled ? (
{showHelmChart ? (
<ButtonSecondary
width="200px"
type="submit"
Expand All @@ -362,8 +367,9 @@ const StepTwo = ({
onClick={() =>
handleSubmit(inputFieldValidator, labelsValidator)
}
disabled={processing}
>
Next
Generate command
</ButtonSecondary>
)}
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,9 @@ export function StepOne({
processing?: boolean;
onPrev(): void;
}) {
const nextLabelTxt = labels.length
? 'Finish adding labels'
: 'Skip adding labels';
return (
<>
<StyledBox mb={5}>
Expand Down Expand Up @@ -168,7 +171,7 @@ export function StepOne({
onClick={() => onShowScript(validator)}
disabled={processing}
>
{showScript && !error ? 'Edit Labels' : 'Next'}
{showScript && !error ? 'Edit Labels' : nextLabelTxt}
</ButtonSecondary>
</Box>
</>
Expand Down

0 comments on commit 1c33122

Please sign in to comment.