Skip to content

Export process modal

https://redmine.teklia.com/issues/7497

Requires backend#1864 (closed), #1505 (closed)

A new ExportProcessModal component will allow starting a new export process through CreateExportProcess. It gets format, corpusId, both required, as well as elementId and selection, optional.

This modal has Export {name} as {format} as a title. The name is the name of the element if there is one, or selected elements of {project name} when using a selection, or the name of project. The format is a user-friendly label for the ExportFormat enum values. You can define a new constant in src/config.ts to map enum values to their labels.

This new ExportProcessModal should show a paginated list of the CorpusExport for this project just like the ExportsModal. The columns are the same as the existing modal, but the only action available is Select. Clicking will set the export_id that will be set to CreateExportProcess. That button is disabled with an explicit title when the export is in an error state.

The first row, only on the first page, just reads Current state of the project, with no other columns. Selecting this will set export_id to None. This is selected by default.

It is not necessary to try to reuse a component for the export list because there are already enough differences for this to be too much trouble.

Below this list, the two Required fields and Optional fields from the WorkerConfiguration form are shown. These should be extracted from the WorkerConfiguration form into a new component so they can be reused.

Those use the fields from the user configuration of the worker version that provides the feature selected by the format. If the worker version has not yet been retrieved, a loading spinner should be shown. The export_id field should be excluded, since this field will be implicitly set by the export selection above.

If the worker cannot be retrieved, a red Bulma notification is shown and the user cannot continue, because something might be wrong server-side.

The modal has a Cancel button and an Export button. The Export button should be disabled when the user does have admin access to the project or there are user configuration errors. The new modal should support the form-errors event from the configuration component so that it can show a detailed explanation of why the Export button is disabled as the title, just like the existing configuration modal.

When everything is valid and the user clicks on Export, CreateExportProcess is called through a Vuex action in the process store module. Errors should be handled by the component: those related to element_id or selection should be shown at the very top of the modal, those of export_id below the exports list, and those of configuration below the configuration dropdowns.

If the CreateExportProcess call is successful, the returned process should be stored in the processes state, and the component redirects to the process status page for the new export process.

Under the Import / Export menu, new actions should be created for each of the formats supported by CreateExportProcess. For now, this will be Export as PDF and Export as PAGE XML. You can iterate on the constant in src/config.ts to create those. These open the modal, setting corpusId to the project being browsed and elementId to an element being browsed if there is a specific one.

Under the Actions menu of the selection page, the same actions should also be found. Those open the modal with selection enabled.

All of these actions are disabled if the user does not have admin access to the project.

Edited by Erwan Rouchet