From c36f259571bd218c6271aba0492c872880f6115d Mon Sep 17 00:00:00 2001 From: Johann Hoffmann Date: Tue, 21 Apr 2026 17:40:24 +0200 Subject: [PATCH] revert back to 1 http request per lva menu list for performance reasons since usually 1-2 lva are slow and the rest load quickly; many menu_lv.inc scripts would need to be loaded via require instead of require_once but that breaks some of them; only table height calc on watcher; why does an english teacher need a mathe online link?; --- public/js/components/Cis/Mylv/MyLv.js | 34 +++++++++++++++++++------- public/js/components/Cis/Mylv/Table.js | 10 ++++++++ 2 files changed, 35 insertions(+), 9 deletions(-) diff --git a/public/js/components/Cis/Mylv/MyLv.js b/public/js/components/Cis/Mylv/MyLv.js index 9f659a3cc..b87bcd749 100644 --- a/public/js/components/Cis/Mylv/MyLv.js +++ b/public/js/components/Cis/Mylv/MyLv.js @@ -47,16 +47,32 @@ export default { this.lvs[this.currentSemester].lvs = res.data.retval || []; this.firstLoad = false; - this.$api.call(ApiAddons.getMultipleLvMenu(this.lvs[this.currentSemester].lvs, this.currentSemester)).then(res => { - if(res.data) { - Object.entries(res.data).forEach((entry) => { - // entry[0] -> key -> lvid - // entry[1] -> value -> menu - const lv = this.lvs[this.currentSemester].lvs.find(lv => lv.lehrveranstaltung_id == entry[0]) - lv.menu = entry[1] - }) - } + // pretty slow to load all at once if one lva has a weird moodle / lvinfo situation + // that multiplies the loadtime for everything by a factor of 3-5 + + // this.$api.call(ApiAddons.getMultipleLvMenu(this.lvs[this.currentSemester].lvs, this.currentSemester)).then(res => { + // if(res.data) { + // Object.entries(res.data).forEach((entry) => { + // // entry[0] -> key -> lvid + // // entry[1] -> value -> menu + // const lv = this.lvs[this.currentSemester].lvs.find(lv => lv.lehrveranstaltung_id == entry[0]) + // lv.menu = entry[1] + // }) + // } + // }) + this.lvs[this.currentSemester].lvs.forEach(lv=>{ + + this.$api.call(ApiAddons.getLvMenu(lv.lehrveranstaltung_id, this.currentSemester)).then(res => { + if(res.data) { + + const lvProp = this.lvs[this.currentSemester].lvs.find(lv2 => lv2.lehrveranstaltung_id == lv.lehrveranstaltung_id) + lvProp.menu = res.data + + } + }) + }) + }) } diff --git a/public/js/components/Cis/Mylv/Table.js b/public/js/components/Cis/Mylv/Table.js index 3584ba0e4..6f0232c64 100644 --- a/public/js/components/Cis/Mylv/Table.js +++ b/public/js/components/Cis/Mylv/Table.js @@ -237,6 +237,16 @@ export default { if(this.$refs.mylvTable) { console.log('watcher inside if ref table clause') this.$refs.mylvTable.tabulator.setData(newVal); + + const tableID = this.tabulatorUuid ? ('-' + this.tabulatorUuid) : '' + const tableDataSet = document.getElementById('filterTableDataset' + tableID); + if(!tableDataSet) return + const rect = tableDataSet.getBoundingClientRect(); + + const h = window.visualViewport.height - rect.top - 100 + if(this.$refs.mylvTable) { + this.$refs.mylvTable.$refs.table.style.setProperty('height', h+'px') + } } }, deep: true