Commit 0f4a1128 authored by Matthieu BENOIST's avatar Matthieu BENOIST
Browse files

Merge branch 'DOS0102844' into 'master'

Dos0102844 - Fix commune order

See merge request !124
parents e26f3b9a 977bd66c
Pipeline #12064 passed with stage
in 6 minutes and 12 seconds
{
"name": "webapp",
"version": "2.6.13",
"version": "2.7.2",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
......
{
"name": "webapp",
"version": "2.7.1",
"version": "2.7.2",
"license": "GNU Affero General Public License v3.0",
"scripts": {
"ng": "ng",
......
......@@ -160,7 +160,7 @@ export class ResourceQueryableComponent implements OnInit {
this.initInseeLabel(this._datasetDetailService.datasetData);
}
else {
this._datasetDetailService.retrieveDatasetData().subscribe(() => {
this._datasetDetailService.sampleDataLoaded$.subscribe((data) => {
this.initInseeLabel(this._datasetDetailService.datasetData);
});
}
......
......@@ -60,6 +60,8 @@ export class DatasetDetailComponent implements OnInit, OnDestroy {
this.isLoading = true;
this.initDatasetInfo();
});
this._datasetDetailService.retrieveDatasetData().subscribe();
}
ngOnDestroy() {
......
......@@ -114,17 +114,27 @@ export class ResourceDownloadItemComponent implements OnInit {
this.selectedProjection = this.projectionList[0];
}
// Set the insee property label for this dataset
if (this._datasetDetailService.datasetData[0]) {
const properties = Object.keys(this._datasetDetailService.datasetData[0].properties);
this.inseeLabel = properties.find((prop) => { return prop.includes('insee'); });
this.setInseeProperties();
} else {
this._datasetDetailService.sampleDataLoaded$.subscribe((data) => {
this.setInseeProperties();
});
}
this.communeInseeList.sort((a, b) => (a.commune > b.commune) ? 1 : -1);
this.setProjection(this.selectedProjection);
}
}
setInseeProperties ()
{
const properties = Object.keys(this._datasetDetailService.datasetData[0].properties);
this.inseeLabel = properties.find((prop) => { return prop.includes('insee'); });
this.communeInseeList.sort((a, b) => (a.commune.localeCompare(b.commune)));
}
getFormatName() {
return this.format ? this.format.name : this.link.formats[0];
......@@ -199,6 +209,7 @@ export class ResourceDownloadItemComponent implements OnInit {
// Set the selected insee and set the queryable parameters
// depending on the resource
setInsee(insee) {
this.selectedInsee = insee;
if (!this.selectedInsee || !this.inseeLabel) {
this.queryableParameters.insee = '';
......
......@@ -63,10 +63,15 @@ export class DatasetTableMapComponent implements OnInit, OnDestroy {
this.searchInput.setValue(this._datasetDetailService.searchString);
if (this.hasTable) {
// If dataset has table then preload some data for the table component
this._datasetDetailService.retrieveDatasetData().subscribe(() => {
if (this._datasetDetailService.datasetData){
this.dataLoaded = true;
});
}
else {
// If dataset has table then preload some data for the table component
this._datasetDetailService.sampleDataLoaded$.subscribe((data) => {
this.dataLoaded = true;
}).unsubscribe();
}
}
}
......
......@@ -100,9 +100,7 @@ export class DatasetTableComponent implements OnInit, OnDestroy {
// Set the new sort value in the service
this._datasetDetailService.sortBy(keyType);
// Retrieve date sorted with the new value
this._datasetDetailService.retrieveDatasetData().subscribe(() => {
this.tableWidthModified.emit(true);
});
this.getSearchResults();
}
getSearchResults() {
......
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