Skip to content

Commit

Permalink
Don't show error at init in add source (#36)
Browse files Browse the repository at this point in the history
This PR impoves the add source modal to not show error at init phase.

Signed-off-by: Ondra Machacek <[email protected]>
  • Loading branch information
machacekondra authored Nov 7, 2024
1 parent 18a44a3 commit d344804
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export const DiscoverySourceSetupModal: React.FC<DiscoverySourceSetupModalProps>
const { isOpen = false, isDisabled = false, onClose, onSubmit } = props;

const [sshKey, setSshKey] = useState("");
const [isSshKeyValid, setIsSshKeyValid] = useState(false);
const [isSshKeyValid, setIsSshKeyValid] = useState<true | false | undefined>(undefined);
const [sshKeyErrorMessage, setSshKeyErrorMessage] = useState("");

// Validate SSH key when it changes
Expand Down Expand Up @@ -136,7 +136,7 @@ export const DiscoverySourceSetupModal: React.FC<DiscoverySourceSetupModalProps>
aria-describedby="sshkey-helper-text"
value={sshKey}
onChange={(value) => handleSshKeyChange(value)}
validated={isSshKeyValid ? "success" : "error"}
validated={isSshKeyValid === undefined ? "default" : isSshKeyValid ? "success" : "error"}
/>
{!isSshKeyValid && (
<FormHelperText>
Expand Down

0 comments on commit d344804

Please sign in to comment.