Skip to content
Snippets Groups Projects
Commit 94d02c50 authored by Etienne LOUPIAS's avatar Etienne LOUPIAS
Browse files

ci(data): fix get cities from data.grandlyon

parent a7c09fa2
No related branches found
No related tags found
1 merge request!945V3.3.0
......@@ -33,6 +33,10 @@ server {
#allow 80.14.51.82; # Erasme
#deny all;
location /data-grandlyon-cities {
proxy_pass https://data.grandlyon.com/fr/datapusher/ws/grandlyon/adr_voie_lieu.adrcomgl/all.json;
}
location / {
add_header X-Frame-Options SAMEORIGIN always;
add_header X-Content-Type-Options nosniff;
......@@ -75,10 +79,6 @@ server {
proxy_pass https://download.data.grandlyon.com/wfs/grandlyon;
}
location /fr/datapusher {
proxy_pass https://data.grandlyon.com/fr/datapusher;
}
# REALLY important for JavaScript modules (type="module") to work as expected!!!
location ~ \.js {
add_header Content-Type text/javascript;
......
......@@ -29,10 +29,13 @@
"changeOrigin": true,
"logLevel": "info"
},
"/fr/datapusher": {
"/data-grandlyon-cities": {
"target": "https://data.grandlyon.com",
"secure": false,
"changeOrigin": true,
"pathRewrite": {
"^/data-grandlyon-cities": "/fr/datapusher/ws/grandlyon/adr_voie_lieu.adrcomgl/all.json"
},
"logLevel": "info"
}
}
......@@ -67,32 +67,30 @@ export class DataComponent implements OnInit {
});
// Get cities from data.grandlyon.com
// To change to have new city Oullins-Pierre-Bénite :
// .get('/fr/datapusher/ws/grandlyon/adr_voie_lieu.adrcomgl_2024/all.json', { headers: { skip: 'true' } })
this.http
.get('/fr/datapusher/ws/grandlyon/adr_voie_lieu.adrcomgl/all.json', { headers: { skip: 'true' } })
.subscribe((data: { values: any[] }) => {
this.categoriesInseeCodes = [
{
id: 'inseeCode',
name: 'Commune',
theme: 'Commune',
modules: data.values
.flatMap((value) => {
if (value.nom === 'Lyon') {
// Replace city "Lyon" by the 9 districts of Lyon
return Array.from({ length: 9 }, (_, index) => ({
disabled: false,
name: `Lyon ${index + 1}`,
id: `6938${index + 1}`, // Insee code for district of Lyon
}));
}
return [{ disabled: false, name: value.nom, id: value.insee }];
})
.sort((a, b) => a.name.localeCompare(b.name)),
},
];
});
// To change in proxy.conf.json and default.conf to have new city Oullins-Pierre-Bénite :
// /fr/datapusher/ws/grandlyon/adr_voie_lieu.adrcomgl_2024/all.json
this.http.get('/data-grandlyon-cities', { headers: { skip: 'true' } }).subscribe((data: { values: any[] }) => {
this.categoriesInseeCodes = [
{
id: 'inseeCode',
name: 'Commune',
theme: 'Commune',
modules: data.values
.flatMap((value) => {
if (value.nom === 'Lyon') {
// Replace city "Lyon" by the 9 districts of Lyon
return Array.from({ length: 9 }, (_, index) => ({
disabled: false,
name: `Lyon ${index + 1}`,
id: `6938${index + 1}`, // Insee code for district of Lyon
}));
}
return [{ disabled: false, name: value.nom, id: value.insee }];
})
.sort((a, b) => a.name.localeCompare(b.name)),
},
];
});
this.resetFilters();
}
......
......@@ -18,7 +18,7 @@
/>
</div>
<!-- Filter with single category -->
<div *ngIf="categories.length === 1" class="modalContent">
<div *ngIf="categories?.length === 1" class="modalContent">
<ng-container *ngIf="isRadio">
<app-radio
*ngFor="let module of categories[0].modules"
......@@ -41,7 +41,7 @@
</ng-container>
</div>
<!-- Filter with multiple categories -->
<div *ngIf="categories.length > 1" class="modalContent multipleCollapse">
<div *ngIf="categories?.length > 1" class="modalContent multipleCollapse">
<app-collapse *ngFor="let c of categories">
<app-collapse-header>
<div class="collapseHeader">
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment