-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix missing parameter in administrative layer style function
- Loading branch information
1 parent
70eea1e
commit 84510e7
Showing
11 changed files
with
59 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
frontend/src/domain/use_cases/getZonesAndSubZonesPromises.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { getAdministrativeSubZonesFromAPI } from '../../api/fetch' | ||
import Layers, { layersType } from '../entities/layers' | ||
|
||
export const getZonesAndSubZonesPromises = () => { | ||
return Object.keys(Layers) | ||
.map(layer => Layers[layer]) | ||
.filter(layer => layer.type === layersType.ADMINISTRATIVE) | ||
.filter(layer => layer.isIntersectable) | ||
.map(zone => { | ||
if (zone.containsMultipleZones) { | ||
return getAdministrativeSubZonesFromAPI(zone.code).then(subZonesFeatures => { | ||
return subZonesFeatures.features.map(subZone => { | ||
return { | ||
group: zone.name, | ||
groupCode: zone.code, | ||
label: subZone.properties[zone.subZoneFieldKey] ? subZone.properties[zone.subZoneFieldKey]?.replace(/[_]/g, ' ') : 'Aucun nom', | ||
name: subZone.properties[zone.subZoneFieldKey] ? subZone.properties[zone.subZoneFieldKey]?.replace(/[_]/g, ' ') : 'Aucun nom', | ||
code: subZone.id, | ||
value: subZone.id, | ||
isSubZone: true | ||
} | ||
}) | ||
}).catch(error => { | ||
console.warn(error) | ||
}) | ||
} | ||
|
||
const nextZone = { ...zone } | ||
|
||
nextZone.label = zone.name | ||
nextZone.value = zone.code | ||
nextZone.group = zone.group ? zone.group.name : 'Administratives' | ||
|
||
return nextZone | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters