comparison client/src/components/fairway/AvailableFairwayDepth.vue @ 4386:bad093433899

AFD: frequency decoupled
author Thomas Junk <thomas.junk@intevation.de>
date Thu, 12 Sep 2019 15:49:31 +0200
parents 7d9376f8a28c
children d6c38a22c71e
comparison
equal deleted inserted replaced
4385:610773d34e4f 4386:bad093433899
98 components: { 98 components: {
99 DiagramLegend: () => import("@/components/DiagramLegend") 99 DiagramLegend: () => import("@/components/DiagramLegend")
100 }, 100 },
101 data() { 101 data() {
102 return { 102 return {
103 frequencyD: null,
103 selectedFairwayAvailabilityFeatureD: null, 104 selectedFairwayAvailabilityFeatureD: null,
104 fromDate: null, 105 fromDate: null,
105 toDate: null, 106 toDate: null,
106 depthlimit1D: null, 107 depthlimit1D: null,
107 depthlimit2D: null, 108 depthlimit2D: null,
202 }, 203 },
203 dataLink() { 204 dataLink() {
204 return `data:text/csv;charset=utf-8, ${encodeURIComponent(this.csv)}`; 205 return `data:text/csv;charset=utf-8, ${encodeURIComponent(this.csv)}`;
205 }, 206 },
206 csvFileName() { 207 csvFileName() {
208 if (!this.frequencyD) return;
207 return `${this.$gettext("fairwayavailability")}-${ 209 return `${this.$gettext("fairwayavailability")}-${
208 this.featureName 210 this.featureName
209 }-${filters.surveyDate(this.fromDate)}-${filters.surveyDate( 211 }-${filters.surveyDate(this.fromDate)}-${filters.surveyDate(
210 this.toDate 212 this.toDate
211 )}-${this.$gettext(this.frequency)}-.csv`; 213 )}-${this.$gettext(this.frequencyD)}-.csv`;
212 }, 214 },
213 frequencyToRange() { 215 frequencyToRange() {
216 if (!this.frequencyD) return;
214 const frequencies = { 217 const frequencies = {
215 [FREQUENCIES.MONTHLY]: [-33, 33], 218 [FREQUENCIES.MONTHLY]: [-33, 33],
216 [FREQUENCIES.QUARTERLY]: [-93, 93], 219 [FREQUENCIES.QUARTERLY]: [-93, 93],
217 [FREQUENCIES.YEARLY]: [-370, 370] 220 [FREQUENCIES.YEARLY]: [-370, 370]
218 }; 221 };
219 return frequencies[this.frequency]; 222 return frequencies[this.frequencyD];
220 }, 223 },
221 availability() { 224 availability() {
222 return this.plainAvailability; 225 return this.plainAvailability;
223 }, 226 },
224 title() { 227 title() {
228 if (!this.frequencyD) return;
225 return `Available Fairway Depth: ${ 229 return `Available Fairway Depth: ${
226 this.featureName 230 this.featureName
227 } (${filters.surveyDate(this.fromDate)} - ${filters.surveyDate( 231 } (${filters.surveyDate(this.fromDate)} - ${filters.surveyDate(
228 this.toDate 232 this.toDate
229 )}) ${this.$gettext(this.frequency)}`; 233 )}) ${this.$gettext(this.frequencyD)}`;
230 }, 234 },
231 featureName() { 235 featureName() {
232 if (this.selectedFairwayAvailabilityFeatureD == null) return ""; 236 if (this.selectedFairwayAvailabilityFeatureD == null) return "";
233 return this.selectedFairwayAvailabilityFeatureD.properties.name; 237 return this.selectedFairwayAvailabilityFeatureD.properties.name;
234 } 238 }
240 this.toDate = this.to; 244 this.toDate = this.to;
241 this.depthlimit1D = this.depthlimit1; 245 this.depthlimit1D = this.depthlimit1;
242 this.depthlimit2D = this.depthlimit2; 246 this.depthlimit2D = this.depthlimit2;
243 this.widthlimit1D = this.widthlimit1; 247 this.widthlimit1D = this.widthlimit1;
244 this.widthlimit2D = this.widthlimit2; 248 this.widthlimit2D = this.widthlimit2;
249 this.frequencyD = this.frequency;
245 }, 250 },
246 applyChange() { 251 applyChange() {
247 if (this.form.template.hasOwnProperty("properties")) { 252 if (this.form.template.hasOwnProperty("properties")) {
248 this.templateData = this.defaultTemplate; 253 this.templateData = this.defaultTemplate;
249 return; 254 return;