Refresh comparisons when notified of changes

This commit is contained in:
D. Berge
2025-08-19 19:27:38 +02:00
parent fe7c016dea
commit 5527576679

View File

@@ -252,6 +252,14 @@ export default {
this.comparisons = await this.api([url]); this.comparisons = await this.api([url]);
}, },
// TODO Should this go in a Vuex action rather?
async refreshComparisons () {
await this.getGroups();
if (this.groupFound) {
await this.getComparisons();
}
},
/* /*
async getComparison () { async getComparison () {
if (this.baseline && this.monitor) { if (this.baseline && this.monitor) {
@@ -264,27 +272,34 @@ export default {
}, },
*/ */
...mapActions(["api", "getGroups"]) handleComparisons (context, {payload}) {
this.refreshComparisons();
},
registerNotificationHandlers (action = "registerHandler") {
this.$store.dispatch(action, {
table: 'comparisons',
handler: this.handleComparisons
});
},
unregisterNotificationHandlers () {
return this.registerNotificationHandlers("unregisterHandler");
},
...mapActions(["api", "getGroups", "refreshProjects"])
}, },
async mounted () { async mounted () {
await this.getGroups(); this.registerNotificationHandlers();
if (this.groupFound) { this.refreshComparisons()
this.getComparisons();
/*
this.registerNotificationHandlers();
this.refreshLines();
this.refreshSequences();
this.refreshEvents();
this.refreshLabels();
this.refreshPlan();
*/
}
}, },
beforeDestroy () { beforeDestroy () {
//this.unregisterNotificationHandlers(); this.unregisterNotificationHandlers();
} }