Skip to content

Commit

Permalink
fix(custom-targets): lock form Create button until successful test (#…
Browse files Browse the repository at this point in the history
…1262)

* fix(custom-targets): handle case where response does not include data or reason fields

* fix(custom-targets): lock form Create button until successful test
  • Loading branch information
andrewazores authored May 31, 2024
1 parent c133e6e commit 759e8ae
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/app/Topology/Actions/CreateTarget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -185,9 +185,10 @@ export const CreateTarget: React.FC<CreateTargetProps> = ({ prefilled }) => {
if (option === ValidatedOptions.success) {
exitForm();
} else {
let errorMessage = (body as any)?.data?.reason || 'Connection test failure';
setValidation({
option: option,
errorMessage: body['data']['reason'],
errorMessage,
});
}
}),
Expand Down Expand Up @@ -408,7 +409,7 @@ export const CreateTarget: React.FC<CreateTargetProps> = ({ prefilled }) => {
<ActionGroup>
<Button
variant="primary"
isDisabled={!connectUrl || validConnectUrl !== ValidatedOptions.success || loading || testing}
isDisabled={validation.option !== ValidatedOptions.success}
onClick={handleSubmit}
{...createButtonLoadingProps}
data-quickstart-id="ct-create-btn"
Expand Down

0 comments on commit 759e8ae

Please sign in to comment.