comparison client/src/components/identify/Identify.vue @ 5356:3216b4a19023 extented-report

spinner added to info tool's download link for DQL reports
author Thomas Junk <thomas.junk@intevation.de>
date Tue, 22 Jun 2021 14:44:34 +0200
parents 2578fd6f4c63
children dbae10503ee6
comparison
equal deleted inserted replaced
5355:16c026da50b1 5356:3216b4a19023
185 class="border-top text-left pl-2" 185 class="border-top text-left pl-2"
186 style="font-size: 90%;" 186 style="font-size: 90%;"
187 > 187 >
188 <translate>Download</translate> 188 <translate>Download</translate>
189 <div class="d-flex flex-column"> 189 <div class="d-flex flex-column">
190 <font-awesome-icon
191 v-if="loadingDQL"
192 icon="spinner"
193 :spin="true"
194 fixed-width
195 />
190 <a 196 <a
191 v-if="DQLDownloadAllowed" 197 v-if="DQLDownloadAllowed"
192 href="#" 198 href="#"
193 @click="downloadDataQualityReport" 199 @click="downloadDataQualityReport"
194 > 200 >
295 301
296 export default { 302 export default {
297 name: "identify", 303 name: "identify",
298 data() { 304 data() {
299 return { 305 return {
306 loadingDQL: false,
300 refGaugeStatus: "", 307 refGaugeStatus: "",
301 gaugeStatus: "", 308 gaugeStatus: "",
302 gaugeCoeffs: null, 309 gaugeCoeffs: null,
303 refGaugeCoeffs: null 310 refGaugeCoeffs: null
304 }; 311 };
309 ...mapGetters("map", ["filteredIdentifiedFeatures"]), 316 ...mapGetters("map", ["filteredIdentifiedFeatures"]),
310 ...mapState("map", ["currentMeasurement"]), 317 ...mapState("map", ["currentMeasurement"]),
311 ...mapState("gauges", ["gauges"]), 318 ...mapState("gauges", ["gauges"]),
312 ...mapGetters("user", ["isWaterwayAdmin", "isSysAdmin"]), 319 ...mapGetters("user", ["isWaterwayAdmin", "isSysAdmin"]),
313 DQLDownloadAllowed() { 320 DQLDownloadAllowed() {
321 if (this.loadingDQL) return false;
314 return this.isWaterwayAdmin || this.isSysAdmin; 322 return this.isWaterwayAdmin || this.isSysAdmin;
315 }, 323 },
316 identifiedLabel() { 324 identifiedLabel() {
317 return this.$gettext("Identified Features"); 325 return this.$gettext("Identified Features");
318 }, 326 },
420 } 428 }
421 } 429 }
422 }, 430 },
423 methods: { 431 methods: {
424 downloadDataQualityReport() { 432 downloadDataQualityReport() {
433 this.loadingDQL = true;
425 HTTP.get(`/data/report/default`, { 434 HTTP.get(`/data/report/default`, {
426 responseType: "blob", 435 responseType: "blob",
427 headers: { 436 headers: {
428 "X-Gemma-Auth": localStorage.getItem("token") 437 "X-Gemma-Auth": localStorage.getItem("token")
429 } 438 }
445 } 454 }
446 displayError({ 455 displayError({
447 title: this.$gettext("Backend Error"), 456 title: this.$gettext("Backend Error"),
448 message: message 457 message: message
449 }); 458 });
459 })
460 .finally(() => {
461 this.loadingDQL = false;
450 }); 462 });
451 }, 463 },
452 getGaugeStatusText(feature) { 464 getGaugeStatusText(feature) {
453 if (/bottleneck/.test(feature.getId())) return this.refGaugeStatusText; 465 if (/bottleneck/.test(feature.getId())) return this.refGaugeStatusText;
454 return this.gaugeStatusText; 466 return this.gaugeStatusText;