# HG changeset patch # User Thomas Junk # Date 1558611455 -7200 # Node ID 7ea54c3b3fd6694c9b8af03fd2da00061106f6f5 # Parent 1ba669cbbee66e7e31ce6bd978020130681bf1ae afd: breaks for bottlenecks diff -r 1ba669cbbee6 -r 7ea54c3b3fd6 client/src/components/fairway/AvailableFairwayDepthDialogue.vue --- 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 @@ -
+
Depthlimit 1 (in cm)
-
+
Depthlimit 2 ( in cm)
-
+
Widthlimit 1
-
+
Widthlimit 2 { this.$store.commit("application/paneSetup", "AVAILABLEFAIRWAYDEPTH"); diff -r 1ba669cbbee6 -r 7ea54c3b3fd6 client/src/components/importconfiguration/types/Soundingresults.vue --- 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) ); diff -r 1ba669cbbee6 -r 7ea54c3b3fd6 client/src/store/bottlenecks.js --- 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", diff -r 1ba669cbbee6 -r 7ea54c3b3fd6 client/src/store/fairwayavailability.js --- 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") } })