changeset 3152:8e31e5b9b37a

client: gauge diagrams: refresh data when switching between gauges
author Markus Kottlaender <markus@intevation.de>
date Fri, 03 May 2019 13:51:09 +0200
parents 47453337c698
children 8159bd2aaf93
files client/src/store/gauges.js
diffstat 1 files changed, 9 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/store/gauges.js	Fri May 03 13:36:31 2019 +0200
+++ b/client/src/store/gauges.js	Fri May 03 13:51:09 2019 +0200
@@ -79,9 +79,15 @@
     }
   },
   actions: {
-    selectedGaugeISRS: ({ commit }, isrs) => {
-      commit("selectedGaugeISRS", isrs);
-      commit("application/showGauges", true, { root: true });
+    selectedGaugeISRS: ({ commit, dispatch, state }, isrs) => {
+      if (state.selectedGaugeISRS !== isrs) {
+        commit("selectedGaugeISRS", isrs);
+        commit("application/showGauges", true, { root: true });
+        dispatch("loadWaterlevels");
+        dispatch("loadLongtermWaterlevels");
+        dispatch("loadYearWaterlevels");
+        dispatch("loadNashSutcliffe");
+      }
     },
     loadGauges: ({ commit }) => {
       return new Promise((resolve, reject) => {