changeset 5288:48bef30cdb72

Client: limit displaying of error popup to only pdf-export mode(ECDIS layer)
author Fadi Abbud <fadi.abbud@intevation.de>
date Fri, 03 Jul 2020 15:37:42 +0200
parents 3ec58a8c42f5
children 002e57f99dc9
files client/src/components/Pdftool.vue client/src/components/map/Map.vue client/src/store/application.js
diffstat 3 files changed, 31 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/components/Pdftool.vue	Wed Jul 01 17:57:17 2020 +0200
+++ b/client/src/components/Pdftool.vue	Fri Jul 03 15:37:42 2020 +0200
@@ -345,6 +345,7 @@
        * Details: https://gis.stackexchange.com/questions/328933/openlayers-generating-clientside-pdfs
        *
        */
+      this.$store.commit("application/setOngoingPDFExport", true);
       this.readyToGenerate = false;
       this.setPDFDimension();
       // FUTURE: consider margins
@@ -511,6 +512,7 @@
         map.setSize(this.mapSize);
         map.getView().setResolution(this.resolution);
         this.readyToGenerate = true;
+        this.$store.commit("application/setOngoingPDFExport", false);
       });
 
       const size = map.getSize();
@@ -548,6 +550,7 @@
           .getView()
           .setResolution(this.resolution);
       } finally {
+        this.$store.commit("application/setOngoingPDFExport", false);
         this.readyToGenerate = true;
       }
     },
--- a/client/src/components/map/Map.vue	Wed Jul 01 17:57:17 2020 +0200
+++ b/client/src/components/map/Map.vue	Fri Jul 03 15:37:42 2020 +0200
@@ -68,7 +68,12 @@
     ]),
     ...mapState("bottlenecks", ["selectedSurvey"]),
     ...mapState("fairwayprofile", ["additionalSurvey"]),
-    ...mapState("application", ["paneSetup", "paneRotate", "config"]),
+    ...mapState("application", [
+      "paneSetup",
+      "paneRotate",
+      "config",
+      "ongoingPDFExport"
+    ]),
     ...mapState("imports", ["selectedStretchId", "selectedSectionId"]),
     layers() {
       return layerFactory(this.paneId);
@@ -288,22 +293,24 @@
         params: JSON.parse(this.config.ecdis_wms_params)
       });
       source.on("imageloaderror", error => {
-        console.log(error);
-        displayError({
-          title: this.$gettext("Loading Error"),
-          message: this.$gettext(
-            "The ECDIS chart could not be loaded completely, the map might be corrupted. Please retry later"
-          ),
-          options: {
-            timeout: 0,
-            showProgressBar: false,
-            closeOnClick: true,
-            pauseOnHover: true,
-            oneAtTime: true,
-            bodyMaxLength: 1024
-          }
-        });
+        if (this.ongoingPDFExport) {
+          console.log(error);
+          displayError({
+            title: this.$gettext("Loading Error"),
+            message: this.$gettext(
+              "The ECDIS chart could not be loaded completely, the map might be corrupted. Please retry later"
+            ),
+            options: {
+              timeout: 0,
+              showProgressBar: false,
+              closeOnClick: true,
+              pauseOnHover: true,
+              bodyMaxLength: 1024
+            }
+          });
+        }
       });
+
       this.layers.get("INLANDECDIS").setSource(source);
       this.map = new Map({
         layers: this.layers.config,
--- a/client/src/store/application.js	Wed Jul 01 17:57:17 2020 +0200
+++ b/client/src/store/application.js	Fri Jul 03 15:37:42 2020 +0200
@@ -53,7 +53,8 @@
     storedTime: new Date(),
     version,
     tempRoute: "",
-    config: {}
+    config: {},
+    ongoingPDFExport: false
   };
 };
 
@@ -82,6 +83,9 @@
     }
   },
   mutations: {
+    setOngoingPDFExport: (state, ongoingPDFExport) => {
+      state.ongoingPDFExport = ongoingPDFExport;
+    },
     setCurrentVisibleTime: (state, currentVisibleTime) => {
       state.currentVisibleTime = currentVisibleTime;
     },