mirror of
https://gitlab.com/wgp/dougal/software.git
synced 2025-12-06 12:37:08 +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'])
|
||||
},
|
||||
|
||||
watch: {
|
||||
|
||||
async projects () {
|
||||
await this.load();
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
methods: {
|
||||
|
||||
async list () {
|
||||
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) {
|
||||
if (item.organisations) {
|
||||
return "Access:\n" + Object.entries(item.organisations).map( org =>
|
||||
@@ -212,30 +213,22 @@ export default {
|
||||
},
|
||||
|
||||
async load () {
|
||||
await this.refreshProjects();
|
||||
if (!this.projects.length) {
|
||||
this.refreshProjects();
|
||||
}
|
||||
await this.list();
|
||||
const promises = [];
|
||||
for (const key in this.items) {
|
||||
const item = this.items[key];
|
||||
const promise = this.summary(item)
|
||||
.then( expanded => {
|
||||
if (expanded) {
|
||||
this.$set(this.items, key, expanded);
|
||||
}
|
||||
});
|
||||
promises.push(promise);
|
||||
},
|
||||
|
||||
handlerLoad (context, {payload}) {
|
||||
if (payload?.table == "public") {
|
||||
this.load();
|
||||
}
|
||||
},
|
||||
|
||||
registerNotificationHandlers () {
|
||||
this.$store.dispatch('registerHandler', {
|
||||
table: 'project`',
|
||||
|
||||
handler: (context, message) => {
|
||||
if (message.payload?.table == "public") {
|
||||
this.load();
|
||||
}
|
||||
}
|
||||
handler: this.handlerLoad
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user