From 2c9ffa836012d04c974a6b4064ade3b060d4e7d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pierre-=C3=89tienne=20Lord?= <7397743+pelord@users.noreply.github.com> Date: Thu, 10 Oct 2019 09:06:43 -0400 Subject: [PATCH] Ogc filter (#458) * refactor(ogc-filter) missing icon * refactor(ogcFilter)Behavior of not editable ogcFilters * refactor(filterable-datasource) Catch empty filter with pushbuttons * refactor(ogcfilter)Placeholder on input fields * Delete 3-release.bat --- .../shared/datasources/wfs-datasource.ts | 5 ++- .../shared/datasources/wms-datasource.ts | 2 +- .../ogc-filter-form.component.html | 32 +++++++++---------- .../ogc-filter-form.component.ts | 3 ++ .../ogc-filterable-form.component.html | 4 +-- .../ogc-filterable-item.component.html | 15 ++++----- .../shared/filterable-datasource.pipe.ts | 16 +++++++--- packages/geo/src/locale/en.geo.json | 6 ++-- packages/geo/src/locale/fr.geo.json | 6 ++-- 9 files changed, 52 insertions(+), 37 deletions(-) diff --git a/packages/geo/src/lib/datasource/shared/datasources/wfs-datasource.ts b/packages/geo/src/lib/datasource/shared/datasources/wfs-datasource.ts index a82d1d2694..9dd9a062a4 100644 --- a/packages/geo/src/lib/datasource/shared/datasources/wfs-datasource.ts +++ b/packages/geo/src/lib/datasource/shared/datasources/wfs-datasource.ts @@ -30,7 +30,10 @@ export class WFSDataSource extends DataSource { const ogcFilterWriter = new OgcFilterWriter(); (this.options as OgcFilterableDataSourceOptions).ogcFilters = ogcFilterWriter.defineOgcFiltersDefaultOptions(ogcFilters, fieldNameGeometry); - if ((this.options as OgcFilterableDataSourceOptions).ogcFilters.enabled) { + if ( + (this.options as OgcFilterableDataSourceOptions).ogcFilters.enabled && + (this.options as OgcFilterableDataSourceOptions).ogcFilters.editable + ) { this.wfsService.getSourceFieldsFromWFS(this.options); } } diff --git a/packages/geo/src/lib/datasource/shared/datasources/wms-datasource.ts b/packages/geo/src/lib/datasource/shared/datasources/wms-datasource.ts index 5fe2986d59..0594cca37a 100644 --- a/packages/geo/src/lib/datasource/shared/datasources/wms-datasource.ts +++ b/packages/geo/src/lib/datasource/shared/datasources/wms-datasource.ts @@ -132,7 +132,7 @@ export class WMSDataSource extends DataSource { console.log('*******************************'); } - if (options.paramsWFS && initOgcFilters && initOgcFilters.enabled) { + if (options.paramsWFS && initOgcFilters && initOgcFilters.enabled && initOgcFilters.editable) { this.wfsService.getSourceFieldsFromWFS(options); } diff --git a/packages/geo/src/lib/filter/ogc-filter-form/ogc-filter-form.component.html b/packages/geo/src/lib/filter/ogc-filter-form/ogc-filter-form.component.html index 67e5ad130f..f9f5180cdf 100644 --- a/packages/geo/src/lib/filter/ogc-filter-form/ogc-filter-form.component.html +++ b/packages/geo/src/lib/filter/ogc-filter-form/ogc-filter-form.component.html @@ -39,8 +39,8 @@ - - + @@ -58,8 +58,8 @@ - - + @@ -80,8 +80,8 @@ - - + @@ -98,8 +98,8 @@ - - + @@ -110,8 +110,8 @@ - - + @@ -129,8 +129,8 @@ - - + @@ -142,8 +142,8 @@ - - + @@ -182,8 +182,8 @@ - - + - + - -
- {{'igo.geo.filter.advancedOgcFilters' | translate}}
-
diff --git a/packages/geo/src/lib/filter/shared/filterable-datasource.pipe.ts b/packages/geo/src/lib/filter/shared/filterable-datasource.pipe.ts index c991b1f276..d7ba504476 100644 --- a/packages/geo/src/lib/filter/shared/filterable-datasource.pipe.ts +++ b/packages/geo/src/lib/filter/shared/filterable-datasource.pipe.ts @@ -39,13 +39,21 @@ export class FilterableDataSourcePipe implements PipeTransform { return dataSource.options.timeFilterable; } - private isOgcFilterable(dataSource: OgcFilterableDataSource) { + private isOgcFilterable(dataSource: OgcFilterableDataSource): boolean { + let isOgcFilterable = false; if ( dataSource.options.ogcFilters && - dataSource.options.ogcFilters.enabled + dataSource.options.ogcFilters.enabled && + dataSource.options.ogcFilters.editable ) { - return true; + isOgcFilterable = true; + } + if ( + dataSource.options.ogcFilters && + dataSource.options.ogcFilters.enabled && + dataSource.options.ogcFilters.pushButtons) { + isOgcFilterable = true; } - return false; + return isOgcFilterable; } } diff --git a/packages/geo/src/locale/en.geo.json b/packages/geo/src/locale/en.geo.json index 57edcb07b0..c6ed092de9 100644 --- a/packages/geo/src/locale/en.geo.json +++ b/packages/geo/src/locale/en.geo.json @@ -90,12 +90,14 @@ "layerFiltered": "This layer is currently filtered", "layerFilterable": "This layer is filterable", "filterBy": "Filter by", - "advancedOgcFilters": "Advanced filters" + "advancedOgcFilters": "Advanced filters", + "placeholder": "Enter a value", + "placeholderSnrc": "Ex: 21L14" }, "spatialSelector": { "fixedExtent": "Fixed extent", "btnSetExtent": "Define the extent of the spatial filter to the current view", - "snrc": "SNRC (ex:21L14)", + "snrc": "SNRC", "selectFeature": "", "drawFeature": "" }, diff --git a/packages/geo/src/locale/fr.geo.json b/packages/geo/src/locale/fr.geo.json index d4dae14ac2..9fd472fa5c 100644 --- a/packages/geo/src/locale/fr.geo.json +++ b/packages/geo/src/locale/fr.geo.json @@ -90,12 +90,14 @@ "layerFiltered": "Cette couche d'information est présentement filtrée.", "layerFilterable": "Cette couche d'information est filtrable", "filterBy": "Filtrer par", - "advancedOgcFilters": "Filtres avancés" + "advancedOgcFilters": "Filtres avancés", + "placeholder": "Saisir une valeur", + "placeholderSnrc": "Ex: 21L14" }, "spatialSelector": { "fixedExtent": "Étendue fixe", "btnSetExtent": "Définir l'étendue du filtre selon l'étendue courante de la carte", - "snrc": "SNRC (ex:21L14)", + "snrc": "SNRC", "selectFeature": "", "drawFeature": "" },