Skip to content

Commit

Permalink
Fix env variable input field issues on Notebook controller spawner
Browse files Browse the repository at this point in the history
  • Loading branch information
DaoDaoNoCode committed Aug 30, 2024
1 parent 484b27f commit d6883a6
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,12 @@ const SpawnerPage: React.FC = () => {
});

const disableSubmit =
createInProgress || variableRows.some(({ errors }) => Object.keys(errors).length > 0);
createInProgress ||
variableRows.some(
({ errors, variables }) =>
Object.keys(errors).length > 0 ||
variables.find((variable) => !variable.name || variable.name === EMPTY_KEY),
);

React.useEffect(() => {
const setFirstValidImage = () => {
Expand Down Expand Up @@ -217,7 +222,7 @@ const SpawnerPage: React.FC = () => {
}
}
updatedRow.variables.forEach((variable) => {
if (!ENV_VAR_NAME_REGEX.test(variable.name)) {
if (variable.name && variable.name !== EMPTY_KEY && !ENV_VAR_NAME_REGEX.test(variable.name)) {
updatedRows[index].errors[variable.name] =
"Invalid variable name. The name must consist of alphabetic characters, digits, '_', '-', or '.', and must not start with a digit.";
}
Expand Down

0 comments on commit d6883a6

Please sign in to comment.