diff --git a/lib/www/client/source/src/views/Group.vue b/lib/www/client/source/src/views/Group.vue index 986d9cf..b84b1fb 100644 --- a/lib/www/client/source/src/views/Group.vue +++ b/lib/www/client/source/src/views/Group.vue @@ -252,6 +252,14 @@ export default { 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 () { 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 () { - await this.getGroups(); - if (this.groupFound) { - this.getComparisons(); - /* - this.registerNotificationHandlers(); - - this.refreshLines(); - this.refreshSequences(); - this.refreshEvents(); - this.refreshLabels(); - this.refreshPlan(); - */ - } + this.registerNotificationHandlers(); + this.refreshComparisons() }, beforeDestroy () { - //this.unregisterNotificationHandlers(); + this.unregisterNotificationHandlers(); }