Skip to content

Commit

Permalink
ui: rename the run button
Browse files Browse the repository at this point in the history
  • Loading branch information
anikachurilova committed Feb 7, 2025
1 parent 662e4b8 commit 57a7df7
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 9 deletions.
2 changes: 1 addition & 1 deletion invenio_jobs/administration/jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class JobsAdminMixin:
"icon": "calendar",
},
"runs": {
"text": "Run now",
"text": "Configure and run...",
"payload_schema": RunSchema,
"order": 2,
"icon": "play",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,20 @@ export class RunActionForm extends Component {
const jsonData = JSON.parse(resource.default_args);
const { activeIndex } = this.state;
return (
<>
<Formik initialValues={formData} onSubmit={onSubmit}>
{(props) => (
<Formik initialValues={formData} onSubmit={onSubmit}>
{(props) => {
const actions_errors = props?.errors
const args = props?.values?.args;
let cleanedArgs = undefined;
if (args) {
cleanedArgs = Object.fromEntries(
Object.entries(args).map(([key, value]) => [key, value === "" ? null : value])
);

props.values.args = cleanedArgs
}

return (
<>
<Modal.Content>
<SemanticForm
Expand Down Expand Up @@ -128,8 +139,8 @@ export class RunActionForm extends Component {
<Divider />
<Message info>
<Trans>
<b>Custom args:</b> when provided, the input below will
override any arguments specified above.
<b>Custom args:</b> when provided, the input below
will override any arguments specified above.
</Trans>
</Message>
<TextArea
Expand All @@ -151,6 +162,11 @@ export class RunActionForm extends Component {
{!isEmpty(error) && (
<ErrorMessage
{...error}
content={
actions_errors && Object.keys(actions_errors).length > 0
? Object.values(actions_errors)[0]
: error.content
}
removeNotification={this.resetErrorState}
/>
)}
Expand All @@ -174,9 +190,9 @@ export class RunActionForm extends Component {
/>
</Modal.Actions>
</>
)}
</Formik>
</>
);
}}
</Formik>
);
}
}
Expand Down

0 comments on commit 57a7df7

Please sign in to comment.