Mercurial > gemma
comparison client/src/components/importconfiguration/types/Soundingresults.vue @ 3700:2d77a7447d09
import_soundingresult: restrict users to import only data for bottlenecks they are responsible for
author | Thomas Junk <thomas.junk@intevation.de> |
---|---|
date | Wed, 19 Jun 2019 11:27:14 +0200 |
parents | 5754793ff9b0 |
children | ee7dc0bea083 |
comparison
equal
deleted
inserted
replaced
3699:a925e4e323a8 | 3700:2d77a7447d09 |
---|---|
199 * Thomas Junk <thomas.junk@intevation.de> | 199 * Thomas Junk <thomas.junk@intevation.de> |
200 * Markus Kottländer <markus.kottlaender@intevation.de> | 200 * Markus Kottländer <markus.kottlaender@intevation.de> |
201 */ | 201 */ |
202 import { HTTP } from "@/lib/http"; | 202 import { HTTP } from "@/lib/http"; |
203 import { displayError, displayInfo } from "@/lib/errors"; | 203 import { displayError, displayInfo } from "@/lib/errors"; |
204 import { mapState } from "vuex"; | 204 import { mapState, mapGetters } from "vuex"; |
205 | 205 |
206 const IMPORTSTATE = { UPLOAD: "UPLOAD", EDIT: "EDIT" }; | 206 const IMPORTSTATE = { UPLOAD: "UPLOAD", EDIT: "EDIT" }; |
207 | 207 |
208 export default { | 208 export default { |
209 data() { | 209 data() { |
349 } | 349 } |
350 }, | 350 }, |
351 computed: { | 351 computed: { |
352 ...mapState("application", ["showContextBox"]), | 352 ...mapState("application", ["showContextBox"]), |
353 ...mapState("bottlenecks", ["bottlenecks"]), | 353 ...mapState("bottlenecks", ["bottlenecks"]), |
354 ...mapState("user", ["user"]), | |
355 ...mapGetters("usermanagement", ["userCountries"]), | |
354 importSoundingresultsLabel() { | 356 importSoundingresultsLabel() { |
355 return this.$gettext("Import Soundingresults"); | 357 return this.$gettext("Import Soundingresults"); |
356 }, | 358 }, |
357 disableUploadButton() { | 359 disableUploadButton() { |
358 if (this.importState === IMPORTSTATE.UPLOAD) return this.disableUpload; | 360 if (this.importState === IMPORTSTATE.UPLOAD) return this.disableUpload; |
364 ) | 366 ) |
365 return true; | 367 return true; |
366 return this.disableUpload; | 368 return this.disableUpload; |
367 }, | 369 }, |
368 availableBottlenecks() { | 370 availableBottlenecks() { |
369 return this.bottlenecks; | 371 const userCountrycode = this.userCountries[this.user]; |
372 if (userCountrycode === "global") return this.bottlenecks; | |
373 return this.bottlenecks.filter( | |
374 bn => bn.properties.responsible_country === userCountrycode | |
375 ); | |
370 }, | 376 }, |
371 placeholder() { | 377 placeholder() { |
372 return this.$gettext("Select bottleneck"); | 378 return this.$gettext("Select bottleneck"); |
373 }, | 379 }, |
374 orderedBottlenecks() { | 380 orderedBottlenecks() { |