diff --git a/lib/www/client/source/src/views/Project.vue b/lib/www/client/source/src/views/Project.vue index e7ba96c..4cb982e 100644 --- a/lib/www/client/source/src/views/Project.vue +++ b/lib/www/client/source/src/views/Project.vue @@ -37,7 +37,7 @@ export default { return this.loading || this.projectId; }, - ...mapGetters(["loading", "projectId", "serverEvent"]) + ...mapGetters(["loading", "projectId", "projectSchema", "serverEvent"]) }, watch: { @@ -45,16 +45,39 @@ export default { if (event.channel == "project" && event.payload?.operation == "DELETE" && event.payload?.schema == "public") { // Project potentially deleted await this.getProject(this.$route.params.project); + } else if (event.payload?.schema == this.projectSchema) { + if (event.channel == "event") { + this.refreshEvents(); + } else if (event.channel == "planned_lines") { + this.refreshPlan(); + } else if (["raw_lines", "final_lines", "final_shots"].includes(event.channel)) { + this.refreshSequences(); + } else if (["preplot_lines", "preplot_points"].includes(event.channel)) { + this.refreshLines(); + } else if (event.channel == "info") { + if ((event.payload?.new ?? event.payload?.old)?.key == "plan") { + this.refreshPlan(); + } + } else if (event.channel == "project") { + this.getProject(this.$route.params.project); + } } } }, methods: { - ...mapActions(["getProject"]) + ...mapActions(["getProject", "refreshLines", "refreshSequences", "refreshEvents", "refreshLabels", "refreshPlan"]) }, async mounted () { await this.getProject(this.$route.params.project); + if (this.projectFound) { + this.refreshLines(); + this.refreshSequences(); + this.refreshEvents(); + this.refreshLabels(); + this.refreshPlan(); + } } }