Skip to content

Commit 8527aa2

Browse files
committed
Displayed no results message if selected options are not available.
1 parent bff2ddf commit 8527aa2

1 file changed

Lines changed: 12 additions & 7 deletions

File tree

src/components/widgets/LivelihoodZonesMap.vue

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,10 @@
2222
:options="optionsProvince"
2323
)
2424

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 || ' ' }}
2729
br
2830

2931
div(v-if="legends.length > 0")
@@ -77,7 +79,8 @@ export default {
7779
DEFAULT: '',
7880
LOADING: 'Please wait while loading...',
7981
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.'
8184
},
8285
8386
filters: {
@@ -109,13 +112,15 @@ export default {
109112
this.filters.ADM2_EN = null
110113
this.selectedProvince = null
111114
this.optionsProvince = [{ value: null, text: 'Please select a province' }]
115+
this.statusMessage = this.messages.DEFAULT
112116
} else {
113117
this.selectedIsland = this.getIslandFromRegion(this.selectedRegion)
114118
this.getProvinceOptions()
115119
this.filters.ADM2_EN = ['in', 'ADM2_EN', ...this.getProvinces(this.selectedIsland, this.selectedRegion)]
120+
this.statusMessage = this.messages.NAVIGATE_TO
116121
}
117122
118-
this.statusMessage = this.messages.NAVIGATE_TO
123+
// this.statusMessage = this.messages.NAVIGATE_TO
119124
this.updateLayers()
120125
},
121126
@@ -180,7 +185,7 @@ export default {
180185
if (window.MBL.isFlying) {
181186
window.MBL.map.fire('flyend')
182187
if (that.selectedZone || (that.selectedRegion || that.selectedProvince)) {
183-
that.updateLegend()
188+
that.updateLegend(true)
184189
}
185190
}
186191
})
@@ -304,14 +309,14 @@ export default {
304309
}
305310
},
306311
307-
updateLegend () {
312+
updateLegend (fromFlyEnd = false) {
308313
let colorCodes = []
309314
this.legends = []
310315
311316
const features = window.MBL.map.queryRenderedFeatures({ layers: window.MBL.layerNames })
312317
if (features.length === 0) {
313318
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
315320
return
316321
}
317322

0 commit comments

Comments
 (0)