New action to populate a dataset
https://redmine.teklia.com/issues/7499
Requires backend#1774 (closed)
On both projects and elements, the Actions menu should include a new Populate a dataset action. This action is disabled when you do not have contributor access to the project. When clicking on this action, a new modal opens, offering the various options provided by the new PopulateDataset
endpoint.
-
A
<select>
allows users to pick a dataset. -
A Create button next to the
<select>
could open the dataset creation modal, instead of having to go to Project information → Datasets. When a dataset is created, the<select>
is updated. Users are likely to forget to create a dataset first before populating it, so this saves them some frustration. -
A switch allows toggling the
recursive
option.- When on a project, the switch is called "Top-level" and is enabled by default.
- When on an element, the switch is called "Recursive" and is disabled by default.
This matches the current definition of recursiveness in the frontend, as it is called top-level in the filter bar.
-
A control allows to optionally select one or more element types to filter on. By default, there is no filtering at all, all element types are selected.
The simplest option might be a
<select multiple>
, with an extraAll
option because that would make it unclear to users how not to filter, but this is open to suggestions. -
An
<input type="number">
allows selecting a strictly positive (greater than zero) amount of elements, defaulting to 1000. -
For the ratios, this gets more complicated. As soon as a dataset is selected, one row is displayed for each of the dataset's sets. Next to the set name, a slider or a
number
input allow to select a ratio.When using a slider, a label next to the slider shows the current slider value in %. The
number
input also uses percents, 0 to 100, not 0 to 1. Decimal values are allowed.0% is allowed. It will cause the set to not be sent at all to
PopulateDataset
, since that endpoint will not allow a 0.The minimum and maximum values of the sliders or number inputs are adjusted so that the total never exceeds 100%. When the total is below 100%, show a
help is-error
paragraph explaining that the total must equal 100%.Maybe something similar to the
multiprogress
we have on the process status page could be used to show the current set percentages?This is very much open to suggestions too. Please discuss before wasting too much energy into the implementation.
Whatever the UI will be, when the sets are the default set names (
train
,dev
andtest
), you can make them default to 80% train, 10% dev, 10% test. For any other set name, you can just equally split the percentages, for example 33% coffee, 33% tea, 33% hot cocoa. -
When the dataset is selected and the ratios are correctly set, the Populate button is enabled, and clicking it calls
PopulateDataset
. It is optional to use thedatasets
Pinia store here since this is purely an API call and there will be no state changes at all. -
When the population is successful, redirect to the dataset's page so that the elements can be browsed immediately.
-
When it fails, show an error notification, and show
help is-error
paragraphs on each of the fields if there are field errors, as usual.