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

Add error message on attempt to create circular references #744

Merged
merged 10 commits into from Jul 24, 2020
Merged

Add error message on attempt to create circular references #744

merged 10 commits into from Jul 24, 2020

Conversation

marthacryan
Copy link
Member

@marthacryan marthacryan commented Jul 9, 2020

Fixes #256 and #660. Adds an error message that appears when users try to create circular references. The error message is structured to provide flexibility for future validation needs - from PipelineEditor, use this.setState({ showValidationError: true, errorMessage: 'YOUR ERROR MESSAGE' }) to open the error message.
errorpipeline

Notes

  • Should it close on it's own after a certain timeout? How long?
  • This will need to be revisited when the canvas version is updated because there is a handler that allows you to check edits before they're added to the canvas, which would be a cleaner way of doing this.

Developer's Certificate of Origin 1.1

   By making a contribution to this project, I certify that:

   (a) The contribution was created in whole or in part by me and I
       have the right to submit it under the Apache License 2.0; or

   (b) The contribution is based upon previous work that, to the best
       of my knowledge, is covered under an appropriate open source
       license and I have the right under that license to submit that
       work with modifications, whether created in whole or in part
       by me, under the same open source license (unless I am
       permitted to submit under a different license), as indicated
       in the file; or

   (c) The contribution was provided directly to me by some other
       person who certified (a), (b) or (c) and I have not modified
       it.

   (d) I understand and agree that this project and the contribution
       are public and that a record of the contribution (including all
       personal information I submit with it, including my sign-off) is
       maintained indefinitely and may be redistributed consistent with
       this project or the open source license(s) involved.

Copy link
Member

@ajbozarth ajbozarth left a comment

Choose a reason for hiding this comment

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

A couple initial code comments, I'll be finding time to test this locally and do a more though code review soon

Copy link
Member

@kevin-bates kevin-bates left a comment

Choose a reason for hiding this comment

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

I can't really comment on the UI changes, but think this is really great and elegantly done - nice work.

As for the error message timeout, I think forcing the user to dismiss is correct, but will also defer to the UX experts on that. Is the reason we don't just pop up a dialog because that isn't the "canvas way" in this particular scenario?

@vabarbosa
Copy link
Contributor

@marthacryan i like this, a couple comments:

  • on the idea of flexibility for future validation needs, should it be possible to allow the caller to specify an optional severity level (e.g., info, warning, etc) and if none is provided it defaults to error?
    this.setState({ showValidationError: true, errorMessage: 'YOUR ERROR MESSAGE', severity: 'error' })
    
  • forcing the user to dismiss the alert is a good idea, but in conjunction to that i would also suggest if the user does not dismiss the alert but adds a new valid link or adds a new node to the canvas, i think the alert should at that point go away.

marthacryan and others added 3 commits July 14, 2020 09:05
Allows for using different types of message 'severity', i.e.
error, warning, success, info. Also adds behavior of dismissing
the message when a new node is created on the canvas.
Co-authored-by: Karla Spuldaro <karla.spuldaro@ibm.com>
Copy link
Member

@ajbozarth ajbozarth left a comment

Choose a reason for hiding this comment

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

I checked this out and tried it and it works great. I made a couple code comments below including one refactor idea.

I did notice in my testing that canvas prevents connecting a node to itself by default, but this doesn't show our error. Do we want to try to tie our new error messaging into that behavior as well for consistency?

Also a larger question: why did you use material-ui for this? I ran a quick check and it's not currently used in lab, lumino, or canvas.

@marthacryan marthacryan added the status:Work in Progress Development in progress. A PR tagged with this label is not review ready unless stated otherwise. label Jul 16, 2020
@marthacryan
Copy link
Member Author

Also a larger question: why did you use material-ui for this? I ran a quick check and it's not currently used in lab, lumino, or canvas.

@ajbozarth Someone in a jupyterlab community meeting mentioned using material-ui when jupyterlab doesn't have a feature already implemented, and I thought this sort of alert would be better than a dialog for what the error was, so I thought I'd give material-ui a try. It looked good and was relatively simple to add, so I went with it!

Copy link
Member

@ajbozarth ajbozarth left a comment

Choose a reason for hiding this comment

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

Tested locally and everything looks good. A couple minor comments, once those are addressed this should be good to go.

packages/pipeline-editor/package.json Show resolved Hide resolved
packages/ui-components/style/icons/error.svg Outdated Show resolved Hide resolved
@marthacryan marthacryan removed the status:Work in Progress Development in progress. A PR tagged with this label is not review ready unless stated otherwise. label Jul 22, 2020
@marthacryan
Copy link
Member Author

marthacryan commented Jul 22, 2020

Last commit moves the link validation code into beforeEditActionHandler because the updated version of canvas allows using that handler to verify an edit before going through with the edit. Doesn't change behavior of error handling or validation, just makes the code cleaner. @ajbozarth If you want to make sure that last commit looks good, that might be a good idea, otherwise @lresende this is ready to be merged

Copy link
Member

@ajbozarth ajbozarth left a comment

Choose a reason for hiding this comment

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

Still looks good with the latest changes

Copy link
Member

@karlaspuldaro karlaspuldaro left a comment

Choose a reason for hiding this comment

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

Very nice add-on :)

@vabarbosa
Copy link
Contributor

vabarbosa commented Jul 22, 2020

looks good to me!

there is an edge case which i am not sure if it is worth addressing. if i have a saved pipeline which already has a circular reference when i open/load this pipeline the circular reference is not detected. if this scenario is valid then perhaps an initial check should be done when opening a pipeline?

@marthacryan
Copy link
Member Author

@vabarbosa Good point! That kind of error might be better as a decoration though (it might be confusing if we go in and delete links then show an error right when users open the pipeline) - I could include it in #752 as part of the validation that I'm adding for nodes, but the one issue that comes to mind is that there isn't an existing tooltip for links, so I'm not sure how we'd indicate what the issue is with the link. Thoughts?

@vabarbosa
Copy link
Contributor

@vabarbosa Good point! That kind of error might be better as a decoration though (it might be confusing if we go in and delete links then show an error right when users open the pipeline) - I could include it in #752 as part of the validation that I'm adding for nodes, but the one issue that comes to mind is that there isn't an existing tooltip for links, so I'm not sure how we'd indicate what the issue is with the link. Thoughts?

yeah, i don't believe deleting the link would be the way to go either. maybe showing the notification and also changing the link to red dashed line. for example

image

@marthacryan
Copy link
Member Author

@vabarbosa I like that! I'll add that to #752 because it already has validation code that runs on startup.

@lresende lresende merged this pull request into elyra-ai:master Jul 24, 2020
@marthacryan marthacryan deleted the prevent-circular branch July 24, 2020 19:55
@vabarbosa vabarbosa linked an issue Jul 27, 2020 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
6 participants