-
Improvement
-
Resolution: Unresolved
-
None
-
None
-
Medium
-
IMPROVEMENT: Visual Export will be refreshed every time, it is initiated without any waiting-time
-
Emptyshow more show less
Problem
The current implementation for the PDF translation and download of the target file is not very user friendly. When an InstantTranslate user is allowed to edit the file, and changes some text, it takes too long until the text change is present in the download target file.
Solution
To solve the Problem the downloads have to be made unique, so there can be multiple exports at the same time. The cleanup will be done in each process, so a download will remove it's files directly after download, the workflow-export will be deleted after emails were sent etc. (do it with ZfExtended_Utils::recursiveDelete($exportConfiguration->getExportFolder())).
The VisualExportCleanupWorker will be completely removed, any non cleaned exports will be removed by the daily cronjob cleaning <taskDataDir>/export
To achive this, we generate a token and use it as folder for the export.
This token will be used as second mandatory constructor-param for the instantiation of MittagQI\Translate5\Plugins\VisualReview\Export\ExportOperation as well as MittagQI\Translate5\Plugins\VisualReview\Export\ExportConfiguration: Here the token will be added as export-path like <task-data-dir>/export/visual/<token>/... (manipulate $this->exportFolder)
The token must be added as parameter for all workers doing exports, what can be achived with
MittagQI\Translate5\Plugins\VisualReview\Worker\QueueingService::queueExportWorkers() as new mandatory 3rd param.
From there it will be injected to the Worker processes: ExportSourceCreation, MergeAnnotatePdfs and PrintPdfs
The token comes from the frontend (popup) or must be generated manually for the workflow-triggered export and the Export via task-export controller for PDF downloads:
a) Visual Export via GUI
The token will be generated in editor_Plugins_VisualReview_ExportController::getAction(), injected into the GUI and resent as request param to all the endpoints of editor_Plugins_VisualReview_ExportController
Cleanup is done in ExportOperation::download
b) Visual Export via Workflow
Generate the token in MittagQI\Translate5\Plugins\VisualReview\Pdf\WorkflowAction. Cleanup is done in VisualExportNotificationWorker::work - if possible. If not possible, ask Thomas if the cleanup of <taskDataDir>/export is implemented ...
c) PDF workfile Export with the Visual
The token will be generated in the constructor of VisualTaskExport.Cleanup is done in ::downloadAsZip and ::downloadAsTranslatedPdf
Question of Marc: We need to take care of what happens, if user starts download a second time. Then visual pdf generation needs to be started again and user needs to be informed, that he needs to wait a bit, because he already downloaded and generation is done again
Remark Axel: When user clicks download-button a second time when there is already a running export (technically: the named window exists), we do NOT open a second window but simply focus on the running download/window. To initiate a second download, one must either wait, until current is ready or close the running first. We should add a message on a secondary click telling "If you wish to start a new visual export, please first close the running export"