Mercurial > gemma
comparison client/src/components/fairway/BottleneckDialogue.vue @ 4521:245e6215361e
Client: BottleneckDialogue: fix rights on creating the deletion job for (SR)
author | Fadi Abbud <fadi.abbud@intevation.de> |
---|---|
date | Mon, 07 Oct 2019 09:29:30 +0200 |
parents | 4c3851391b6d |
children | 9887061df57b |
comparison
equal
deleted
inserted
replaced
4520:aeb2aedd3abd | 4521:245e6215361e |
---|---|
86 :value="survey" | 86 :value="survey" |
87 >{{ survey.date_info | surveyDate }}</option | 87 >{{ survey.date_info | surveyDate }}</option |
88 > | 88 > |
89 </select> | 89 </select> |
90 <button | 90 <button |
91 v-if="isAllowedToDelete" | |
91 class="btn btn-dark btn-xs ml-2" | 92 class="btn btn-dark btn-xs ml-2" |
92 @click="deleteSelectedSurvey" | 93 @click="deleteSelectedSurvey" |
93 > | 94 > |
94 <font-awesome-icon icon="trash" /> | 95 <font-awesome-icon icon="trash" /> |
95 </button> | 96 </button> |
345 cutLabel: "", | 346 cutLabel: "", |
346 showLabelInput: false | 347 showLabelInput: false |
347 }; | 348 }; |
348 }, | 349 }, |
349 computed: { | 350 computed: { |
351 ...mapState("user", ["user"]), | |
352 ...mapGetters("user", ["isWaterwayAdmin", "isSysAdmin"]), | |
353 ...mapGetters("usermanagement", ["userCountries"]), | |
350 ...mapState("application", ["showProfiles", "paneSetup"]), | 354 ...mapState("application", ["showProfiles", "paneSetup"]), |
351 ...mapState("map", ["openLayersMaps", "syncedMaps", "cutToolEnabled"]), | 355 ...mapState("map", ["openLayersMaps", "syncedMaps", "cutToolEnabled"]), |
352 ...mapState("bottlenecks", [ | 356 ...mapState("bottlenecks", [ |
353 "bottlenecksList", | 357 "bottlenecksList", |
354 "surveys", | 358 "surveys", |
355 "surveysLoading" | 359 "surveysLoading" |
356 ]), | 360 ]), |
361 isAllowedToDelete() { | |
362 const userCountryCode = this.userCountries[this.user]; | |
363 const bottleneck = this.bottlenecksList.find( | |
364 bn => bn.properties.name === this.selectedBottleneck | |
365 ); | |
366 if (!bottleneck) return; | |
367 if (this.isWaterwayAdmin || this.isSysAdmin) { | |
368 if ( | |
369 userCountryCode === "global" || | |
370 bottleneck.properties.responsible_country === userCountryCode | |
371 ) { | |
372 return true; | |
373 } | |
374 } | |
375 return false; | |
376 }, | |
357 ...mapState("fairwayprofile", [ | 377 ...mapState("fairwayprofile", [ |
358 "previousCuts", | 378 "previousCuts", |
359 "startPoint", | 379 "startPoint", |
360 "endPoint", | 380 "endPoint", |
361 "profileLoading", | 381 "profileLoading", |
755 preventZoomOut: true | 775 preventZoomOut: true |
756 }); | 776 }); |
757 } | 777 } |
758 }, | 778 }, |
759 mounted() { | 779 mounted() { |
780 this.$store.dispatch("usermanagement/loadUsers").catch(error => { | |
781 const { status, data } = error.response; | |
782 displayError({ | |
783 title: this.$gettext("Backend Error"), | |
784 message: `${status}: ${data.message || data}` | |
785 }); | |
786 }); | |
760 this.$store.dispatch("bottlenecks/loadBottlenecksList"); | 787 this.$store.dispatch("bottlenecks/loadBottlenecksList"); |
761 } | 788 } |
762 }; | 789 }; |
763 </script> | 790 </script> |