Mercurial > gemma
diff client/src/store/gauges.js @ 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 | 762b140e91a0 |
children | d7cc5cda82a9 |
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) => {