diff --git a/CHANGELOG.md b/CHANGELOG.md index 65b8f60a8..29e201d2b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ ## Current (in progress) -- Nothing yet +- Add geo specific display on OGC service resources [#609](https://github.com/datagouv/udata-front/pull/609) ## 6.0.5 (2024-11-29) diff --git a/udata_front/theme/gouvfr/datagouv-components/CHANGELOG.md b/udata_front/theme/gouvfr/datagouv-components/CHANGELOG.md index 13bc20f03..4ea3d7150 100644 --- a/udata_front/theme/gouvfr/datagouv-components/CHANGELOG.md +++ b/udata_front/theme/gouvfr/datagouv-components/CHANGELOG.md @@ -2,7 +2,7 @@ ## Current (in progress) -- Nothing yet +- Add geo specific display on OGC service resources [#609](https://github.com/datagouv/udata-front/pull/609) ## 2.0.2 (2024-11-19) diff --git a/udata_front/theme/gouvfr/datagouv-components/src/components/ResourceAccordion/ResourceAccordion.stories.ts b/udata_front/theme/gouvfr/datagouv-components/src/components/ResourceAccordion/ResourceAccordion.stories.ts index 6f069f5ea..72fd6fb4e 100644 --- a/udata_front/theme/gouvfr/datagouv-components/src/components/ResourceAccordion/ResourceAccordion.stories.ts +++ b/udata_front/theme/gouvfr/datagouv-components/src/components/ResourceAccordion/ResourceAccordion.stories.ts @@ -179,6 +179,19 @@ export const ResourceBinary: StoryObj = { }; +export const ResourceOGCService: StoryObj = { + render: (args) => ({ + components: { ResourceAccordion }, + setup() { + return { args }; + }, + template: '', + }), + args: { ...argsWithSchema, resource: { ...argsWithSchema.resource, format: "ogc:wms", title: "point_eau_qualito", + } }, +}; + + export const ResourceUrl: StoryObj = { render: (args) => ({ components: { ResourceAccordion }, diff --git a/udata_front/theme/gouvfr/datagouv-components/src/components/ResourceAccordion/ResourceAccordion.vue b/udata_front/theme/gouvfr/datagouv-components/src/components/ResourceAccordion/ResourceAccordion.vue index d21b69a85..ca47e5f77 100644 --- a/udata_front/theme/gouvfr/datagouv-components/src/components/ResourceAccordion/ResourceAccordion.vue +++ b/udata_front/theme/gouvfr/datagouv-components/src/components/ResourceAccordion/ResourceAccordion.vue @@ -52,6 +52,23 @@ {{ $t('Visit') }}

+

+ +

{ const format = computed(() => getResourceFormatIconSvg(props.resource) ? props.resource.format : t("File")) +const ogcService = computed(() => OGC_SERVICES_FORMATS.includes(props.resource.format)) + const open = ref(props.expandedOnMount); const toggle = () => { open.value = ! open.value; diff --git a/udata_front/theme/gouvfr/datagouv-components/src/helpers/resources.ts b/udata_front/theme/gouvfr/datagouv-components/src/helpers/resources.ts index 56ad3aed6..debf97b4b 100644 --- a/udata_front/theme/gouvfr/datagouv-components/src/helpers/resources.ts +++ b/udata_front/theme/gouvfr/datagouv-components/src/helpers/resources.ts @@ -4,6 +4,8 @@ import archive from '../../../templates/svg/resources/archive.svg'; import documentation from '../../../templates/svg/resources/documentation.svg'; import link from '../../../templates/svg/resources/link.svg'; import table from '../../../templates/svg/resources/table.svg'; +import map from '../../../templates/svg/resources/map.svg'; +import globe from '../../../templates/svg/resources/globe.svg'; export function getResourceFormatIconSvg(resource: Resource): string | null { switch (resource.format?.trim()?.toLowerCase()) { @@ -25,7 +27,6 @@ export function getResourceFormatIconSvg(resource: Resource): string | null { case 'gpx': case 'shx': case 'ovr': - case 'geojson': case 'gpkg': case 'grib2': case 'dbf': @@ -60,6 +61,13 @@ export function getResourceFormatIconSvg(resource: Resource): string | null { case 'xlsx': case 'parquet': return table; + case 'geojson': + return map; + case 'ogc:wfs': + case 'ogc:wms': + case 'wfs': + case 'wms': + return globe; default: return null; } diff --git a/udata_front/theme/gouvfr/templates/svg/resources/globe.svg b/udata_front/theme/gouvfr/templates/svg/resources/globe.svg new file mode 100644 index 000000000..3f3a0f194 --- /dev/null +++ b/udata_front/theme/gouvfr/templates/svg/resources/globe.svg @@ -0,0 +1,4 @@ + + + + diff --git a/udata_front/theme/gouvfr/templates/svg/resources/map.svg b/udata_front/theme/gouvfr/templates/svg/resources/map.svg new file mode 100644 index 000000000..bca15d34d --- /dev/null +++ b/udata_front/theme/gouvfr/templates/svg/resources/map.svg @@ -0,0 +1,4 @@ + + + +