diff client/src/components/identify/Identify.vue @ 5396:064ac1014713 extented-report

Make DQL-Downloads a bit more dynamic
author Thomas Junk <thomas.junk@intevation.de>
date Fri, 02 Jul 2021 17:14:04 +0200
parents dbae10503ee6
children 84d01a536bec
line wrap: on
line diff
--- a/client/src/components/identify/Identify.vue	Fri Jul 02 14:16:02 2021 +0200
+++ b/client/src/components/identify/Identify.vue	Fri Jul 02 17:14:04 2021 +0200
@@ -193,13 +193,21 @@
             :spin="true"
             fixed-width
           />
-          <a
-            v-if="DQLDownloadAllowed"
-            href="#"
-            @click="downloadDataQualityReport"
-          >
-            <translate>Data quality report</translate>
-          </a>
+          <template v-if="DQLDownloadAllowed">
+            <a
+              v-for="(reportName, index) in availableReports"
+              :key="index"
+              href="#"
+              @click="downloadDataQualityReport(reportName)"
+            >
+              {{
+                reportName
+                  .split("-")
+                  .map(s => (s && s[0].toUpperCase() + s.slice(1)) || "")
+                  .join(" ")
+              }}
+            </a>
+          </template>
           <a
             v-if="userManualUrl"
             :href="userManualUrl ? userManualUrl : '#'"
@@ -317,6 +325,7 @@
     ...mapState("map", ["currentMeasurement"]),
     ...mapState("gauges", ["gauges"]),
     ...mapGetters("user", ["isWaterwayAdmin", "isSysAdmin"]),
+    ...mapState("importschedule", ["availableReports"]),
     DQLDownloadAllowed() {
       if (this.loadingDQL) return false;
       return this.isWaterwayAdmin || this.isSysAdmin;
@@ -429,9 +438,9 @@
     }
   },
   methods: {
-    downloadDataQualityReport() {
+    downloadDataQualityReport(reportName) {
       this.loadingDQL = true;
-      HTTP.get(`/data/report/data-quality-report`, {
+      HTTP.get(`/data/report/${reportName}`, {
         responseType: "blob",
         headers: {
           "X-Gemma-Auth": localStorage.getItem("token")