Mercurial > gemma
changeset 3486:1fbb6dc7d362
fairwayavailability: refactor constants
author | Thomas Junk <thomas.junk@intevation.de> |
---|---|
date | Mon, 27 May 2019 16:33:30 +0200 |
parents | ef4803f87631 |
children | aa264021e2bf e6673f35d5d1 |
files | client/src/components/fairway/AvailableFairwayDepthDialogue.vue client/src/store/fairwayavailability.js |
diffstat | 2 files changed, 33 insertions(+), 33 deletions(-) [+] |
line wrap: on
line diff
--- a/client/src/components/fairway/AvailableFairwayDepthDialogue.vue Mon May 27 16:28:22 2019 +0200 +++ b/client/src/components/fairway/AvailableFairwayDepthDialogue.vue Mon May 27 16:33:30 2019 +0200 @@ -11,26 +11,26 @@ <UISpinnerOverlay v-if="loading" /> <div class="mb-2 d-flex justify-content-between align-items-center"> <div> - <input :value="$options.BOTTLENECKS" type="radio" v-model="type" /> + <input :value="$options.BOTTLENECK" type="radio" v-model="type" /> <small class="ml-1 text-muted"> <translate>Bottlenecks</translate> </small> </div> <div> - <input :value="$options.STRETCHES" type="radio" v-model="type" /> + <input :value="$options.STRETCH" type="radio" v-model="type" /> <small class="ml-1 text-muted"> <translate>Stretches</translate> </small> </div> <div> - <input :value="$options.SECTIONS" type="radio" v-model="type" /> + <input :value="$options.SECTION" type="radio" v-model="type" /> <small class="ml-1 text-muted"> <translate>Sections</translate> </small> </div> </div> <select - v-if="type === $options.BOTTLENECKS" + v-if="type === $options.BOTTLENECK" @change="entrySelected" class="form-control font-weight-bold" v-model="selectedEntry" @@ -51,7 +51,7 @@ </optgroup> </select> <select - v-else-if="type === $options.STRETCHES" + v-else-if="type === $options.STRETCH" @change="entrySelected" class="form-control font-weight-bold" v-model="selectedEntry" @@ -66,7 +66,7 @@ </option> </select> <select - v-else-if="type === $options.SECTIONS" + v-else-if="type === $options.SECTION" @change="entrySelected" class="form-control font-weight-bold" v-model="selectedEntry" @@ -278,7 +278,7 @@ "limitingFactorsPerBottleneck" ]), depthLimitVisible() { - if (this.type !== this.$options.BOTTLENECKS) return true; + if (this.type !== this.$options.BOTTLENECK) return true; if ( this.selectedEntry && this.limitingFactorsPerBottleneck[this.selectedEntry.properties.name] == @@ -288,7 +288,7 @@ return false; }, widthLimitVisible() { - if (this.type !== this.$options.BOTTLENECKS) return true; + if (this.type !== this.$options.BOTTLENECK) return true; if ( this.selectedEntry && this.limitingFactorsPerBottleneck[this.selectedEntry.properties.name] == @@ -297,7 +297,7 @@ return true; }, limitingFactor() { - if (this.type !== this.$options.BOTTLENECKS) return; + if (this.type !== this.$options.BOTTLENECK) return; if (this.selectedEntry) return this.limitingFactorsPerBottleneck[ this.selectedEntry.properties.name @@ -399,38 +399,38 @@ return this.$gettext("Available fairway depth"); }, placeholder() { - if (this.type === this.$options.BOTTLENECKS) + if (this.type === this.$options.BOTTLENECK) return this.$gettext("Select bottleneck"); - if (this.type === this.$options.STRETCHES) + if (this.type === this.$options.STRETCH) return this.$gettext("Select stretch"); return this.$gettext("Select section"); } }, watch: { selectedBottleneck() { - this.type = this.$options.BOTTLENECKS; + this.type = this.$options.BOTTLENECK; this.setSelectedBottleneck(); }, selectedStretchId() { - this.type = this.$options.STRETCHES; + this.type = this.$options.STRETCH; this.setSelectedStretch(); }, selectedSectionId() { - this.type = this.$options.SECTIONS; + this.type = this.$options.SECTION; this.setSelectedSection(); }, type(type) { - if (type === this.$options.BOTTLENECKS && this.selectedBottleneck) { + if (type === this.$options.BOTTLENECK && this.selectedBottleneck) { this.openLayersMap() .getLayer("BOTTLENECKS") .setVisible(true); this.setSelectedBottleneck(); - } else if (type === this.$options.STRETCHES && this.selectedStretchId) { + } else if (type === this.$options.STRETCH && this.selectedStretchId) { this.openLayersMap() .getLayer("STRETCHES") .setVisible(true); this.setSelectedStretch(); - } else if (type === this.$options.SECTIONS && this.selectedSectionId) { + } else if (type === this.$options.SECTION && this.selectedSectionId) { this.openLayersMap() .getLayer("SECTIONS") .setVisible(true); @@ -528,7 +528,7 @@ this.$store.commit("application/showFairwayDepthLNWL", false); }, entrySelected() { - if (this.type === this.$options.BOTTLENECKS) { + if (this.type === this.$options.BOTTLENECK) { this.openLayersMap() .getLayer("BOTTLENECKS") .setVisible(true); @@ -539,12 +539,12 @@ ); } } - if (this.type === this.$options.STRETCHES) { + if (this.type === this.$options.STRETCH) { this.openLayersMap() .getLayer("STRETCHES") .setVisible(true); } - if (this.type === this.$options.SECTIONS) { + if (this.type === this.$options.SECTION) { this.openLayersMap() .getLayer("SECTIONS") .setVisible(true); @@ -581,9 +581,9 @@ ); } }, - BOTTLENECKS: "bottlenecks", - SECTIONS: "sections", - STRETCHES: "stretches", + BOTTLENECK: "bottleneck", + SECTION: "section", + STRETCH: "stretch", AVAILABLEFAIRWAYDEPTH: app.$gettext("Available Fairway Depth"), FREQUENCIES: FREQUENCIES, LIMITINGFACTORS: LIMITINGFACTORS
--- a/client/src/store/fairwayavailability.js Mon May 27 16:28:22 2019 +0200 +++ b/client/src/store/fairwayavailability.js Mon May 27 16:33:30 2019 +0200 @@ -32,9 +32,9 @@ }; const TYPES = { - BOTTLENECKS: "bottlenecks", - SECTIONS: "sections", - STRETCHES: "stretches" + BOTTLENECK: "bottleneck", + SECTION: "section", + STRETCH: "stretch" }; const FREQUENCIES = { @@ -67,7 +67,7 @@ const init = () => { return { - type: "bottlenecks", + type: TYPES.BOTTLENECK, selectedFairwayAvailabilityFeature: null, to: format(new Date(), "YYYY-MM-DD"), from: format(subYears(new Date(), 1), "YYYY-MM-DD"), @@ -222,18 +222,18 @@ let additionalParams = ""; let endpoint = ""; switch (type) { - case TYPES.BOTTLENECKS: + case TYPES.BOTTLENECK: endpoint = "bottleneck"; if (limitingFactor === LIMITINGFACTORS.DEPTH) additionalParams = `&breaks=${depthLimit1},${depthLimit2}`; if (limitingFactor === LIMITINGFACTORS.WIDTH) additionalParams = `&breaks=${widthLimit1},${widthLimit2}`; break; - case TYPES.SECTIONS: + case TYPES.SECTION: endpoint = "section"; additionalParams = `&depthbreaks=${depthLimit1},${depthLimit2}&widthbreaks=${widthLimit1},${widthLimit2}`; break; - case TYPES.STRETCHES: + case TYPES.STRETCH: endpoint = "stretch"; additionalParams = `&depthbreaks=${depthLimit1},${depthLimit2}&widthbreaks=${widthLimit1},${widthLimit2}`; break; @@ -285,18 +285,18 @@ let additionalParams = ""; let endpoint = ""; switch (type) { - case TYPES.BOTTLENECKS: + case TYPES.BOTTLENECK: endpoint = "bottleneck"; if (limitingFactor === LIMITINGFACTORS.DEPTH) additionalParams = `&breaks=${depthLimit1},${depthLimit2}`; if (limitingFactor === LIMITINGFACTORS.WIDTH) additionalParams = `&breaks=${widthLimit1},${widthLimit2}`; break; - case TYPES.SECTIONS: + case TYPES.SECTION: endpoint = "section"; additionalParams = `&depthbreaks=${depthLimit1},${depthLimit2}&widthbreaks=${widthLimit1},${widthLimit2}`; break; - case TYPES.STRETCHES: + case TYPES.STRETCH: endpoint = "stretch"; additionalParams = `&depthbreaks=${depthLimit1},${depthLimit2}&widthbreaks=${widthLimit1},${widthLimit2}`; break;