From f756bf60195e55fccccc3f47ddff00465d7f6d33 Mon Sep 17 00:00:00 2001 From: MAudelGisaia Date: Thu, 19 Dec 2024 18:16:42 +0100 Subject: [PATCH 1/5] feat:enable aggregation for geaoshape field --- scripts/start.sh | 11 +++++++++++ .../map-layer-form-builder.service.ts | 10 ++++++---- src/app/services/collection-service/tools.ts | 10 +++++----- src/settings.yaml | 6 +++--- 4 files changed, 25 insertions(+), 12 deletions(-) diff --git a/scripts/start.sh b/scripts/start.sh index 61fa7cbe..3d39b174 100755 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -508,6 +508,17 @@ fi envsubst 'ARLAS_ENABLE_ADVANCED_FEATURES' < /usr/share/nginx/html/settings.yaml > /usr/share/nginx/html/settings.yaml.tmp mv /usr/share/nginx/html/settings.yaml.tmp /usr/share/nginx/html/settings.yaml +# Allow applying an geohash/geotile aggregation on a geoshape field +if [ -z "${ARLAS_GEOSHAPE_AGG}" ]; then + ARLAS_GEOSHAPE_AGG=false + export ARLAS_GEOSHAPE_AGG + echo "geohash/geotile aggregation on a geoshape field are not allowed" +else + echo ${ARLAS_ENABLE_H3ARLAS_GEOSHAPE_AGG} "is used for 'enable_geoshape_agg' in settings.yaml file" +fi +envsubst 'ARLAS_GEOSHAPE_AGG' < /usr/share/nginx/html/settings.yaml > /usr/share/nginx/html/settings.yaml.tmp +mv /usr/share/nginx/html/settings.yaml.tmp /usr/share/nginx/html/settings.yaml + # Set App base path if [ -z "${ARLAS_BUILDER_APP_PATH}" ]; then ARLAS_BUILDER_APP_PATH="" diff --git a/src/app/modules/map-config/services/map-layer-form-builder/map-layer-form-builder.service.ts b/src/app/modules/map-config/services/map-layer-form-builder/map-layer-form-builder.service.ts index 66826013..69d7163f 100644 --- a/src/app/modules/map-config/services/map-layer-form-builder/map-layer-form-builder.service.ts +++ b/src/app/modules/map-config/services/map-layer-form-builder/map-layer-form-builder.service.ts @@ -67,7 +67,8 @@ export class MapLayerFormGroup extends ConfigFormGroup { vFa: FormArray, collection: string, edit: boolean, - collectionService: CollectionService + collectionService: CollectionService, + settingsService: ArlasSettingsService ) { super({ arlasId: new HiddenFormControl( @@ -265,8 +266,8 @@ export class MapLayerFormGroup extends ConfigFormGroup { .subscribe(collectionFs => { clusterFg.rawGeometry.setSyncOptions(collectionFs); }); - toGeoPointOptionsObs(collectionService - .getCollectionFields(this.customControls.collection.value)) + toGeoOptionsObs(collectionService + .getCollectionFields(this.customControls.collection.value), !!settingsService && settingsService.settings['enable_geoshape_agg']) .subscribe(collectionFs => { clusterFg.aggGeometry.setSyncOptions(collectionFs); }); @@ -1637,7 +1638,8 @@ export class MapLayerFormBuilderService { this.mainFormService.mapConfig.getVisualisationsFa(), collection, edit, - this.collectionService + this.collectionService, + this.settigsService ); this.defaultValuesService.setDefaultValueRecursively('map.layer', mapLayerFormGroup); return mapLayerFormGroup; diff --git a/src/app/services/collection-service/tools.ts b/src/app/services/collection-service/tools.ts index 5946ffbc..6c204786 100644 --- a/src/app/services/collection-service/tools.ts +++ b/src/app/services/collection-service/tools.ts @@ -128,12 +128,12 @@ export function toTextOptionsObs(collectionFieldsObs: Observable f.type === typeEnum.TEXT)))); } -export function toGeoOptionsObs(collectionFieldsObs: Observable>) { - return toOptionsObs(collectionFieldsObs.pipe(map( - fields => fields - .filter(f => f.type === typeEnum.GEOPOINT || f.type === typeEnum.GEOSHAPE)))); +export function toGeoOptionsObs(collectionFieldsObs: Observable>, enableGeoShape = true) { + return toOptionsObs(collectionFieldsObs + .pipe(map( + fields => fields + .filter(f => f.type === typeEnum.GEOPOINT || (f.type === typeEnum.GEOSHAPE) && enableGeoShape)))); } - export function toGeoPointOptionsObs(collectionFieldsObs: Observable>) { return toOptionsObs(collectionFieldsObs.pipe(map( fields => fields diff --git a/src/settings.yaml b/src/settings.yaml index 129a19b1..c5d21f71 100644 --- a/src/settings.yaml +++ b/src/settings.yaml @@ -2,7 +2,7 @@ ############ AUTHENTICATION SETTINGS ############### ######################################################## authentication: - use_authent: false + use_authent: true auth_mode: iam url: 'https://localhost/arlas_iam_server' force_connect: true @@ -26,12 +26,12 @@ authentication: sign_up_enabled: true persistence: - url: http://localhost/persist + url: https://localhost/persist ######################################################## ############ Permissions SETTINGS ################## ######################################################## permission: - url: 'http://localhost/arlas_permissions_server' + url: 'https://localhost/arlas_permissions_server' ######################################################## ############ URLs to WUI app ####################### ######################################################## From 35c575a124a288b5de92d7b6881d7054d13ccef2 Mon Sep 17 00:00:00 2001 From: MAudelGisaia Date: Fri, 20 Dec 2024 10:11:26 +0100 Subject: [PATCH 2/5] fix: correct gram errors --- scripts/start.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/start.sh b/scripts/start.sh index 3d39b174..3d97c1c2 100755 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -508,11 +508,11 @@ fi envsubst 'ARLAS_ENABLE_ADVANCED_FEATURES' < /usr/share/nginx/html/settings.yaml > /usr/share/nginx/html/settings.yaml.tmp mv /usr/share/nginx/html/settings.yaml.tmp /usr/share/nginx/html/settings.yaml -# Allow applying an geohash/geotile aggregation on a geoshape field +# Allow applying a geohash/geotile aggregation on a geoshape field if [ -z "${ARLAS_GEOSHAPE_AGG}" ]; then ARLAS_GEOSHAPE_AGG=false export ARLAS_GEOSHAPE_AGG - echo "geohash/geotile aggregation on a geoshape field are not allowed" + echo "geohash/geotile aggregation on a geoshape field is not allowed" else echo ${ARLAS_ENABLE_H3ARLAS_GEOSHAPE_AGG} "is used for 'enable_geoshape_agg' in settings.yaml file" fi From e101684224047130b0183b0f2889821ac2fcb181 Mon Sep 17 00:00:00 2001 From: MAudelGisaia Date: Thu, 23 Jan 2025 18:24:37 +0100 Subject: [PATCH 3/5] feat: replace variable --- scripts/start.sh | 10 ---------- .../map-layer-form-builder.service.ts | 2 +- 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/scripts/start.sh b/scripts/start.sh index 3d97c1c2..d136f544 100755 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -508,16 +508,6 @@ fi envsubst 'ARLAS_ENABLE_ADVANCED_FEATURES' < /usr/share/nginx/html/settings.yaml > /usr/share/nginx/html/settings.yaml.tmp mv /usr/share/nginx/html/settings.yaml.tmp /usr/share/nginx/html/settings.yaml -# Allow applying a geohash/geotile aggregation on a geoshape field -if [ -z "${ARLAS_GEOSHAPE_AGG}" ]; then - ARLAS_GEOSHAPE_AGG=false - export ARLAS_GEOSHAPE_AGG - echo "geohash/geotile aggregation on a geoshape field is not allowed" -else - echo ${ARLAS_ENABLE_H3ARLAS_GEOSHAPE_AGG} "is used for 'enable_geoshape_agg' in settings.yaml file" -fi -envsubst 'ARLAS_GEOSHAPE_AGG' < /usr/share/nginx/html/settings.yaml > /usr/share/nginx/html/settings.yaml.tmp -mv /usr/share/nginx/html/settings.yaml.tmp /usr/share/nginx/html/settings.yaml # Set App base path if [ -z "${ARLAS_BUILDER_APP_PATH}" ]; then diff --git a/src/app/modules/map-config/services/map-layer-form-builder/map-layer-form-builder.service.ts b/src/app/modules/map-config/services/map-layer-form-builder/map-layer-form-builder.service.ts index 69d7163f..c5965671 100644 --- a/src/app/modules/map-config/services/map-layer-form-builder/map-layer-form-builder.service.ts +++ b/src/app/modules/map-config/services/map-layer-form-builder/map-layer-form-builder.service.ts @@ -267,7 +267,7 @@ export class MapLayerFormGroup extends ConfigFormGroup { clusterFg.rawGeometry.setSyncOptions(collectionFs); }); toGeoOptionsObs(collectionService - .getCollectionFields(this.customControls.collection.value), !!settingsService && settingsService.settings['enable_geoshape_agg']) + .getCollectionFields(this.customControls.collection.value), !!settingsService && settingsService.settings['enable_advanced_features']) .subscribe(collectionFs => { clusterFg.aggGeometry.setSyncOptions(collectionFs); }); From eb229505338ecae9330b2d0a90784242bcd79782 Mon Sep 17 00:00:00 2001 From: MAudelGisaia Date: Thu, 23 Jan 2025 18:28:02 +0100 Subject: [PATCH 4/5] feat: fix sonareqb --- .../map-layer-form-builder.service.ts | 107 ++++++++++-------- 1 file changed, 57 insertions(+), 50 deletions(-) diff --git a/src/app/modules/map-config/services/map-layer-form-builder/map-layer-form-builder.service.ts b/src/app/modules/map-config/services/map-layer-form-builder/map-layer-form-builder.service.ts index c5965671..86d0dd9f 100644 --- a/src/app/modules/map-config/services/map-layer-form-builder/map-layer-form-builder.service.ts +++ b/src/app/modules/map-config/services/map-layer-form-builder/map-layer-form-builder.service.ts @@ -53,6 +53,17 @@ import { ButtonToggleFormControl } from '@shared-models/config-form'; import { toNumericOptionsObs } from '../../../../services/collection-service/tools'; import { ArlasSettingsService } from 'arlas-wui-toolkit'; +export interface MapLayerFormGroupConfig { + featuresFg: MapLayerTypeFeaturesFormGroup; + featureMetricFg: MapLayerTypeFeatureMetricFormGroup; + clusterFg: MapLayerTypeClusterFormGroup; + vFa: FormArray; + collection: string; + edit: boolean; + collectionService: CollectionService; + settingsService: ArlasSettingsService; + +} export const PRECISION_TOLERATED_DIFFERENCE = 3; export const MAX_ZOOM = 23; @@ -60,15 +71,9 @@ export const MAX_ZOOM = 23; export class MapLayerFormGroup extends ConfigFormGroup { private currentCollection; public clearFilters = new Subject(); + public constructor( - featuresFg: MapLayerTypeFeaturesFormGroup, - featureMetricFg: MapLayerTypeFeatureMetricFormGroup, - clusterFg: MapLayerTypeClusterFormGroup, - vFa: FormArray, - collection: string, - edit: boolean, - collectionService: CollectionService, - settingsService: ArlasSettingsService + opt: MapLayerFormGroupConfig ) { super({ arlasId: new HiddenFormControl( @@ -100,7 +105,7 @@ export class MapLayerFormGroup extends ConfigFormGroup { } ), collection: new SelectFormControl( - collection, + opt.collection, marker('Collection'), marker('Layer collection description'), false, @@ -110,7 +115,7 @@ export class MapLayerFormGroup extends ConfigFormGroup { resetDependantsOnChange: true, isCollectionSelect: true }, - collectionService.getGroupCollectionItemsWithCentroid() + opt.collectionService.getGroupCollectionItemsWithCentroid() ), collectionDisplayName: new HiddenFormControl( @@ -119,7 +124,7 @@ export class MapLayerFormGroup extends ConfigFormGroup { { dependsOn: () => [this.customControls.collection], onDependencyChange: (control: HiddenFormControl) => { - collectionService.getDescribe(this.customControls.collection.value).subscribe(desc => { + opt.collectionService.getDescribe(this.customControls.collection.value).subscribe(desc => { if (!!desc.params.display_names && !!desc.params.display_names.collection) { control.setValue(desc.params.display_names.collection); } else { @@ -134,13 +139,13 @@ export class MapLayerFormGroup extends ConfigFormGroup { '', marker('Visualisation sets'), marker('The layer can be put in one or several visualisation sets'), - vFa.value, + opt.vFa.value, { dependsOn: () => [this.customControls.name], onDependencyChange: (control: VisualisationCheckboxFormControl) => { // updates the selected layers in each visualisation set const controlsValues = []; - vFa.value.forEach(vf => { + opt.vFa.value.forEach(vf => { const visualisation = !!control.value ? control.value.find(v => v.name === vf.name) : undefined; controlsValues.push({ name: vf.name, @@ -155,7 +160,7 @@ export class MapLayerFormGroup extends ConfigFormGroup { controlsValues.push({ name: 'All layers', layers: [], - include: !edit + include: ! opt.edit }); } control.setValue(controlsValues); @@ -170,7 +175,7 @@ export class MapLayerFormGroup extends ConfigFormGroup { }); // check at least one visualisation set when we create a new layer // if we edit an existing layer, we don't check visualisation sets - if (!edit && visualisationControl.length >= 1 && !visualisationControl.find(vs => vs.include === true)) { + if (! opt.edit && visualisationControl.length >= 1 && !visualisationControl.find(vs => vs.include === true)) { visualisationControl[0].include = true; } control.setSyncOptions(visualisationControl); @@ -184,7 +189,7 @@ export class MapLayerFormGroup extends ConfigFormGroup { { optional: true }), - featuresFg: featuresFg + featuresFg: opt.featuresFg .withDependsOn(() => [this.customControls.mode, this.customControls.collection]) .withOnDependencyChange( (control) => { @@ -194,20 +199,20 @@ export class MapLayerFormGroup extends ConfigFormGroup { control.enableIf(this.customControls.mode.value === LAYER_MODE.features); /** when the collection changes we need to update all the fields lists used the different mat-select */ if (control.enabled && (!this.currentCollection || this.customControls.collection.value !== this.currentCollection)) { - toGeoOptionsObs(collectionService + toGeoOptionsObs( opt.collectionService .getCollectionFields(this.customControls.collection.value)) .subscribe(collectionFs => { - featuresFg.geometry.setSyncOptions(collectionFs); + opt.featuresFg.geometry.setSyncOptions(collectionFs); }); - this.updateCollectionInForms(featuresFg, collectionService); + this.updateCollectionInForms( opt.featuresFg, opt.collectionService); if (this.currentCollection !== undefined) { - featuresFg.filters.setValue(new FormArray([], [])); + opt.featuresFg.filters.setValue(new FormArray([], [])); this.clearFilters.next(true); } this.currentCollection = this.customControls.collection.value; } }), - featureMetricFg: featureMetricFg + featureMetricFg: opt.featureMetricFg .withDependsOn(() => [this.customControls.mode, this.customControls.collection]) .withOnDependencyChange( (control) => { @@ -215,43 +220,43 @@ export class MapLayerFormGroup extends ConfigFormGroup { this.currentCollection = undefined; /** Calculate the network precision */ if (!!this.customControls.collection.value) { - this.calculatenetworkFetchingLevel(this.customControls.collection.value, collectionService, - featureMetricFg.networkFetchingLevel, featureMetricFg.zoomMin, featureMetricFg.zoomMax); + this.calculatenetworkFetchingLevel(this.customControls.collection.value, opt.collectionService, + opt.featureMetricFg.networkFetchingLevel, opt.featureMetricFg.zoomMin, opt.featureMetricFg.zoomMax); } } control.enableIf(this.customControls.mode.value === LAYER_MODE.featureMetric); /** when the collection changes we need to update all the fields lists used the different mat-select */ if (control.enabled && !!this.customControls.collection.value && (!this.currentCollection || this.customControls.collection.value !== this.currentCollection)) { - toGeoOptionsObs(collectionService + toGeoOptionsObs( opt.collectionService .getCollectionFields(this.customControls.collection.value)) .subscribe(collectionFs => { - featureMetricFg.geometry.setSyncOptions(collectionFs); + opt.featureMetricFg.geometry.setSyncOptions(collectionFs); }); - toAllButGeoOptionsObs(collectionService + toAllButGeoOptionsObs( opt.collectionService .getCollectionFields(this.customControls.collection.value)) .subscribe(collectionFs => { - featureMetricFg.featureMetricSort.setSyncOptions(collectionFs); + opt.featureMetricFg.featureMetricSort.setSyncOptions(collectionFs); }); - toKeywordOptionsObs(collectionService + toKeywordOptionsObs(opt.collectionService .getCollectionFields(this.customControls.collection.value)) .subscribe(collectionFs => { - featureMetricFg.geometryId.setSyncOptions(collectionFs); + opt.featureMetricFg.geometryId.setSyncOptions(collectionFs); }); - this.updateCollectionInForms(featureMetricFg, collectionService); + this.updateCollectionInForms( opt.featureMetricFg, opt.collectionService); if (this.currentCollection !== undefined) { - featureMetricFg.filters.setValue(new FormArray([], [])); + opt.featureMetricFg.filters.setValue(new FormArray([], [])); this.clearFilters.next(true); } // calculate bbox of the collection in order and deduce the best grid precision if (this.currentCollection !== undefined && this.customControls.collection.value !== this.currentCollection) { - this.calculatenetworkFetchingLevel(this.customControls.collection.value, collectionService, - featureMetricFg.networkFetchingLevel, featureMetricFg.zoomMin, featureMetricFg.zoomMax); + this.calculatenetworkFetchingLevel(this.customControls.collection.value, opt.collectionService, + opt.featureMetricFg.networkFetchingLevel, opt.featureMetricFg.zoomMin, opt.featureMetricFg.zoomMax); } this.currentCollection = this.customControls.collection.value; } }), - clusterFg: clusterFg + clusterFg: opt.clusterFg .withDependsOn(() => [this.customControls.mode, this.customControls.collection]) .withOnDependencyChange( (control) => { @@ -261,22 +266,23 @@ export class MapLayerFormGroup extends ConfigFormGroup { control.enableIf(this.customControls.mode.value === LAYER_MODE.cluster); /** when the collection changes we need to update all the fields lists used the different mat-select */ if (control.enabled && (!this.currentCollection || this.customControls.collection.value !== this.currentCollection)) { - toGeoOptionsObs(collectionService + toGeoOptionsObs( opt.collectionService .getCollectionFields(this.customControls.collection.value)) .subscribe(collectionFs => { - clusterFg.rawGeometry.setSyncOptions(collectionFs); + opt.clusterFg.rawGeometry.setSyncOptions(collectionFs); }); - toGeoOptionsObs(collectionService - .getCollectionFields(this.customControls.collection.value), !!settingsService && settingsService.settings['enable_advanced_features']) + toGeoOptionsObs( opt.collectionService + .getCollectionFields(this.customControls.collection.value), + !! opt.settingsService && opt.settingsService.settings['enable_advanced_features']) .subscribe(collectionFs => { - clusterFg.aggGeometry.setSyncOptions(collectionFs); + opt.clusterFg.aggGeometry.setSyncOptions(collectionFs); }); - toAllButGeoOptionsObs(collectionService + toAllButGeoOptionsObs( opt.collectionService .getCollectionFields(this.customControls.collection.value)) .subscribe(collectionFs => { - clusterFg.clusterSort.setSyncOptions(collectionFs); + opt.clusterFg.clusterSort.setSyncOptions(collectionFs); }); - this.updateCollectionInForms(clusterFg, collectionService); + this.updateCollectionInForms( opt.clusterFg, opt.collectionService); this.currentCollection = this.customControls.collection.value; } }), @@ -1631,16 +1637,17 @@ export class MapLayerFormBuilderService { } } - const mapLayerFormGroup = new MapLayerFormGroup( - this.buildFeatures(collection, collectionFields), - this.buildFeatureMetric(collection, collectionFields), - this.buildCluster(collection, collectionFields), - this.mainFormService.mapConfig.getVisualisationsFa(), + const mapLayerFormGroup = new MapLayerFormGroup({ collection, edit, - this.collectionService, - this.settigsService - ); + clusterFg: this.buildCluster(collection, collectionFields), + collectionService:this.collectionService , + featureMetricFg:this.buildFeatureMetric(collection, collectionFields), + featuresFg:this.buildFeatures(collection, collectionFields), + settingsService:this.settigsService , + vFa: this.mainFormService.mapConfig.getVisualisationsFa() + + }); this.defaultValuesService.setDefaultValueRecursively('map.layer', mapLayerFormGroup); return mapLayerFormGroup; } From 941a82d643bf53ecc2f84702746cb4dea5043372 Mon Sep 17 00:00:00 2001 From: MAudelGisaia Date: Fri, 24 Jan 2025 09:34:52 +0100 Subject: [PATCH 5/5] feat: change parenthesis --- src/app/services/collection-service/tools.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/services/collection-service/tools.ts b/src/app/services/collection-service/tools.ts index 6c204786..b17b3906 100644 --- a/src/app/services/collection-service/tools.ts +++ b/src/app/services/collection-service/tools.ts @@ -132,7 +132,7 @@ export function toGeoOptionsObs(collectionFieldsObs: Observable fields - .filter(f => f.type === typeEnum.GEOPOINT || (f.type === typeEnum.GEOSHAPE) && enableGeoShape)))); + .filter(f => f.type === typeEnum.GEOPOINT || (f.type === typeEnum.GEOSHAPE && enableGeoShape))))); } export function toGeoPointOptionsObs(collectionFieldsObs: Observable>) { return toOptionsObs(collectionFieldsObs.pipe(map(