Don't request summaries in ProjectList.

Those will be populated directly by Vuex.
This commit is contained in:
D. Berge
2025-08-20 12:05:44 +02:00
parent f21ff7ee38
commit 4e1d3209df

View File

@@ -189,19 +189,20 @@ export default {
...mapGetters(['loading', 'projects']) ...mapGetters(['loading', 'projects'])
}, },
watch: {
async projects () {
await this.load();
}
},
methods: { methods: {
async list () { async list () {
this.items = [...this.projects]; this.items = [...this.projects];
}, },
async summary (item) {
const details = await this.api([`/project/${item.pid}/summary`]);
if (details) {
return Object.assign({}, details, item);
}
},
title (item) { title (item) {
if (item.organisations) { if (item.organisations) {
return "Access:\n" + Object.entries(item.organisations).map( org => return "Access:\n" + Object.entries(item.organisations).map( org =>
@@ -212,30 +213,22 @@ export default {
}, },
async load () { async load () {
await this.refreshProjects(); if (!this.projects.length) {
this.refreshProjects();
}
await this.list(); await this.list();
const promises = []; },
for (const key in this.items) {
const item = this.items[key]; handlerLoad (context, {payload}) {
const promise = this.summary(item) if (payload?.table == "public") {
.then( expanded => { this.load();
if (expanded) {
this.$set(this.items, key, expanded);
}
});
promises.push(promise);
} }
}, },
registerNotificationHandlers () { registerNotificationHandlers () {
this.$store.dispatch('registerHandler', { this.$store.dispatch('registerHandler', {
table: 'project`', table: 'project`',
handler: this.handlerLoad
handler: (context, message) => {
if (message.payload?.table == "public") {
this.load();
}
}
}); });
}, },