-
Notifications
You must be signed in to change notification settings - Fork 350
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
Validate pipeline form dialogs #684
Validate pipeline form dialogs #684
Conversation
I like this as a POC, but if we're going to add this functionality I'd rather we "wrap" showDialog in our own "utility" function that can handle this validation more generally based on supplied params. |
Can we also make sure Submit dialog does not have the same problem. |
i may be misunderstanding what you are asking, but we can't "wrap" what could perhaps be done is take the approach used here and create a more generic function that is reusable by some of the other dialogs prompts in Elyra (and would replace using JupyterLab's default would you know if this is a functionality JupyterLab would welcome? in which case it be added to JupyterLab's Dialog instead. |
Sorry for the poor clarity, this is exactly what I meant
This is a good question, we should ask, this would be cleaner if done in lab. |
As per conversation with @vabarbosa we came up with a generic
/*
* Validate required form dialog fields upon display
*
* options - The dialog setup options
* formValidationFunc - Optional validation function passed by the caller to provide their own logic
*
*/
async showFormDialog(options, formValidationFunc) {
const dialogBody = options.body;
const dialog = new Dialog(options);
if (formValidationFunc && typeof formValidationFunc === 'function') {
// pass dialog widget to the caller for more specific logic and other dialog behaviors,
// such as being able to disable other buttons that aren't the default one
formValidationFunc(dialog);
} else {
// expect required fields to contain attribute: data-elyra-required
const requiredFields = dialogBody.node.querySelectorAll('[data-elyra-required]');
if (requiredFields.length > 0) {
// disable defaultButton as default
// add appropriate change event listener to each required field
// that enables the defaultButton when field is populated
}
}
return dialog.launch();
} How would others feel about this approach? |
@karlaspuldaro that approach looks great to me, looking forward to seeing the detailed implementation |
Co-authored by: va barbosa <vabarbosa@users.noreply.github.com>
Maybe don't use 'elyra |
Apply to export pipeline dialog
938661f
to
e10b450
Compare
NOTE: The Dialog widget will skip any validation upon pressing 'enter' key (needs to resolve in lab) The generic validation implemented only checks if all required fields are populated. In the case of pipeline |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good. nice work. i just added a couple small comments
for this i think you can listen to the |
Co-authored by: va barbosa <vabarbosa@users.noreply.github.com>
make formValidationFunction optional define types fix button className to be defined once
I'll be taking a look at this later today |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple of clarifying questions, but LGTM
Fixes #658
Exporting or submitting a pipeline now requires the user to populate all required form fields.

Required fields in dialog body should contain attribute
data-form-required
.While no selection is made or required inputs are empty, the OK button remains disabled.
Developer's Certificate of Origin 1.1