Skip to content
Snippets Groups Projects
Unverified Commit c3f6cdb1 authored by Bekerle, Patrizio's avatar Bekerle, Patrizio :fire:
Browse files

Implement re-upload of all failed uploads (VPU/Middleware/API#40)

parent 71ab1e46
Branches
No related tags found
No related merge requests found
Pipeline #9790 failed
......@@ -14,7 +14,9 @@
"download-file-button-title": "Signiertes PDF herunterladen",
"error-files-label": "Fehlgeschlagene Signiervorgänge",
"re-upload-file-button-title": "Erneut hochladen",
"upload-status-file-text": "({{fileSize}}) wird hochgeladen und verarbeitet..."
"upload-status-file-text": "({{fileSize}}) wird hochgeladen und verarbeitet...",
"re-upload-all-button": "Alle erneut hochladen",
"re-upload-all-button-title": "Alle fehlgeschlagen Uploads erneut hochladen"
},
"welcome": {
"headline": "Willkommen beim Amtssignaturservice der TU Graz",
......
......@@ -14,7 +14,9 @@
"download-file-button-title": "Download signed PDF",
"error-files-label": "Failed signing processes",
"re-upload-file-button-title": "Upload again",
"upload-status-file-text": "({{fileSize}}) is currently uploading and being processed..."
"upload-status-file-text": "({{fileSize}}) is currently uploading and being processed...",
"re-upload-all-button": "Upload all",
"re-upload-all-button-title": "Upload all failed uploads again"
},
"welcome": {
"headline": "Welcome to the official signature service of the TU Graz",
......
......@@ -146,6 +146,24 @@ class SignaturePdfUpload extends VPUSignatureLitElement {
});
}
/**
* Re-Upload all failed files
*/
reUploadAllClickHandler() {
const that = this;
// we need to make a copy and reset the queue or else our queue will run crazy
const errorFilesCopy = {...this.errorFiles};
this.errorFiles = [];
this.errorFilesCount = 0;
commonUtils.asyncObjectForEach(errorFilesCopy, async (file, id) => {
await this.fileUploadClickHandler(file.file, id);
});
that._("#re-upload-all-button").stop();
}
/**
* Download one signed pdf file
*
......@@ -168,7 +186,7 @@ class SignaturePdfUpload extends VPUSignatureLitElement {
async fileUploadClickHandler(file, id) {
this.uploadInProgress = true;
this.errorFiles.splice(id, 1);
this.errorFilesCount--;
this.errorFilesCount = this.errorFiles.length;
await this._("#file-upload").uploadFile(file);
this.uploadInProgress = false;
}
......@@ -282,6 +300,11 @@ class SignaturePdfUpload extends VPUSignatureLitElement {
${this.getErrorFilesHtml()}
</div>
</div>
<div class="field ${classMap({hidden: this.errorFilesCount === 0})}">
<div class="control">
<vpu-button id="re-upload-all-button" ?disabled="${this.uploadInProgress}" value="${i18n.t('pdf-upload.re-upload-all-button')}" title="${i18n.t('pdf-upload.re-upload-all-button-title')}" @click="${this.reUploadAllClickHandler}" type="is-primary"></vpu-button>
</div>
</div>
</div>
<div class="notification is-warning ${classMap({hidden: this.isLoggedIn()})}">
${i18n.t('error-login-message')}
......
Subproject commit ac58867f0a921fbdebda78b6bf78b58b69779f4c
Subproject commit 4f1d5c504ad5935b8903ab37abcbaa2b588112bd
Subproject commit 10f7e2a70b95580c7b05993b3d640524b7a0f05f
Subproject commit 1a0894aecd523cd5b101ea3ad8028fc95c18741c
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment