From db23f5b27141f9ffc228985ddace04708d2a0ac0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pierre-=C3=89tienne=20Lord?= Date: Tue, 18 Dec 2018 11:05:21 -0500 Subject: [PATCH] feat(layer-list)Allow search with layer keyword (capabilitie or context) --- .../geo/src/lib/layer/layer-list/layer-list.component.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/projects/geo/src/lib/layer/layer-list/layer-list.component.ts b/projects/geo/src/lib/layer/layer-list/layer-list.component.ts index 9b02acc32d..a7e5214afe 100644 --- a/projects/geo/src/lib/layer/layer-list/layer-list.component.ts +++ b/projects/geo/src/lib/layer/layer-list/layer-list.component.ts @@ -117,12 +117,19 @@ export class LayerListComponent { }); localLayers.forEach(layer => { + const localLayerKeywords = []; + if (layer.options && layer.options['metadata'] && layer.options['metadata'].keywordList ) { + layer.options['metadata'].keywordList.forEach(kw => { + localLayerKeywords.push(kw.normalize('NFD').replace(/[\u0300-\u036f]/g, '')); + }); + } if (this.keyword) { const localKeyword = this.keyword.normalize('NFD').replace(/[\u0300-\u036f]/g, ''); const localLayerTitle = layer.title.normalize('NFD').replace(/[\u0300-\u036f]/g, ''); if ( !new RegExp(localKeyword, 'gi').test(localLayerTitle) && - !(this.keyword.toLowerCase() === layer.dataSource.options.type.toString().toLowerCase()) ) { + !(this.keyword.toLowerCase() === layer.dataSource.options.type.toString().toLowerCase()) && + localLayerKeywords.filter(kw => new RegExp(localKeyword, 'gi').test(kw)).length === 0) { const index = layerIDToKeep.indexOf(layer.id); if (index > -1) { layerIDToKeep.splice(index, 1);