diff client/src/components/map/fairway/Profiles.vue @ 1394:b350b0b5cb6c

refactored fairwayprofile cross cuts moved all profile relevant data into Fairwayprofile.vue fixed width calculation of diagram fix bug when switching between sounding data fixed display/styling issue code cleanup
author Markus Kottlaender <markus@intevation.de>
date Wed, 28 Nov 2018 11:48:45 +0100
parents 801ae5f4bc5b
children 210e9f16f8a0
line wrap: on
line diff
--- a/client/src/components/map/fairway/Profiles.vue	Wed Nov 28 11:35:14 2018 +0100
+++ b/client/src/components/map/fairway/Profiles.vue	Wed Nov 28 11:48:45 2018 +0100
@@ -185,7 +185,6 @@
         return this.$store.state.bottlenecks.selectedBottleneck;
       },
       set(name) {
-        this.loading = true;
         this.$store.dispatch("bottlenecks/setSelectedBottleneck", name);
       }
     },
@@ -194,7 +193,8 @@
         return this.$store.state.bottlenecks.selectedSurvey;
       },
       set(survey) {
-        this.$store.commit("bottlenecks/setSelectedSurvey", survey);
+        this.$store.commit("fairwayprofile/additionalSurvey", null);
+        this.$store.commit("bottlenecks/selectedSurvey", survey);
       }
     },
     additionalSurvey: {
@@ -234,13 +234,10 @@
         this.selectedBottleneck + " (" + new Date().toISOString() + ")";
     },
     selectedSurvey(survey) {
-      this.$store.commit("fairwayprofile/additionalSurvey", null);
-      if (survey) {
-        this.$store.dispatch("fairwayprofile/loadProfile", survey);
-      }
+      this.loadProfile(survey);
     },
     additionalSurvey(survey) {
-      if (survey) this.$store.dispatch("fairwayprofile/loadProfile", survey);
+      this.loadProfile(survey);
     },
     coordinatesSelect(newValue) {
       if (newValue) {
@@ -250,6 +247,16 @@
     }
   },
   methods: {
+    loadProfile(survey) {
+      if (survey) {
+        this.$store.commit("fairwayprofile/profileLoading", true);
+        this.$store
+          .dispatch("fairwayprofile/loadProfile", survey)
+          .finally(() =>
+            this.$store.commit("fairwayprofile/profileLoading", false)
+          );
+      }
+    },
     toggleCutTool() {
       if (this.selectedSurvey) {
         this.cutTool.setActive(!this.cutTool.getActive());