Skip to content

Commit 1beb8b9

Browse files
fix(ui): Fix secrets component in batch prediction job creation page (#632)
# Description This PR fixes a bug with the new UI changes introduced in PR #627, whereby attempting to redeploy a batch job in a terminal state (succeeded or failed) that does not have any user secrets configured (`nil`) will cause the UI to crash. This PR fixes this bug by setting the default value of the `secrets` field to be `[]` by default. Another minor change in this PR is also made to remove the redundant `textwrap` option (this is not recognised and does nothing) that had been accidentally introduced in the same PR quoted above. # Modifications - `ui/src/pages/job/form/components/SecretsForm.js` - Removal of `textwrap` option - `ui/src/pages/version/components/forms/components/SecretsPanel.js` - Removal of `textwrap` option - `ui/src/services/job/Job.js` - Addition of steps to ensure the `secrets` field gets intialised as `[]` by default # Tests <!-- Besides the existing / updated automated tests, what specific scenarios should be tested? Consider the backward compatibility of the changes, whether corner cases are covered, etc. Please describe the tests and check the ones that have been completed. Eg: - [x] Deploying new and existing standard models - [ ] Deploying PyFunc models --> # Checklist - [x] Added PR label - [ ] Added unit test, integration, and/or e2e tests - [x] Tested locally - [ ] Updated documentation - [ ] Update Swagger spec if the PR introduce API changes - [ ] Regenerated Golang and Python client if the PR introduces API changes # Release Notes <!-- Does this PR introduce a user-facing change? If no, just write "NONE" in the release-note block below. If yes, a release note is required. Enter your extended release note in the block below. If the PR requires additional action from users switching to the new release, include the string "action required". For more information about release notes, see kubernetes' guide here: http://git.k8s.io/community/contributors/guide/release-notes.md --> ```release-note NONE ```
1 parent f947226 commit 1beb8b9

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

ui/src/pages/job/form/components/SecretsForm.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ export const SecretsForm = ({ variables, onChange }) => {
9191
options.push({
9292
value: secret.name,
9393
inputDisplay: secret.name,
94-
textWrap: "truncate",
9594
});
9695
});
9796
setOptions(options);

ui/src/pages/version/components/forms/components/SecretsPanel.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ export const SecretsPanel = ({
3030
options.push({
3131
value: secret.name,
3232
inputDisplay: secret.name,
33-
textwrap: "truncate"
3433
});
3534
});
3635
setOptions(options);

ui/src/services/job/Job.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ export class Job {
3939

4040
env_vars: [],
4141

42+
secrets: [],
43+
4244
job_config: {
4345
model: {
4446
type: "",
@@ -88,6 +90,10 @@ export class Job {
8890
json.config.env_vars = [];
8991
}
9092

93+
if (!json.config.secrets) {
94+
json.config.secrets = [];
95+
}
96+
9197
return objectAssignDeep(new Job(), json);
9298
}
9399
}

0 commit comments

Comments
 (0)