From ea3d01d23b6bc8cf234d11511f65067e34be6eac Mon Sep 17 00:00:00 2001 From: Harald Bamberger Date: Mon, 3 Aug 2026 08:37:45 +0200 Subject: [PATCH] rebuild tags for degree programm or selection - split in multiple requests and render progressbar in loading modal --- application/views/templates/FHC-Footer.php | 1 + .../Stv/Studentenverwaltung/List.js | 84 +++++++++++++------ .../Studentenverwaltung/List/ModalLoading.js | 19 ++++- 3 files changed, 78 insertions(+), 26 deletions(-) diff --git a/application/views/templates/FHC-Footer.php b/application/views/templates/FHC-Footer.php index d2eb229f1..66ed4bd51 100644 --- a/application/views/templates/FHC-Footer.php +++ b/application/views/templates/FHC-Footer.php @@ -154,6 +154,7 @@ generateJSsInclude('vendor/npm-asset/primevue/confirmdialog/confirmdialog.min.js'); generateJSsInclude('vendor/npm-asset/primevue/confirmationservice/confirmationservice.min.js'); generateJSsInclude('vendor/npm-asset/primevue/tieredmenu/tieredmenu.min.js'); + generateJSsInclude('vendor/npm-asset/primevue/progressbar/progressbar.min.js'); } if($vuedatepicker11) generateJSsInclude('vendor/vuejs/vuedatepicker_js11/vue-datepicker.iife.js'); diff --git a/public/js/components/Stv/Studentenverwaltung/List.js b/public/js/components/Stv/Studentenverwaltung/List.js index deedc12b2..e35cc423a 100644 --- a/public/js/components/Stv/Studentenverwaltung/List.js +++ b/public/js/components/Stv/Studentenverwaltung/List.js @@ -250,7 +250,10 @@ export default { oldScrollTop: 0, allPrestudents: [], rebuildData: [], - isLoading: false + isLoading: false, + progress: -1, + total: -1, + processed: -1 } }, computed: { @@ -650,10 +653,12 @@ export default { this.oldScrollUrl = this.$refs.table.tabulator.getAjaxUrl(); } }, - rebuild(selected){ + async rebuild(selected){ + const maxbulksize = 25; + const minbulksize = 5; + let bulksize = minbulksize; this.isLoading = true; let prestudentIds = []; - this.showModal(); if(!selected.length) prestudentIds = this.$refs.table.tabulator .getData() @@ -661,28 +666,56 @@ export default { else prestudentIds = selected.map(item => item.prestudent_id); - const params = { - ids: prestudentIds, - typeId: 'prestudent_id', - sem: this.studiensemesterKurzbz - }; + this.progress = 0; + this.total = prestudentIds.length; + this.processed = 0; + this.rebuildData = [ + [], + [], + [] + ]; - return this.$api - .call(ApiTag.rebuildTagsforTypeId(params)) - .then(result => { - this.rebuildData = result.data; - this.isLoading = false; - console.log("Rebuild manually triggered"); - if(this.rebuildData[1].length > 0) - { - this.$fhcAlert.alertSuccess(this.$p.t('tag', 'alertSuccessRebuild', { count: this.rebuildData[1].length })); - } - if(this.rebuildData[2].length > 0) - { - this.$fhcAlert.alertError(this.$p.t('tag', 'alertErrorRebuild') + this.rebuildData[2].toString()); - } - }) - .catch(this.$fhcAlert.handleSystemError); + this.showModal(); + + while(this.processed < this.total) + { + let iteration_prestudentIds = prestudentIds.slice( + this.processed, + (this.processed + bulksize) + ); + const params = { + ids: iteration_prestudentIds, + typeId: 'prestudent_id', + sem: this.studiensemesterKurzbz + }; + + try + { + const result = await this.$api.call(ApiTag.rebuildTagsforTypeId(params)); + this.rebuildData[1] = [...this.rebuildData[1], ...result.data[1]]; + this.rebuildData[2] = [...this.rebuildData[2], ...result.data[2]]; + } + catch(error) { + this.$fhcAlert.handleSystemError(error); + }; + + this.processed += iteration_prestudentIds.length; + this.progress = Math.round(this.processed * 100 / this.total); + + bulksize = bulksize * 2; + if(bulksize > maxbulksize) bulksize = maxbulksize; + } + + if(this.rebuildData[1].length > 0) + { + this.$fhcAlert.alertSuccess(this.$p.t('tag', 'alertSuccessRebuild', { count: this.rebuildData[1].length })); + } + if(this.rebuildData[2].length > 0) + { + this.$fhcAlert.alertError(this.$p.t('tag', 'alertErrorRebuild') + this.rebuildData[2].toString()); + } + + this.isLoading = false; }, showModal(){ this.$refs.modalLocked.open(); @@ -695,6 +728,9 @@ export default { diff --git a/public/js/components/Stv/Studentenverwaltung/List/ModalLoading.js b/public/js/components/Stv/Studentenverwaltung/List/ModalLoading.js index 252002c4b..99368173e 100644 --- a/public/js/components/Stv/Studentenverwaltung/List/ModalLoading.js +++ b/public/js/components/Stv/Studentenverwaltung/List/ModalLoading.js @@ -5,7 +5,8 @@ export default { name: "modalLoading", components: { BsModal, - FormForm + FormForm, + PvProgressBar: primevue.progressbar }, props: { isLoading: { @@ -15,6 +16,18 @@ export default { message: { type: String, required: true + }, + progress: { + type: Number, + default: -1 + }, + total: { + type: Number, + default: -1 + }, + processed: { + type: Number, + default: -1 } }, data(){ @@ -37,7 +50,7 @@ export default { dialog-class="modal-dialog-scrollable" > + {{processed}} / {{total}} +