|
22 | 22 | :options="optionsProvince" |
23 | 23 | ) |
24 | 24 |
|
25 | | - small(v-if="statusMessage !== ''") {{ statusMessage }} |
26 | | - small(v-else) |
| 25 | + small(v-if="statusMessage === messages.NAVIGATE_TO") |
| 26 | + span {{ messages.NAVIGATE_TO }} or |
| 27 | + a(href="#" @click="resetCenter") [click here] |
| 28 | + small(v-else) {{ statusMessage || ' ' }} |
27 | 29 | br |
28 | 30 |
|
29 | 31 | div(v-if="legends.length > 0") |
@@ -77,7 +79,8 @@ export default { |
77 | 79 | DEFAULT: '', |
78 | 80 | LOADING: 'Please wait while loading...', |
79 | 81 | NAVIGATE_TO: 'Please navigate to the selected region to view legends.', |
80 | | - LOAD_ERROR: 'An error has occurred while fetching data. Please check your internet connection and reload the web page.' |
| 82 | + LOAD_ERROR: 'An error has occurred while fetching data. Please check your internet connection and reload the web page.', |
| 83 | + NO_REULTS: 'Selected options are not available for this region or province.' |
81 | 84 | }, |
82 | 85 |
|
83 | 86 | filters: { |
@@ -109,13 +112,15 @@ export default { |
109 | 112 | this.filters.ADM2_EN = null |
110 | 113 | this.selectedProvince = null |
111 | 114 | this.optionsProvince = [{ value: null, text: 'Please select a province' }] |
| 115 | + this.statusMessage = this.messages.DEFAULT |
112 | 116 | } else { |
113 | 117 | this.selectedIsland = this.getIslandFromRegion(this.selectedRegion) |
114 | 118 | this.getProvinceOptions() |
115 | 119 | this.filters.ADM2_EN = ['in', 'ADM2_EN', ...this.getProvinces(this.selectedIsland, this.selectedRegion)] |
| 120 | + this.statusMessage = this.messages.NAVIGATE_TO |
116 | 121 | } |
117 | 122 |
|
118 | | - this.statusMessage = this.messages.NAVIGATE_TO |
| 123 | + // this.statusMessage = this.messages.NAVIGATE_TO |
119 | 124 | this.updateLayers() |
120 | 125 | }, |
121 | 126 |
|
@@ -180,7 +185,7 @@ export default { |
180 | 185 | if (window.MBL.isFlying) { |
181 | 186 | window.MBL.map.fire('flyend') |
182 | 187 | if (that.selectedZone || (that.selectedRegion || that.selectedProvince)) { |
183 | | - that.updateLegend() |
| 188 | + that.updateLegend(true) |
184 | 189 | } |
185 | 190 | } |
186 | 191 | }) |
@@ -304,14 +309,14 @@ export default { |
304 | 309 | } |
305 | 310 | }, |
306 | 311 |
|
307 | | - updateLegend () { |
| 312 | + updateLegend (fromFlyEnd = false) { |
308 | 313 | let colorCodes = [] |
309 | 314 | this.legends = [] |
310 | 315 |
|
311 | 316 | const features = window.MBL.map.queryRenderedFeatures({ layers: window.MBL.layerNames }) |
312 | 317 | if (features.length === 0) { |
313 | 318 | console.log('---no legends to show') |
314 | | - this.statusMessage = this.messages.NAVIGATE_TO |
| 319 | + this.statusMessage = (fromFlyEnd) ? this.messages.NO_REULTS : this.messages.NAVIGATE_TO |
315 | 320 | return |
316 | 321 | } |
317 | 322 |
|
|
0 commit comments