Bonjour, une mise à jour de la forge logicielle est prévue mardi 02 Décembre 2021 de 08h à 9h. Celle-ci entrainera une interruption de service d'environ 1h de 8h à 9h. Cordialement, Maintenance forge logicielle

Commit c296d483 authored by Dimitri DI GUSTO's avatar Dimitri DI GUSTO
Browse files

Merge branch 'DOS0075412' into 'master'

DOS0075412

See merge request !111
parents f6f7627b a9f1c73a
Pipeline #9856 passed with stage
in 8 minutes and 47 seconds
{
"name": "webapp",
"version": "2.6.12",
"version": "2.6.13",
"license": "GNU Affero General Public License v3.0",
"scripts": {
"ng": "ng",
......
......@@ -6,10 +6,10 @@
(keydown.enter)="sortBy(key)" [tabindex]="isDisplayed ? 0 : -1" [attr.role]="'columnheader'">
<span class="sort-icons">
<span class="icon">
<i class="fas fa-sort-up" [ngClass]="{'icon-red': sortValue === key && sortOrder === 'desc'}"></i>
<i class="fas fa-sort-up" [ngClass]="{'icon-red': sortValue.includes(key) && sortOrder === 'desc'}"></i>
</span>
<span class="icon">
<i class="fas fa-sort-down" [ngClass]="{'icon-red': sortValue === key && sortOrder === 'asc'}"></i>
<i class="fas fa-sort-down" [ngClass]="{'icon-red': sortValue.includes(key) && sortOrder === 'asc'}"></i>
</span>
</span>
<span class="column-title" [ngClass]="{'active': sortValue === key}">{{ key }}</span>
......
......@@ -96,8 +96,9 @@ export class DatasetTableComponent implements OnInit, OnDestroy {
}
sortBy(key: string) {
const keyType = this._datasetDetailService.getKeyType(key);
// Set the new sort value in the service
this._datasetDetailService.sortBy(key);
this._datasetDetailService.sortBy(keyType);
// Retrieve date sorted with the new value
this._datasetDetailService.retrieveDatasetData().subscribe(() => {
this.tableWidthModified.emit(true);
......@@ -124,8 +125,9 @@ export class DatasetTableComponent implements OnInit, OnDestroy {
return this._datasetDetailService.datasetData;
}
get sortValue() {
return this._datasetDetailService.sortValue;
get sortValue(): String {
var sortValue: String = this._datasetDetailService.sortValue;
return sortValue ? sortValue:'' ;
}
get sortOrder() {
......
......@@ -272,11 +272,22 @@ export class DatasetDetailService {
}
}
getKeyType(key: string) {
return key+'_'+ eval(`this._dataset.fields.types.${key}`);
}
orderProperties(data: any, orderedProperties: string[]) {
const newDataPropertiesOrder = {};
orderedProperties.forEach((field) => {
newDataPropertiesOrder[field] = data.properties[field] ? data.properties[field] : '';
// Adds type to field. First time, the field with type is used, and attributed to field without type
// force _json detection since the fieldtype is not listed. (used for complex data)
var fieldtype = field + '_' + eval(`this._dataset.fields.types.${field}`);
newDataPropertiesOrder[field] = data.properties[fieldtype] ? data.properties[fieldtype] :
data.properties[field] ? data.properties[field] : data.properties[`${field}_json`] ?
data.properties[`${field}_json`] : '';
});
data.properties = newDataPropertiesOrder;
}
......
......@@ -135,7 +135,10 @@ export class ElasticsearchService {
if (options.sortOptions.value !== null) {
const sort = {};
const key = `data-fr.properties.${options.sortOptions.value}.sort`;
sort[key] = options.sortOptions.order;
sort[key] = {
order: options.sortOptions.order,
unmapped_type: 'string'
};
body['sort'] = [sort];
}
......
......@@ -20,7 +20,7 @@ export class Data implements IData {
this.geometry = data.geometry;
this.type = data.type;
this.properties = data.properties;
this.id = data.properties.gid;
this.id = data.properties.gid ? data.properties.gid:data.properties.gid_int;
}
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment