Mercurial > gemma
changeset 3407:7ea54c3b3fd6
afd: breaks for bottlenecks
author | Thomas Junk <thomas.junk@intevation.de> |
---|---|
date | Thu, 23 May 2019 13:37:35 +0200 |
parents | 1ba669cbbee6 |
children | a26c1d745fc3 |
files | client/src/components/fairway/AvailableFairwayDepthDialogue.vue client/src/components/importconfiguration/types/Soundingresults.vue client/src/store/bottlenecks.js client/src/store/fairwayavailability.js |
diffstat | 4 files changed, 94 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/client/src/components/fairway/AvailableFairwayDepthDialogue.vue Thu May 23 13:09:49 2019 +0200 +++ b/client/src/components/fairway/AvailableFairwayDepthDialogue.vue Thu May 23 13:37:35 2019 +0200 @@ -132,13 +132,12 @@ </div> </div> - <div class="d-flex mt-2"> + <div v-if="depthLimitVisible" class="d-flex mt-2" :key="1"> <div class="d-flex flex-column w-50 mr-1"> <small for="from" class="my-auto text-muted"> <translate>Depthlimit 1 (in cm)</translate> </small> <input - :key="1" id="depthlimit1" v-model.number="depthLimit1" class="form-control form-control-sm" @@ -146,12 +145,15 @@ min="0" /> </div> - <div class="d-flex flex-column w-50 ml-1"> + <div + v-if="depthLimitVisible" + class="d-flex flex-column w-50 ml-1" + :key="2" + > <small for="to" class="my-auto text-muted"> <translate>Depthlimit 2 ( in cm)</translate> </small> <input - :key="2" id="depthlimit2" v-model.number="depthLimit2" class="form-control form-control-sm" @@ -160,13 +162,12 @@ /> </div> </div> - <div class="d-flex mt-2"> + <div v-if="widthLimitVisible" class="d-flex mt-2" :key="3"> <div class="d-flex flex-column w-50 mr-1"> <small for="from" class="my-auto text-muted"> <translate>Widthlimit 1</translate> </small> <input - :key="3" id="widthLimit" v-model.number="widthLimit1" class="form-control form-control-sm" @@ -174,12 +175,15 @@ min="0" /> </div> - <div class="d-flex flex-column w-50 mr-1"> + <div + v-if="widthLimitVisible" + class="d-flex flex-column w-50 mr-1" + :key="4" + > <small for="from" class="my-auto text-muted"> <translate>Widthlimit 2</translate> </small> <input - :key="4" id="widthLimit" v-model.number="widthLimit2" class="form-control form-control-sm" @@ -269,7 +273,36 @@ ]), ...mapState("bottlenecks", ["bottlenecksList", "selectedBottleneck"]), ...mapGetters("map", ["openLayersMap"]), - ...mapGetters("bottlenecks", ["orderedBottlenecks"]), + ...mapGetters("bottlenecks", [ + "orderedBottlenecks", + "limitingFactorsPerBottleneck" + ]), + depthLimitVisible() { + if (this.type !== this.$options.BOTTLENECKS) return true; + if ( + this.selectedEntry && + this.limitingFactorsPerBottleneck[this.selectedEntry.properties.name] == + this.$options.LIMITINGFACTORS.DEPTH + ) + return true; + return false; + }, + widthLimitVisible() { + if (this.type !== this.$options.BOTTLENECKS) return true; + if ( + this.selectedEntry && + this.limitingFactorsPerBottleneck[this.selectedEntry.properties.name] == + this.$options.LIMITINGFACTORS.WIDTH + ) + return true; + }, + limitingFactor() { + if (this.type !== this.$options.BOTTLENECKS) return; + if (this.selectedEntry) + return this.limitingFactorsPerBottleneck[ + this.selectedEntry.properties.name + ]; + }, isComplete() { return ( this.from !== null && @@ -413,6 +446,7 @@ if (this.showFairwayDepth) { this.loading = true; Promise.all([ + this.$store.dispatch("bottlenecks/loadBottlenecks"), this.$store.dispatch("bottlenecks/loadBottlenecksList"), this.$store.dispatch("imports/loadStretches"), this.$store.dispatch("imports/loadSections") @@ -460,7 +494,13 @@ from: this.from, to: this.to, frequency: this.frequency, - LOS: this.los + LOS: this.los, + type: this.type, + depthLimit1: this.depthLimit1, + depthLimit2: this.depthLimit2, + widthLimit1: this.widthLimit1, + widthLimit2: this.widthLimit2, + limitingFactor: this.limitingFactor }) .then(() => { this.$store.commit("application/paneSetup", "AVAILABLEFAIRWAYDEPTH");
--- a/client/src/components/importconfiguration/types/Soundingresults.vue Thu May 23 13:09:49 2019 +0200 +++ b/client/src/components/importconfiguration/types/Soundingresults.vue Thu May 23 13:37:35 2019 +0200 @@ -365,10 +365,7 @@ } }, depthReferenceOptions() { - if ( - this.bottleneck && - this.bottleneck.properties.reference_water_levels - ) { + if (this.bottleneck) { return Object.keys( JSON.parse(this.bottleneck.properties.reference_water_levels) );
--- a/client/src/store/bottlenecks.js Thu May 23 13:09:49 2019 +0200 +++ b/client/src/store/bottlenecks.js Thu May 23 13:37:35 2019 +0200 @@ -33,6 +33,13 @@ namespaced: true, state: init(), getters: { + limitingFactorsPerBottleneck: state => { + if (state.bottlenecks.length === 0) return {}; + return state.bottlenecks.reduce((o, n) => { + o[n.properties.objnam] = n.properties.limiting; + return o; + }, {}); + }, orderedBottlenecks: state => { let groupedBottlenecks = {}, orderedGroups = {}; @@ -167,7 +174,8 @@ featureNS: "gemma", featurePrefix: "gemma", featureTypes: ["bottlenecks_geoserver"], - outputFormat: "application/json" + outputFormat: "application/json", + propertyNames: ["objnam", "limiting", "reference_water_levels"] }); HTTP.post( "/internal/wfs",
--- a/client/src/store/fairwayavailability.js Thu May 23 13:09:49 2019 +0200 +++ b/client/src/store/fairwayavailability.js Thu May 23 13:37:35 2019 +0200 @@ -41,6 +41,12 @@ DEPTH: "depth" }; +const TYPES = { + BOTTLENECKS: "bottlenecks", + SECTIONS: "sections", + STRETCHES: "stretches" +}; + const FREQUENCIES = { MONTHLY: "monthly", QUARTERLY: "quarterly", @@ -162,18 +168,43 @@ actions: { loadAvailableFairwayDepth: ({ commit }, options) => { return new Promise((resolve, reject) => { - const { feature, frequency, LOS } = options; + const { + feature, + frequency, + LOS, + depthLimit1, + depthLimit2, + widthLimit1, + widthLimit2, + limitingFactor, + type + } = options; + if (type !== TYPES.BOTTLENECKS) return; let { from, to } = options; let name = feature.constructor.name === "Feature" ? feature.get("objnam") : feature.properties.name; [from, to] = getIntervallBorders(from, to, frequency); + let additionalParams = ""; + let endpoint = ""; + switch (type) { + case TYPES.BOTTLENECKS: + endpoint = "bottleneck"; + if (limitingFactor === LIMITINGFACTORS.DEPTH) + additionalParams = `&breaks=${depthLimit1},${depthLimit2}`; + if (limitingFactor === LIMITINGFACTORS.WIDTH) + additionalParams = `&breaks=${widthLimit1},${widthLimit2}`; + break; + default: + throw new Error("Wrong selection"); + } const start = encodeURIComponent("00:00:00+00:00"); const end = encodeURIComponent("23:59:59+00:00"); - const URL = `/data/bottleneck/fairway-depth/${encodeURIComponent( + const URL = `/data/${endpoint}/fairway-depth/${encodeURIComponent( name - )}?from=${from}T${start}&to=${to}T${end}&mode=${frequency}&los=${LOS}`; + )}?from=${from}T${start}&to=${to}T${end}&mode=${frequency}&los=${LOS}${additionalParams}`; + console.log(URL); HTTP.get(URL, { headers: { "X-Gemma-Auth": localStorage.getItem("token") } })