JMMC-OpenDev / oiexplorer

GNU General Public License v3.0
2 stars 1 forks source link

[feature] remove some files from a collection in use for a given data selection #2

Closed gmella closed 2 years ago

gmella commented 2 years ago

Is your feature request related to a problem? Please describe. I would like to be able to remove a given file from the current collection.

Describe the solution you'd like Selecting a file from the current set and getting a delete shortcut or button would provide a way to adjust properly the content of my collection.

Describe alternatives you've considered Reset the collection and start adding files without the one we do not want anymore. In this case, we loose every plots attached to the session.

Additional context no

Reworked specifications

First implementation will cover next scenario updating the current version:

The report shown in the confirmation dialog must provide in the first version:

Validation will be done trying to:

Note:

buthanoid commented 2 years ago

existing (potentially) useful code

Feature realization proposition

delete an OIFitsFile from the data

already realized by OIFitsCollectionManager.removeOIFitsFile

ask to delete ONE precise file from the GUI

Actually I think it is not so obvious where this could fit in the current GUI. There is two places where files appear, they are both in the GranuleTreePanel, one in the GranulesTab and the other in the FilesTab.

The Files in the GranuleTab can be selected. Until now, no action was associated to this selection. We could add a "Delete File" in the button bar, that would delete the selected file in GranuleTreePanel.Granules. However, because the DataTreePanel also have a concurrent selection, and that DataTreePanel is more the "action" panel compared to GranuleTreePanel, it would not be crystal-clear to the user which selection will be concerned by the button. So I would advocate for a "right-click -> delete file" directly on the item of GranuleTreePanel.Granules.

About GranuleTreePanel.Files, there is a list of files, and an existing "Browser" button, but the user can make no selection, so I do not think a Delete button would be practical, and I actually think the current browser button is not practical either. I would advocate a button here only if the user can directly select the file, but this does not fit with the original behaviour of that panel which is to display which files are concerned by the current SubsetDefinition.

Delete all files concerned by the current SubsetDefinition

Obtaining that list of files is easy because it is already done in OIFitsFileListPanel.updateOIFitsList. We just have to move that code to SubsetDefinition. Then we remove each file, we could add a method in OIFitsCollectionManager to delete a list of Files, to avoid casting many events. We could factor the common code with removeOIFitsFile.

The GUI button could be in the button bar, it could be called "Delete associated files".

Delete all files concerned by a Target or an Instrument Mode or Table

We could add the feature of a right-click on a Target or Instrument Mode or Table from the DataTreePanel, leading to a righ-click menu with the item "Delete associated file(s)". That action would not change the current selection and the current SubsetDefinition. I think it is not a mandatory feature.

In the code part, it would need to build a Selector depending on the clicked item, and to send it to the function OIFitsCollection.findOIData. Then we would obtain a list of OIDatas that would lead us to the list of files to delete.\ Alternatively, we could also create a temporary SubsetDefinition that would follow the process of Filters, Selector, SelectoResult, to OIFitsFile, and then using the code from OIFitsFileListPanel.updateOIFitsList like in the previous section.

dialog confirm with details

In all cases, I advocate for a dialog confirm before actually deleting the file(s). That dialog would list the files to be deleted, and then the list of OIDatas with the Target and Instrument Mode, similar of the information that we see in the DataTreePanel. Because when you right click on a Target on "Delete associated files", you need to see the list of concerned files. And since you cannot delete half of a file, you need to see the list of associated Tables that will be removed. JMCS already has the function MessagePane.showDialogPanel for the dialog subwindow.

questions

basic test cases

not exactly elementary to avoid too many cases

delete one file

delete one target from two files with two targets

delete one instrument mode from two files with the same instrument mode

delete one table from one file with two targets

What remains to be specified

Hopefully I will have completed it before the meeting.

bourgesl commented 2 years ago

Analysis:

Design proposal:

buthanoid commented 2 years ago

My work in https://github.com/JMMC-OpenDev/oiexplorer-core/pull/11 and https://github.com/JMMC-OpenDev/oiexplorer/pull/4

bourgesl commented 2 years ago

PR integrated

bourgesl commented 2 years ago

See http://jmmc.fr/~betaswmgr/OIFitsExplorer/