okfn / opendataeditor

No-code application to explore and publish all kinds of data: datasets, tables, charts, maps, stories, and more. Forever free and open source project powered by open standards and generative AI.
http://opendataeditor.okfn.org
MIT License
150 stars 18 forks source link

Problem selecting multiple files on the left menu #341

Closed romicolman closed 5 days ago

romicolman commented 2 months ago

Problem description

Let's say you add a 5 files to the ODE and you want to delete a couple of them. Right now, you have to do it one by one. It is not possible to select more than one by using Ctrl + Select.

Screen:

Captura de pantalla 2024-04-23 a la(s) 22 24 03

Steps to reproduce it

Suggested solution

Allow Ctrl + Select on the tool.

guergana commented 2 months ago

Moving back to the backlog since this involves getting more familiar with the zustand store and I need more time to become familiar with it.

There is a multiSelect prop that can be passed to the TreeView component but I need more familiarity with the store to continue. I suggest @roll works on this task for now. I will get into tasks like this later on.

roll commented 2 months ago

@romicolman @guergana I would call it a feature, to be honest.

romicolman commented 2 months ago

@roll Can you estimate how much effort this would take? I am thinking of people working on Governments who upload datasets to publish in CKAN and have several files/projects in the ODE. This is key to manage files within the tool.

Note: I replaced the bug label with feature :)

roll commented 2 months ago

@romicolman I think the size is 1-2 days

romicolman commented 2 months ago

Let's go for it! :) Can you guide @guergana to work on this?

roll commented 2 months ago

@guergana @romicolman I think it will require reworking components/Application/store.ts to support multiple active files (while not breaking the selected file logic). I've updated the Tech Effort to 3 but it might be even 5 as I see it now. Anyway, probably a good issue to get used to Zustand and TreeView

guergana commented 2 months ago

@guergana @romicolman I think it will require reworking components/Application/store.ts to support multiple active files (while not breaking the selected file logic). I've updated the Tech Effort to 3 but it might be even 5 as I see it now. Anyway, probably a good issue to get used to Zustand and TreeView

Yeah, I am not sure this is the best issue for me now since I am still more or less onboarding. I might need your help at some point @roll

roll commented 2 months ago

@guergana Sure! Anyway it's in the backlog for now

romicolman commented 1 month ago

@roll / @guergana: I'm moving this issue to Sprint 3, since it requires more in-depth conversations.

pdelboca commented 3 weeks ago

@guergana @roll what if we approach this issue without changing the current path and selected file logic.

I'm proposing:

  1. Keep using path as the main logic for the active file.
  2. Add a new state for selectedFiles that trigger logics of highlighting in the tree view.
  3. Create/Update the delete logic to include selectedFiles if exist.

    I do not think we need to go for massive refactoring of the current store to handle "Multiple Active Files" if our goal is to just delete multiple files.

    One thing is to have "Multiple Active Files" that can trigger actions like multiple windows, bulk edition, diff, etc. And another thing is to keep track of what the user is selecting in the TreeView and then do something about it (without the hassle of considering all of them "active files").

    So, long story short: Why don't we go for "One Active File" but implement "Multiple Selections In Tree View".

pdelboca commented 3 weeks ago

MUI already comes with a component to design File Explorers (with multiple selection): https://mui.com/x/react-tree-view/rich-tree-view/customization/#file-explorer

Maybe we can use RichTreeView instead of just TreeView?

guergana commented 3 weeks ago

@guergana @roll what if we approach this issue without changing the current path and selected file logic.

I'm proposing:

1. Keep using `path` as the main logic for the active file.

2. Add a new state for `selectedFiles` that trigger logics of highlighting in the tree view.

3. Create/Update the delete logic to include selectedFiles if exist.

I do not think we need to go for massive refactoring of the current store to handle "Multiple Active Files" if our goal is to just delete multiple files.

One thing is to have "Multiple Active Files" that can trigger actions like multiple windows, bulk edition, diff, etc. And another thing is to keep track of what the user is selecting in the TreeView and then do something about it (without the hassle of considering all of them "active files").

So, long story short: Why don't we go for "One Active File" but implement "Multiple Selections In Tree View".

This aproach worked for me in the end!!! Yei. :100:

guergana commented 3 weeks ago

MUI already comes with a component to design File Explorers (with multiple selection): https://mui.com/x/react-tree-view/rich-tree-view/customization/#file-explorer

Maybe we can use RichTreeView instead of just TreeView?

@pdelboca we could propose this in a different ticket as an investigation. What do you think? In the Tree view there's also the multiSelect feature that's activated with a prop. The difficult part here for me was making it work with the current store. So I think the challenge would be the same if we switch to RichTreeView. If you see any other advantages for the change we could go on with the investigation.

guergana commented 1 week ago

@romicolman I can't delete a folder and a file at the same time. can you do it?

romicolman commented 6 days ago

I cannot test this on my laptop. Let's have a quick call tomorrow and I'll add a follow-up comment here later.