mirror of
https://gitlab.com/wgp/dougal/software.git
synced 2025-12-06 10:27:09 +00:00
Don't request summaries in ProjectList.
Those will be populated directly by Vuex.
This commit is contained in:
@@ -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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user