stable

Clone or download

Read-only

feat: Replace File upload streams by TUS client

Part of request #28830 replace File upload streams by TUS client Change expected: the TUS API for Trackers should be called instead of the Artifact temporary files API. Otherwise, no expected functional change: - when you attach several files to several File Attachment fields, they are all uploaded in parallel when you submit the modal. When the uploads are finished, the create / edit REST API is called and the files are attached. Notes: Error handling still leaves to be desired: you need to scroll up to see error messages, like before. It can be improved after redoing the "submit" handling, currently AngularJS promises are a major hindrance. Additionally, error messages are still very technical and untranslated most of the time. For example, exceeding the max upload size displays the message from the backend, which shows file sizes in bytes (instead of MiB). The modal bundle weight is reduced: 647 KiB -> 615 KiB. It is not as reduced as I hoped for. We could have some gains by deduplicating "tus-js-client" which is included a second time as part of the CKEditor image upload lib, but that will require a version bump at least. Change-Id: I552e194d2129fd401935394f67c61c5891f4ee80

Modified Files

Name
M plugins/tracker/scripts/lib/artifact-modal/package.json +2 −6 Go to diff View file
M plugins/tracker/scripts/lib/artifact-modal/pnpm-lock.yaml +86 −70 Go to diff View file
M plugins/tracker/scripts/lib/artifact-modal/po/fr_FR.po +5 −15 Go to diff View file
M plugins/tracker/scripts/lib/artifact-modal/po/pt_BR.po +3 −8 Go to diff View file
M plugins/tracker/scripts/lib/artifact-modal/src/adapters/REST/TuleapAPIClient.test.ts +50 −0 Go to diff View file
M plugins/tracker/scripts/lib/artifact-modal/src/adapters/REST/TuleapAPIClient.ts +20 −2 Go to diff View file
A plugins/tracker/scripts/lib/artifact-modal/src/adapters/REST/fields/file-field/FileUploader.test.ts +85 −0 Go to diff View file
A plugins/tracker/scripts/lib/artifact-modal/src/adapters/REST/fields/file-field/FileUploader.ts +44 −0 Go to diff View file
M plugins/tracker/scripts/lib/artifact-modal/src/common/CommonmarkSyntaxHelper.ts +2 −1 Go to diff View file
M plugins/tracker/scripts/lib/artifact-modal/src/common/RichTextEditor.test.ts +4 −4 Go to diff View file
M plugins/tracker/scripts/lib/artifact-modal/src/common/RichTextEditor.ts +3 −3 Go to diff View file
R plugins/tracker/scripts/lib/artifact-modal/src/types.ts Go to diff View file
A plugins/tracker/scripts/lib/artifact-modal/src/domain/fields/file-field/CreateFileUpload.ts +27 −0 Go to diff View file
M plugins/tracker/scripts/lib/artifact-modal/src/domain/fields/file-field/FileFieldType.ts +4 −2 Go to diff View file
A plugins/tracker/scripts/lib/artifact-modal/src/domain/fields/file-field/FileFieldsUploader.test.ts +209 −0 Go to diff View file
A plugins/tracker/scripts/lib/artifact-modal/src/domain/fields/file-field/FileFieldsUploader.ts +88 −0 Go to diff View file
A plugins/tracker/scripts/lib/artifact-modal/src/domain/fields/file-field/FileUploadCreated.ts +23 −0 Go to diff View file
R plugins/tracker/scripts/lib/artifact-modal/src/fields/file-field/base64-transform.js Go to diff View file
A plugins/tracker/scripts/lib/artifact-modal/src/domain/fields/file-field/FileUploaded.ts +22 −0 Go to diff View file
A plugins/tracker/scripts/lib/artifact-modal/src/domain/fields/file-field/FinishFileUpload.ts +27 −0 Go to diff View file
A plugins/tracker/scripts/lib/artifact-modal/src/domain/fields/file-field/FinishFileUploadCommand.ts +24 −0 Go to diff View file
A plugins/tracker/scripts/lib/artifact-modal/src/domain/fields/file-field/NewFileUpload.ts +25 −0 Go to diff View file
M plugins/tracker/scripts/lib/artifact-modal/src/fields/disabled-field-detector.test.ts +14 −5 Go to diff View file
M plugins/tracker/scripts/lib/artifact-modal/src/fields/disabled-field-detector.ts +1 −1 Go to diff View file
M plugins/tracker/scripts/lib/artifact-modal/src/fields/file-field/file-field-detector.test.ts +4 −4 Go to diff View file
M plugins/tracker/scripts/lib/artifact-modal/src/fields/file-field/file-field-detector.ts +9 −7 Go to diff View file
D plugins/tracker/scripts/lib/artifact-modal/src/fields/file-field/file-uploader.js +0 −94 Go to diff View file
D plugins/tracker/scripts/lib/artifact-modal/src/fields/file-field/streaming-file-reader.js +0 −73 Go to diff View file
M plugins/tracker/scripts/lib/artifact-modal/src/gettext-catalog.ts +2 −0 Go to diff View file
M plugins/tracker/scripts/lib/artifact-modal/src/model/FirstFileFieldStore.ts +10 −4 Go to diff View file
M plugins/tracker/scripts/lib/artifact-modal/src/rest/rest-service.test.ts +0 −51 Go to diff View file
M plugins/tracker/scripts/lib/artifact-modal/src/rest/rest-service.ts +0 −41 Go to diff View file
M plugins/tracker/scripts/lib/artifact-modal/src/tuleap-artifact-modal-controller.js +30 −49 Go to diff View file
M plugins/tracker/scripts/lib/artifact-modal/src/tuleap-artifact-modal-controller.test.js +20 −62 Go to diff View file
A plugins/tracker/scripts/lib/artifact-modal/tests/stubs/CreateFileUploadStub.ts +71 −0 Go to diff View file
A plugins/tracker/scripts/lib/artifact-modal/tests/stubs/FinishFileUploadStub.ts +64 −0 Go to diff View file
M plugins/tracker/scripts/lib/artifact-modal/webpack.common.js +0 −8 Go to diff View file
A plugins/tracker/scripts/lib/rest-api-types/src/list-field.ts +24 −0 Go to diff View file
M plugins/tracker/scripts/lib/rest-api-types/src/trackers.ts +1 −0 Go to diff View file