Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ui: rename the run button #68

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion invenio_jobs/administration/jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ class JobsAdminMixin:
"icon": "calendar",
},
"runs": {
"text": "Run now",
"text": "Configure and run",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"text": "Configure and run",
"text": "Configure run",

"modal_text": "Run now",
"payload_schema": RunSchema,
"order": 2,
"icon": "play",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export class JobActions extends Component {
labelPosition={labelPos}
>
{!_isEmpty(icon) && <Icon name={icon} />}
{actionConfig.text}
{actionConfig.text}...
</Element>
);
})}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,10 @@ 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
return (
<>
<Modal.Content>
<SemanticForm
Expand Down Expand Up @@ -128,8 +129,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 +152,11 @@ export class RunActionForm extends Component {
{!isEmpty(error) && (
<ErrorMessage
{...error}
content={
actions_errors && Object.keys(actions_errors).length > 0
Copy link
Member Author

@anikachurilova anikachurilova Feb 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added this in order to be able to display the exact error message of a marshmallow validation in the UI. The info is already there, just need to display it on the page now. Here is where it gets populated: https://github.com/inveniosoftware/invenio-administration/blob/main/invenio_administration/assets/semantic-ui/js/invenio_administration/src/formik/ActionForm.js#L119

Before:
Screenshot 2025-02-07 at 16 25 52

After:
Screenshot 2025-02-07 at 16 25 09

? Object.values(actions_errors)[0]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to have more than one error ? Would it make sense to display all of them?

: error.content
}
removeNotification={this.resetErrorState}
/>
)}
Expand All @@ -163,7 +169,7 @@ export class RunActionForm extends Component {
form="action-form"
loading={loading}
>
{i18next.t(actionConfig.text)}
{i18next.t(actionConfig.modal_text) || i18next.t(actionConfig.text)}
</Button>
<Button
onClick={actionCancelCallback}
Expand All @@ -174,9 +180,9 @@ export class RunActionForm extends Component {
/>
</Modal.Actions>
</>
)}
</Formik>
</>
);
}}
</Formik>
);
}
}
Expand Down
Loading