Skip to content

Commit

Permalink
Merge branch 'feat/26.x.x' into feat/enrich_map_services
Browse files Browse the repository at this point in the history
  • Loading branch information
MohamedHamouGisaia committed Dec 2, 2024
2 parents 774d7ab + 3d90977 commit 70e113c
Show file tree
Hide file tree
Showing 12 changed files with 277 additions and 218 deletions.
18 changes: 13 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Change Log

## [v26.1.0-rc.3](https://github.com/gisaia/ARLAS-WUI/tree/v26.1.0-rc.3) (2024-11-27)

[Full Changelog](https://github.com/gisaia/ARLAS-WUI/compare/v26.1.0-rc.2...v26.1.0-rc.3)

## [v26.1.0-rc.2](https://github.com/gisaia/ARLAS-WUI/tree/v26.1.0-rc.2) (2024-11-26)

[Full Changelog](https://github.com/gisaia/ARLAS-WUI/compare/v26.1.0-rc.1...v26.1.0-rc.2)

## [v26.1.0-rc.1](https://github.com/gisaia/ARLAS-WUI/tree/v26.1.0-rc.1) (2024-11-26)

[Full Changelog](https://github.com/gisaia/ARLAS-WUI/compare/v26.0.8...v26.1.0-rc.1)
Expand Down Expand Up @@ -949,19 +957,19 @@

## [v15.0.0](https://github.com/gisaia/ARLAS-WUI/tree/v15.0.0) (2021-02-18)

[Full Changelog](https://github.com/gisaia/ARLAS-WUI/compare/v15.0.0-beta.1...v15.0.0)
[Full Changelog](https://github.com/gisaia/ARLAS-WUI/compare/v15.0.0-beta.0...v15.0.0)

**Fixed bugs:**

- Wrong css applied in details section in resultlist [\#268](https://github.com/gisaia/ARLAS-wui/issues/268)

## [v15.0.0-beta.1](https://github.com/gisaia/ARLAS-WUI/tree/v15.0.0-beta.1) (2021-02-04)
## [v15.0.0-beta.0](https://github.com/gisaia/ARLAS-WUI/tree/v15.0.0-beta.0) (2021-02-04)

[Full Changelog](https://github.com/gisaia/ARLAS-WUI/compare/v15.0.0-beta.0...v15.0.0-beta.1)
[Full Changelog](https://github.com/gisaia/ARLAS-WUI/compare/v15.0.0-beta.1...v15.0.0-beta.0)

## [v15.0.0-beta.0](https://github.com/gisaia/ARLAS-WUI/tree/v15.0.0-beta.0) (2021-02-04)
## [v15.0.0-beta.1](https://github.com/gisaia/ARLAS-WUI/tree/v15.0.0-beta.1) (2021-02-04)

[Full Changelog](https://github.com/gisaia/ARLAS-WUI/compare/v14.3.1...v15.0.0-beta.0)
[Full Changelog](https://github.com/gisaia/ARLAS-WUI/compare/v14.3.1...v15.0.0-beta.1)

## [v14.3.1](https://github.com/gisaia/ARLAS-WUI/tree/v14.3.1) (2021-02-03)

Expand Down
344 changes: 170 additions & 174 deletions package-lock.json

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "arlas-wui",
"version": "26.1.1-tr",
"version": "26.1.0-rc.3",
"author": "gisaia",
"license": "Apache-2.0",
"scripts": {
Expand Down Expand Up @@ -32,7 +32,7 @@
},
"dependencies": {
"@ngx-translate/core": "14.0.0",
"arlas-wui-toolkit": "26.1.0-beta.1",
"arlas-wui-toolkit": "~26.1.0",
"hammerjs": "^2.0.8",
"ng-packagr": "^14.2.2",
"ngx-markdown": "14.0.1",
Expand Down Expand Up @@ -84,6 +84,7 @@
"traverse": "0.6.8"
},
"dompurify": "2.5.6",
"mermaid": "10.9.3"
"mermaid": "10.9.3",
"cross-spawn": "~7.0.5"
}
}
1 change: 1 addition & 0 deletions src/app/components/arlas-list/arlas-list.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
(geoSortEvent)="geoSort(list, $event)"
(geoAutoSortEvent)="geoAutoSort(list, $event)"
(consultedItemEvent)="consultItem(list, $event)"
(selectedItemsEvent)="selectItems(list, $event)"
(actionOnItemEvent)="applyActionOnItem(list, $event)"
(globalActionEvent)="applyGlobalAction(list, $event)"
(changeResultMode)="changeListResultMode($event, list.identifier)"
Expand Down
2 changes: 1 addition & 1 deletion src/app/components/arlas-map/arlas-map.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
[maxWidthScale]="mapComponentConfig?.maxWidthScale" [unitScale]="mapComponentConfig?.unitScale"
[idFeatureField]="mapComponentConfig?.idFieldName" [mapLayers]="mapComponentConfig?.mapLayers"
[mapSources]="mapComponentConfig?.mapSources"
[featureToHightLight]="mapService.featureToHightLight" [featuresToSelect]="featuresToSelect"
[featureToHightLight]="mapService.featureToHightLight" [featuresToSelect]="mapService.featuresToSelect"
[boundsToFit]="visualizeService.fitbounds" [drawPolygonVerticesLimit]="nbVerticesLimit"
[drawButtonEnabled]="false" [mapAttributionPosition]="mapAttributionPosition"
(onAoiChanged)="onChangeAoi($event)"
Expand Down
4 changes: 0 additions & 4 deletions src/app/components/arlas-map/arlas-map.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,6 @@ export class ArlasMapComponent implements OnInit {
public mapAttributionPosition: 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left' = 'top-right';
public mapLoaded = false;

/** Map interactions */
public featuresToSelect: Array<ElementIdentifier> = [];

/** Map move */
public fitbounds: Array<Array<number>> = [];
public recalculateExtent = true;
Expand Down Expand Up @@ -303,7 +300,6 @@ export class ArlasMapComponent implements OnInit {
const appUrl = new URL(window.location.href);
const mapServiceOrigin = mapServiceUrl.origin;
const appOrigin = appUrl.origin;
console.log('enriching ...', appOrigin, mapServiceOrigin, headers)
/** We enrich map url by an ARLAS header only if the map url is provided by ARLAS. */
if (appOrigin === mapServiceOrigin && !!headers) {
return ({
Expand Down
7 changes: 5 additions & 2 deletions src/app/services/map.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ export class MapService {
private mapComponentConfig: any;
public mapContributors: Array<MapContributor> = new Array();
public centerLatLng: { lat: number; lng: number; } = { lat: 0, lng: 0 };

public featureToHightLight: FeatureHover;
public featuresToSelect: Array<ElementIdentifier> = [];

public coordinatesHaveSpace: boolean;

public constructor() { }
Expand All @@ -46,7 +49,7 @@ export class MapService {
public selectFeatures(idPath: string, ids: string[] | number[], mapContributor: MapContributor) {
if (!!this.mapComponent && !!mapContributor) {
if (ids.length > 0) {
const featuresToSelect = ids.map(id => {
this.featuresToSelect = ids.map(id => {
let idFieldName = idPath;
if (mapContributor.isFlat) {
idFieldName = idFieldName.replace(/\./g, '_');
Expand All @@ -56,7 +59,7 @@ export class MapService {
idValue: id
};
});
this.mapComponent.selectFeaturesByCollection(featuresToSelect, mapContributor.collection);
this.mapComponent.selectFeaturesByCollection(this.featuresToSelect, mapContributor.collection);
} else {
this.mapComponent.selectFeaturesByCollection([], mapContributor.collection);
}
Expand Down
82 changes: 59 additions & 23 deletions src/app/services/resultlist.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import {
AiasDownloadComponent, AiasEnrichComponent, ArlasCollaborativesearchService, ArlasConfigService,
ArlasExportCsvService, ArlasSettingsService, getParamValue, ProcessService, DOWNLOAD_PROCESS_NAME, ENRICH_PROCESS_NAME
} from 'arlas-wui-toolkit';
import { BehaviorSubject, finalize, Subject } from 'rxjs';
import { BehaviorSubject, finalize, Subject, take } from 'rxjs';


@Injectable({
Expand All @@ -62,6 +62,7 @@ export class ResultlistService {
private currentClickedFeatureId: string = undefined;
public resultlistIsExporting = false;
public activeActionsPerContId = new Map<string, Map<string, Set<string>>>();
public selectedItems = new Array<ElementIdentifier>();

/** Resullist component */
private listComponent: ResultListComponent;
Expand Down Expand Up @@ -123,6 +124,7 @@ export class ResultlistService {

this.addActions();
this.declareResultlistExportCsv();
this.declareGlobalRasterVisualisation();
}
}

Expand Down Expand Up @@ -376,22 +378,21 @@ export class ResultlistService {
}
break;
case 'selectedItemsEvent':
const ids = event.data;
const ids: Array<string> = event.data;
const idPath = this.collectionToDescription.get(currentCollection)?.id_path;
if (!!idPath) {
this.mapService.selectFeatures(idPath, ids, mapContributor);
this.selectedItems = ids.map(id => ({idFieldName: idPath, idValue: id}));
}
break;
case 'actionOnItemEvent':
this.actionOnItemEvent(event.data, mapContributor, resultListContributor, currentCollection);
break;
case 'globalActionEvent':
if (event.data.id === 'production') {
const idsItemSelected: ElementIdentifier[] = this.mapService.mapComponent.featuresToSelect;
this.aiasDownload(idsItemSelected.map(i => i.idValue), currentCollection);
this.aiasDownload(this.selectedItems.map(i => i.idValue), currentCollection);
} else if (event.data.id === 'enrich') {
const idsItemSelected: ElementIdentifier[] = this.mapService.mapComponent.featuresToSelect;
this.aiasEnrich(idsItemSelected.map(i => i.idValue), currentCollection);
this.aiasEnrich(this.selectedItems.map(i => i.idValue), currentCollection);
} else if (event.data.id === 'export_csv') {
this.resultlistIsExporting = true;
this.exportService.fetchResultlistData$(resultListContributor, undefined)
Expand All @@ -400,6 +401,19 @@ export class ResultlistService {
next: (h) => this.exportService.exportResultlist(resultListContributor, h),
error: (e) => this.snackbar.open(marker('An error occured exporting the list'))
});
} else if (event.data.id === 'visualize') {
this.selectedItems.forEach(e => {
// For each element, check if the necessary fields for the visualisation are present
this.listComponent.detailedDataRetriever.getValues(e.idValue, event.data.fields).pipe(take(1)).subscribe({
next: (values: string[]) => {
// If no field is missing, visualize the raster
if (values.filter(v => !v).length === 0) {
this.visualizeRaster({action: event.data, elementidentifier: e}, resultListContributor, currentCollection, false);
this.addAction(event.origin, e.idValue, event.data.action);
}
}
});
});
}
break;
case 'geoSortEvent':
Expand All @@ -423,7 +437,9 @@ export class ResultlistService {
.forEach(c => c.getPage(eventPaginate.reference, sort, eventPaginate.whichPage, contributor.maxPages));
}

public actionOnItemEvent(data, mapContributor: MapContributor, listContributor: ResultListContributor, collection: string) {
public actionOnItemEvent(data: {action: Action; elementidentifier: ElementIdentifier;},
mapContributor: MapContributor, listContributor: ResultListContributor, collection: string) {

switch (data.action.id) {
case 'zoomToFeature':
if (!!mapContributor) {
Expand All @@ -432,20 +448,7 @@ export class ResultlistService {
}
break;
case 'visualize':
if (!!this.resultlistConfigPerContId.get(listContributor.identifier)) {
const urlVisualisationTemplate = this.resultlistConfigPerContId.get(listContributor.identifier).visualisationLink;
if (!data.action.activated) {
this.visualizeService.getVisuInfo(data.elementidentifier, collection, urlVisualisationTemplate).subscribe(url => {
this.visualizeService.displayDataOnMap(url,
data.elementidentifier, this.collectionToDescription.get(collection).geometry_path,
this.collectionToDescription.get(collection).centroid_path, collection);
});
this.addAction(listContributor.identifier, data.elementidentifier.idValue, data.action);
} else {
this.visualizeService.removeRasters(data.elementidentifier.idValue);
this.removeAction(listContributor.identifier, data.elementidentifier.idValue, data.action.id);
}
}
this.visualizeRaster(data, listContributor, collection);
break;
case 'download':
if (!!this.resultlistConfigPerContId.get(listContributor.identifier)) {
Expand Down Expand Up @@ -484,6 +487,25 @@ export class ResultlistService {
}, 100);
}

private visualizeRaster(data: {action: Action; elementidentifier: ElementIdentifier;},
listContributor: ResultListContributor, collection: string, fitBounds = true) {

if (!!this.resultlistConfigPerContId.get(listContributor.identifier)) {
const urlVisualisationTemplate = this.resultlistConfigPerContId.get(listContributor.identifier).visualisationLink;
if (!data.action.activated) {
this.visualizeService.getVisuInfo(data.elementidentifier, collection, urlVisualisationTemplate).subscribe(url => {
this.visualizeService.displayDataOnMap(url,
data.elementidentifier, this.collectionToDescription.get(collection).geometry_path,
this.collectionToDescription.get(collection).centroid_path, collection, fitBounds);
});
this.addAction(listContributor.identifier, data.elementidentifier.idValue, data.action);
} else {
this.visualizeService.removeRasters(data.elementidentifier.idValue);
this.removeAction(listContributor.identifier, data.elementidentifier.idValue, data.action.id);
}
}
}

private process<T>(processName: string, ids: string[], collection: string, component: ComponentType<T>, additionalData?: any) {
const maxItems = this.settingsService.getProcessSettings(processName).max_items;
if (ids.length <= maxItems) {
Expand Down Expand Up @@ -602,7 +624,7 @@ export class ResultlistService {
if (!resultConfig.globalActionsList) {
resultConfig.globalActionsList = [];
}
resultConfig.globalActionsList.push({ 'id': id, 'label': label });
(resultConfig.globalActionsList as Array<Action>).push({ 'id': id, 'label': label });
};
}
});
Expand All @@ -619,9 +641,23 @@ export class ResultlistService {
if (!resultConfig.globalActionsList) {
resultConfig.globalActionsList = [];
}
resultConfig.globalActionsList.push({ 'id': 'export_csv', 'label': marker('Export csv'), 'alwaysEnabled': true });
(resultConfig.globalActionsList as Array<Action>).push({ 'id': 'export_csv', 'label': marker('Export csv'), 'alwaysEnabled': true });
}
});
}
}

private declareGlobalRasterVisualisation() {
this.resultlistContributors.forEach(c => {
const resultConfig = this.resultlistConfigPerContId.get(c.identifier);
if (!!resultConfig && !!resultConfig.visualisationLink) {
if (!resultConfig.globalActionsList) {
resultConfig.globalActionsList = [];
}
const reverseAction = c.actionToTriggerOnClick.find(a => a.id === 'visualize').reverseAction;
(resultConfig.globalActionsList as Array<Action>).push({id: 'visualize', label: marker('Visualize products'),
fields: this.visualizeService.getVisuFields(resultConfig.visualisationLink), reverseAction});
}
});
}
}
8 changes: 5 additions & 3 deletions src/app/services/visualize.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ export class VisualizeService {
return urlTemplate;
} else {
this.getVisuFields(urlTemplate).forEach(field => {
if (data.hits[0].data[field] === undefined) {
if (!data.hits || data.hits[0].data[field] === undefined) {
return undefined;
} else {
urlTemplate = urlTemplate.replace('{' + field + '}', data.hits[0].data[field]);
Expand Down Expand Up @@ -209,7 +209,7 @@ export class VisualizeService {
}

public displayDataOnMap(url: string, elementidentifier: ElementIdentifier,
geometryPath: string, centroidPath: string, collection) {
geometryPath: string, centroidPath: string, collection: string, fitBounds = true) {
if (url !== undefined && url.indexOf('{bbox-epsg-3857}{:bbox3857:}') >= 0) {
url = url.replace('{:bbox3857:}', '');
}
Expand All @@ -221,7 +221,9 @@ export class VisualizeService {
geometryPath, centroidPath, collection)
.subscribe(d => {
this.addRaster(url, 25, d.box, elementidentifier.idValue);
this.fitbounds = d.bounds;
if (fitBounds) {
this.fitbounds = d.bounds;
}
});
} else {
const snackMsg = this.translateService.instant('The visualisation is not available for this product.');
Expand Down
18 changes: 17 additions & 1 deletion src/assets/processes/download.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,23 @@
"enum": [
{
"label": "WGS 84",
"value": "epsg:4326"
"value": "epsg:4326",
"bbox": [
-180.0,
-90.0,
180.0,
90.0
]
},
{
"label": "EPSG:3857",
"value": "epsg:3857",
"bbox": [
-180.0,
-90.0,
180.0,
90.0
]
}
]
}
Expand Down
2 changes: 1 addition & 1 deletion src/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "arlas-wui",
"version": "26.1.1-tr",
"version": "26.1.0-rc.3",
"author": "gisaia",
"license": "Apache-2.0"
}
2 changes: 1 addition & 1 deletion src/settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ authentication:
tab_name: "ARLAS Wui"

persistence:
url: https://cloud.arlas.io/arlas/persistence
url: https://localhost/persist
use_local_config: false
histogram:
max_buckets: 200
Expand Down

0 comments on commit 70e113c

Please sign in to comment.