-
Notifications
You must be signed in to change notification settings - Fork 347
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
Update node properties to allow changing file #867
Conversation
Added a file browser dialog and added support for changing file from the properties dialog Fixes elyra-ai#732
@vabarbosa - this looks great! Just curious if the same could be done for the File Dependencies section (where the start point is the location of the notebook file)? If so, then that would eliminate folks typing in names/paths to existing files. I'd be happy to open the issue if that's something we want to do. |
@kevin-bates you read my mind, i was thinking the same thing as was going to bring it up for discussion during the scrum to see if it is something would like to have included |
This looks awesome!!! |
@marthacryan i've updated the button position so it is consistent across the browsers. the 50/50 split comes canvas. i am using the https://github.com/elyra-ai/canvas/wiki/3.3-Common-Properties-Controls#grouppanel-controls |
Just tried your new changes and style is working as expected! One (very) small thing - definitely doesn't need to be part of this PR, but it'd be great if you could select a file in that browser by double-clicking. Not sure how easy that'd be to add, just a note. |
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.
LGTM
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.
@marthacryan i used a different panel layout and worked around the 50/50 split. yes, i noticed the console errors when switching to chrome. looking into it now. and will look into enabling double-click to select also. thanks |
@marthacryan i believe the error is coming from the carbon components modal (used by common canvas to display the properties dialog). more specifically, carbon components modal does not support stacked modals: carbon-design-system/carbon#5947 in any case, i was able to figure out a workaround the issue and the error should no longer be thrown. |
@marthacryan, you should now be able to select a file by double-clicking |
@vabarbosa Thanks for addressing those! Tried with new changes locally and LGTM |
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.
Tested locally with chrome, LGTM.
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.
still need to test locally and review the BrowseFileDialog file, but wanted to get these early comments in
@@ -456,6 +464,13 @@ export class PipelineEditor extends React.Component< | |||
} | |||
const app_data = node.app_data; | |||
|
|||
if (app_data.filename !== propertySet.filename) { | |||
app_data.filename = propertySet.filename; |
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.
As a note: this line will need to be updated to work with #861 is merged (in whichever PR is merged last)
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.
One clarifying question, otherwise I've checked this out and run it locally and it works great. Once my previous review is addressed I'll approve
const propertyId = { name: data.parameter_ref }; | ||
showBrowseFileDialog(this.browserFactory.defaultBrowser.model.manager, { | ||
filter: (model: any): boolean => { | ||
return model.type == 'notebook'; |
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.
Is the intension here that we would update this when we add support for other file types?
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.
yes, the filter is so you only show files that should be selectable. in this case, we only want to show notebook
files (no point in showing all available files if user shouldn't be selecting them). and yeah, if the dialog is to be re-used in other context then you can configure what files do appear. for example, with File Dependencies (#873) browser dialog would show files other than just notebook files
if (app_data.filename !== propertySet.filename) { | ||
app_data.filename = propertySet.filename; |
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.
Note this would specifically need to be updated to the following once #861 is merged or in #861 once this is merged.
if (app_data.filename !== propertySet.filename) { | |
app_data.filename = propertySet.filename; | |
const propertyFilename = PipelineService.getPipelineRelativeNodePath( | |
this.widgetContext.path, | |
propertySet.filename | |
); | |
if (app_data.filename !== propertyFilename) { | |
app_data.filename = propertyFilename; |
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.
LGTM
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.
Good stuff Va - thank you!
This PR adds support for changing the file associated with a node in the Pipeline Editor.
Fixes #732
To achieve this a new
BrowseFileDialog
was added into@elyra/ui-components
. TheBrowseFileDialog
displays a file browser in a dialog window which resolves to the selected files when accepted.It is worth noting JupyterLab already contains a
FileDialog
in@jupyterlab/filebrowser
. However, this does not allow flexibility and customization easily, hence the reason for creating the newBrowseFileDialog
. Unlike theFileDialog
, theBrowseFileDialog
can be configured to allow for disabling/preventing multiselect and also allow for selecting directories (if needed). TheFileDialog
does includes the New Folder, Upload, and Refresh buttons (that appear in the default FileBrowser) but not options to opt out of displaying those buttons.Developer's Certificate of Origin 1.1