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?;

This commit is contained in:
Johann Hoffmann
2026-04-21 17:40:24 +02:00
parent 501bae585a
commit c36f259571
2 changed files with 35 additions and 9 deletions
+25 -9
View File
@@ -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
}
})
})
})
}
+10
View File
@@ -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