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

Added Drag and Drop support to IFS Browser #1726

Merged
merged 11 commits into from
Dec 28, 2023

Conversation

sebjulliand
Copy link
Collaborator

@sebjulliand sebjulliand commented Dec 14, 2023

Changes

This PR enables drag and drop support in the IFS browser and multiple selection (using ctrl + click or shift + click)

Drag and drop from outside VSCode inside the IFS Browser

Dragging files/folders from an external explorer to the IFS browser will upload these files/folders. If the users drop their selection on a folder, that folder will be the target for the upload. If they drop on a file, the file's parent folder will be the target.
xB4fDZa7QK

Drag and drop inside the IFS Browser

Dragging one or more items from the IFS browser and dropping them in it will copy or move them depending on a new setting:
image

  • ask: a modal dialog will appear to ask the user if they want to move or copy their selection
  • move: the selection will be moved to the drop target
  • copy: the selection will be copied to the drop target
    Code_GxYgB3OLUR

Multi-selection actions

Most of the actions from the right-click menu in the IFS browser will be disabled, save for the Delete object action that now allows for deleting multiple items at once.

@chrjorgensen : I'll once again require your expertise for translating a few new sentences (+ one that was slightly changed).

Resolves #1725 by adding a progress when uploading files.

Checklist

  • have tested my change

@sebjulliand sebjulliand requested a review from a team December 14, 2023 16:01
@chrjorgensen
Copy link
Collaborator

@sebjulliand Whoa! Can't wait to test this one!! 😍

@chrjorgensen
Copy link
Collaborator

chrjorgensen commented Dec 15, 2023

@sebjulliand Awesome - I've been wanting this for so long! 😍

I gave it a spin, and it works as expected - of course! 😉

Some thoughts from my side:

  • I think it should work like the built-in file explorer as much as possible. In the file explorer the default is to move the items, and when pressing Ctrl the operation is a copy. Can this be done?
  • In the file explorer there's a confirmation dialog before the move/copy operation. Maybe the ask option should be permanent and the dialog changed into this?
  • The file explorer shows the number of selected items at the cursor. Can we do this?
  • Now the user (me) can upload files by dragging into the IFS browser view, he/she (I) would expect to be able to do the opposite - downloading by dragging out of the IFS browser view. Can this be done?

As always, don't give me anything, I just want more! 🤣

I translated the new texts into Danish - and added checking for protected directories, including changing and translating the message text. Pardon my French! 😉

Copy link
Collaborator

@chrjorgensen chrjorgensen left a comment

Choose a reason for hiding this comment

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

LGTM - see comment above...

@sebjulliand
Copy link
Collaborator Author

Thanks @chrjorgensen, goods questions!

Some thoughts from my side:

* I think it should work like the built-in file explorer as much as possible. In the file explorer the default is to move the items, and when pressing `Ctrl` the operation is a copy. Can this be done?

The drag and drop API doesn't allow this. I tried to find a way to mimic this but didn't find any.

* In the file explorer there's a confirmation dialog before the move/copy operation. Maybe the `ask` option should be permanent and the dialog changed into this?

I don't have that confirmation. Could it be a settings too? If I drag and drop files around in the file explorer, it does it right away.

* The file explorer shows the number of selected items at the cursor. Can we do this?

It already does!
image

* Now the user (me) can upload files by dragging into the IFS browser view, he/she (I) would expect to be able to do the opposite - downloading by dragging out of the IFS browser view. Can this be done?

I failed to find a way to do this as well, and god knows I tried 😅 If it's possible, I didn't find how yet (maybe with a specific mime type?). I'll try harder...

@chrjorgensen
Copy link
Collaborator

@sebjulliand

The drag and drop API doesn't allow this. I tried to find a way to mimic this but didn't find any.

Okay, just a wish that may come true later.. 😃

I don't have that confirmation. Could it be a settings too? If I drag and drop files around in the file explorer, it does it right away.

You have probably checked this one to not be disturbed! 😆

image

It already does!

Ah, sorry - only had one file selected when I checked for this. 👍

I failed to find a way to do this as well, and god knows I tried 😅 If it's possible, I didn't find how yet (maybe with a specific mime type?). I'll try harder...

Well, this is not a show-stopper, just a nice-to-have... 😃

@chrjorgensen
Copy link
Collaborator

@sebjulliand Did you know you can drag a file into an open editor? Then it copies the link into the text:

image

Not a problem, though...

Copy link
Collaborator

@chrjorgensen chrjorgensen left a comment

Choose a reason for hiding this comment

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

@sebjulliand I did some further testing on the PR and observed this:

When I select some files and move them to another folder. the next item below is selected:

image

image

Also, it's possible to drag a folder into itself, which should not be possible, instead ignored...

@sebjulliand sebjulliand force-pushed the feature/ifsBrowserDragndrop branch from e0b2986 to ef13bd4 Compare December 27, 2023 21:54
sebjulliand and others added 9 commits December 27, 2023 22:56
Signed-off-by: Seb Julliand <sebjulliand@gmail.com>

Enable drag and drop in IFS browser

- Drop from an external source
- Drag and drop inside the browser itself

Signed-off-by: Seb Julliand <sjulliand@arcadsoftware.com>
Signed-off-by: Seb Julliand <sebjulliand@gmail.com>
Signed-off-by: Seb Julliand <sjulliand@arcadsoftware.com>
Signed-off-by: Seb Julliand <sjulliand@arcadsoftware.com>
Signed-off-by: Seb Julliand <sjulliand@arcadsoftware.com>
Signed-off-by: Seb Julliand <sebjulliand@gmail.com>
Signed-off-by: Seb Julliand <sebjulliand@gmail.com>
Signed-off-by: Seb Julliand <sebjulliand@gmail.com>
@sebjulliand sebjulliand force-pushed the feature/ifsBrowserDragndrop branch from ef13bd4 to e399eef Compare December 27, 2023 22:07
Signed-off-by: Seb Julliand <sebjulliand@gmail.com>
@sebjulliand
Copy link
Collaborator Author

sebjulliand commented Dec 27, 2023

Thanks @chrjorgensen for your review!
I completely messed up my rebase and had to clean thing up and force a clean branch but here we are.

Here is what's been done, based on your feedback:

  • Dragging a folder into itself will now do nothing (even between two filters)
  • Dragging a root item (i.e. a filter) will do nothing
  • After a successful move operation, the target folder gets focused
  • Dragging files into the editor area will open them

Signed-off-by: Seb Julliand <sebjulliand@gmail.com>
Copy link
Collaborator

@chrjorgensen chrjorgensen left a comment

Choose a reason for hiding this comment

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

@sebjulliand It's looking very good indeed - no issues found, and your fixes for my latest remarks works great! 🌹

Can't wait to get this into C4i - really like how easy it is now to move/copy files and open them in the editor! 😍

@chrjorgensen
Copy link
Collaborator

@sebjulliand (Rebase and) merge when you're ready! 🥇

@sebjulliand
Copy link
Collaborator Author

You're the best @chrjorgensen, thank you for your review!
I'm quite happy with the result too! Let's merge 😁

@sebjulliand sebjulliand merged commit eb9ba9b into master Dec 28, 2023
1 check passed
@sebjulliand sebjulliand deleted the feature/ifsBrowserDragndrop branch December 28, 2023 20:51
@worksofliam
Copy link
Contributor

@sebjulliand I am not grave digging here, but I did have a question. Not asking you to do them, but are these possible? I want to work on them:

  • Drag to QSYS to workspace/local, workspace/local to QSYS
  • Drag from QSYS to IFS, QSYS to IFS

@sebjulliand
Copy link
Collaborator Author

@sebjulliand I am not grave digging here, but I did have a question. Not asking you to do them, but are these possible? I want to work on them:

@worksofliam sure, both are possible, to some extent.

* Drag to QSYS to workspace/local, workspace/local to QSYS

That's where some extent applies. workspace/local to QSYS is no problem (same as IFS browser). You get a list Uri to work with when doing so. I didn't find anything that allows to workspace/local. At least, to local explorer, there is no way (for technical reasons, I guess; like how is the host OS going to know what to do with that?!). At least the doc didn't leave the impression it's possible. I tried a few implementations but all failed. Dragging to the File explorer/workspace doesn't seem to work either, whatever I did.

* Drag from QSYS to IFS, QSYS to IFS

No problem here; the TreeDragAndDropController for each browser will have to support each other mime type. IFS browser's is defined here as a constant:

export const IFS_BROWSER_MIMETYPE = "application/vnd.code.tree.ifsbrowser";

Then you do whatever you want with the items you receive.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

We need an upload progress indicator
3 participants