@datagouv/components-next 1.4.1-dev.1363.ga6a9113d → 1.4.1-dev.1369.ge90e64f3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/dist/Datafair.client-Ci2WOgAS.js +28 -0
  2. package/dist/ImagePreview.client-B4RtxuiJ.js +36 -0
  3. package/dist/{JsonPreview.client-DcnN7kTh.js → JsonPreview.client-r7swv2fp.js} +13 -5
  4. package/dist/MapContainer.client-CxH1a8Tn.js +75 -0
  5. package/dist/{PdfPreview.client-D-jPm4dP.js → PdfPreview.client-BjeMcqcy.js} +783 -773
  6. package/dist/{PdfSkeleton-5HBfBlXx.js → PdfSkeleton-CVZxJaeL.js} +1 -1
  7. package/dist/{Pmtiles.client-DBaMKSO-.js → Pmtiles.client-D8idR2l7.js} +44 -44
  8. package/dist/{config-jrnuUDOH.js → PreviewError-Cx7CItT_.js} +11729 -9691
  9. package/dist/PreviewWrapper-Cd1RSmS-.js +62 -0
  10. package/dist/{XmlPreview.client-WnIR6jRO.js → XmlPreview.client-cSebx8br.js} +13 -5
  11. package/dist/components-next.css +1 -1
  12. package/dist/components-next.js +10841 -11704
  13. package/dist/components.css +1 -1
  14. package/dist/france-DPcdJc84.js +75 -0
  15. package/package.json +1 -1
  16. package/src/components/ResourceAccordion/Datafair.client.vue +8 -6
  17. package/src/components/ResourceAccordion/ImagePreview.client.vue +22 -10
  18. package/src/components/ResourceAccordion/JsonPreview.client.vue +2 -0
  19. package/src/components/ResourceAccordion/MapContainer.client.vue +13 -5
  20. package/src/components/ResourceAccordion/PdfPreview.client.vue +15 -0
  21. package/src/components/ResourceAccordion/Pmtiles.client.vue +6 -4
  22. package/src/components/ResourceAccordion/Preview.vue +13 -5
  23. package/src/components/ResourceAccordion/PreviewError.vue +148 -0
  24. package/src/components/ResourceAccordion/PreviewWrapper.vue +63 -20
  25. package/src/components/ResourceAccordion/ResourceAccordion.vue +54 -67
  26. package/src/components/ResourceAccordion/UrlPreview.vue +31 -0
  27. package/src/components/ResourceAccordion/XmlPreview.client.vue +2 -0
  28. package/src/components/ResourceExplorer/ResourceExplorer.vue +3 -1
  29. package/src/components/ResourceExplorer/ResourceExplorerViewer.vue +24 -22
  30. package/src/components/TabularExplorer/TabularExplorer.vue +6 -6
  31. package/src/composables/useResourceCapabilities.ts +27 -11
  32. package/src/config.ts +1 -0
  33. package/src/functions/previewErrors.ts +188 -0
  34. package/src/functions/resources.ts +22 -1
  35. package/src/main.ts +1 -0
  36. package/dist/Datafair.client-DV0kxqBW.js +0 -27
  37. package/dist/ImagePreview.client-0mW3sY5X.js +0 -30
  38. package/dist/MapContainer.client-ZoJqauC6.js +0 -74
  39. package/dist/PreviewUnavailable-BJkpCiyL.js +0 -82
  40. package/dist/PreviewWrapper-DEl1D2rR.js +0 -47
  41. package/dist/france-DxksUv5K.js +0 -694
  42. package/dist/resources-CmwQ4DAB.js +0 -316
  43. package/src/components/ResourceAccordion/PreviewUnavailable.vue +0 -22
@@ -153,6 +153,7 @@
153
153
  :href="resource.latest"
154
154
  rel="ugc nofollow noopener"
155
155
  :title="downloadButtonTitle"
156
+ :data-testid="`download-${resource.id}`"
156
157
  download
157
158
  class="relative matomo_download z-2"
158
159
  :icon="unavailable ? RiFileWarningLine : RiDownloadLine"
@@ -218,29 +219,44 @@
218
219
  :dataset="dataset"
219
220
  />
220
221
  <MapContainer
221
- v-if="ogcWms"
222
+ v-else-if="ogcWms"
222
223
  :resource="resource"
223
224
  />
225
+ <PreviewError
226
+ v-else-if="hasPmtilesError"
227
+ :resource="resource"
228
+ error-type="map_generation"
229
+ :detail="pmtilesError ?? undefined"
230
+ />
224
231
  </div>
225
232
  <div v-if="tab.key === 'data'">
226
- <!-- Show JSON viewer for JSON files -->
233
+ <!-- A link resource points to an external page: offer the visit
234
+ instead of a data preview or an error message. -->
235
+ <UrlPreview
236
+ v-if="isResourceUrl"
237
+ :resource="resource"
238
+ />
227
239
  <JsonPreview
228
- v-if="resource.format && resource.format.toLowerCase() === 'json'"
240
+ v-else-if="resource.format && resource.format.toLowerCase() === 'json'"
229
241
  :resource="resource"
242
+ :can-edit="canEdit"
230
243
  />
231
244
  <!-- Show PDF viewer for PDF files -->
232
245
  <PdfPreview
233
246
  v-else-if="resource.format && resource.format.toLowerCase() === 'pdf'"
234
247
  :resource="resource"
248
+ :can-edit="canEdit"
235
249
  />
236
250
  <!-- Show XML viewer for XML files -->
237
251
  <XmlPreview
238
252
  v-else-if="resource.format && resource.format.toLowerCase() === 'xml'"
239
253
  :resource="resource"
254
+ :can-edit="canEdit"
240
255
  />
241
256
  <ImagePreview
242
257
  v-else-if="isImagePreviewFormat(resource.format)"
243
258
  :resource="resource"
259
+ :can-edit="canEdit"
244
260
  />
245
261
  <!-- Show Datafair embedded preview (koumoul) -->
246
262
  <DatafairPreview
@@ -255,8 +271,14 @@
255
271
  />
256
272
  <!-- Show regular preview for other file types -->
257
273
  <Preview
274
+ v-else-if="previewKind === 'tabular'"
275
+ :resource="resource"
276
+ :show-producer-cta="canEdit"
277
+ />
278
+ <PreviewError
258
279
  v-else
259
280
  :resource="resource"
281
+ :show-producer-cta="canEdit"
260
282
  />
261
283
  </div>
262
284
  <div
@@ -328,10 +350,12 @@ import { trackEvent } from '../../functions/matomo'
328
350
  import CopyButton from '../CopyButton.vue'
329
351
  import { useComponentsConfig } from '../../config'
330
352
  import { getOwnerName } from '../../functions/owned'
331
- import { getResourceFormatIcon, getResourceTitleId, detectOgcService, getResourceFilesize, isGeopfSynced, isImagePreviewFormat, resolveResourceExternalUrl } from '../../functions/resources'
353
+ import { getResourceFormatIcon, getResourceTitleId, getResourceFilesize, isGeopfSynced, isImagePreviewFormat, resolveResourceExternalUrl } from '../../functions/resources'
354
+ import PreviewError from './PreviewError.vue'
355
+ import UrlPreview from './UrlPreview.vue'
332
356
  import BrandedButton from '../BrandedButton.vue'
333
357
  import { useTranslation } from '../../composables/useTranslation'
334
- import { useHasTabularData } from '../../composables/useHasTabularData'
358
+ import { useResourceCapabilities } from '../../composables/useResourceCapabilities'
335
359
  import Metadata from './Metadata.vue'
336
360
  import SchemaBadge from './SchemaBadge.vue'
337
361
  import ResourceIcon from './ResourceIcon.vue'
@@ -339,11 +363,8 @@ import EditButton from './EditButton.vue'
339
363
  import DataStructure from './DataStructure.vue'
340
364
  import Downloads from './Downloads.vue'
341
365
  import Preview from './Preview.vue'
342
- import { isOrganizationCertified } from '../../functions/organizations'
343
366
  import OpenApiViewer from '../OpenApiViewer/OpenApiViewer.vue'
344
367
 
345
- const URL_FORMATS = ['url', 'doi', 'www:link', ' www:link-1.0-http--link', 'www:link-1.0-http--partners', 'www:link-1.0-http--related', 'www:link-1.0-http--samples']
346
-
347
368
  const props = withDefaults(defineProps<{
348
369
  dataset: Dataset | DatasetV2
349
370
  expandedOnMount?: boolean
@@ -369,44 +390,40 @@ const ImagePreview = defineAsyncComponent(() => import('./ImagePreview.client.vu
369
390
  const DatafairPreview = defineAsyncComponent(() => import('./Datafair.client.vue'))
370
391
 
371
392
  const { t } = useTranslation()
372
- const checkTabularData = useHasTabularData()
373
-
374
- const hasPreview = computed(() => {
375
- // For JSON, PDF, XML, and image files, show preview.
376
- // We cannot check for CORS issues here because we cannot use an async component here.
377
- // If there is a CORS issue when fetching the file for preview, it will be managed and displayed as an error banner by the preview component.
378
- const format = props.resource.format?.toLowerCase()
379
- return format === 'json' || format === 'pdf' || format === 'xml' || isImagePreviewFormat(format)
380
- })
381
393
 
382
- const hasTabularData = computed(() => checkTabularData(props.resource))
383
-
384
- const hasPmtiles = computed(() => {
385
- return props.resource.extras['analysis:parsing:pmtiles_url'] || props.resource.format === 'pmtiles'
394
+ // Same source of truth as the fullscreen explorer, so the two views cannot
395
+ // drift apart on capabilities (pmtiles, OGC, previews…). Only the accordion-
396
+ // specific `downloads` tab is added below, on top of the shared list.
397
+ const {
398
+ previewKind,
399
+ hasTabularData,
400
+ hasPmtiles,
401
+ hasPmtilesError,
402
+ pmtilesError,
403
+ hasDatafairPreview,
404
+ hasOpenAPIPreview,
405
+ ogcService,
406
+ ogcWms,
407
+ isResourceUrl,
408
+ tabsOptions: sharedTabsOptions,
409
+ } = useResourceCapabilities(() => props.resource, () => props.dataset)
410
+
411
+ // The fullscreen explorer has a dedicated downloads surface; here the accordion
412
+ // keeps its own tab, placed just before the (optional) API tab.
413
+ const tabsOptions = computed(() => {
414
+ const options = [...sharedTabsOptions.value]
415
+ const apiIndex = options.findIndex(tab => tab.key === 'api')
416
+ const index = apiIndex === -1 ? options.length : apiIndex
417
+ options.splice(index, 0, { key: 'downloads', label: t('Téléchargements') })
418
+ return options
386
419
  })
387
420
 
388
421
  const editDisabledReason = computed(() => {
389
422
  return isGeopfSynced(props.resource) ? t('Vous ne pouvez pas modifier cette ressource car elle est synchronisée avec cartes.gouv.fr') : null
390
423
  })
391
424
 
392
- const hasDatafairPreview = computed(() => {
393
- // Checks if there are the corresponding extras for a datafair preview.
394
- // Limited only to datasets published by certified organizations since it will load an iframe.
395
- return isOrganizationCertified(props.dataset.organization) && props.resource.extras['datafairEmbed']
396
- })
397
-
398
- const hasOpenAPIPreview = computed(() => {
399
- // Checks if there are the corresponding extras for a datafair preview.
400
- // Limited only to datasets published by certified organizations since it will load an iframe.
401
- return isOrganizationCertified(props.dataset.organization) && props.resource.extras['apidocUrl']
402
- })
403
-
404
425
  const format = computed(() => getResourceFormatIcon(props.resource.format) ? props.resource.format : t('Fichier'))
405
426
 
406
- const ogcService = computed(() => detectOgcService(props.resource))
407
-
408
- const ogcWms = computed(() => ogcService.value === 'wms')
409
-
410
427
  const open = ref(props.expandedOnMount)
411
428
  const toggle = () => {
412
429
  open.value = !open.value
@@ -419,34 +436,6 @@ const toggle = () => {
419
436
  }
420
437
  }
421
438
 
422
- const tabsOptions = computed(() => {
423
- const options = []
424
-
425
- if (hasPmtiles.value || ogcWms.value) {
426
- options.push({ key: 'map', label: t('Carte') })
427
- }
428
-
429
- if (hasTabularData.value || hasPreview.value || hasDatafairPreview.value || hasOpenAPIPreview.value) {
430
- options.push({ key: 'data', label: t('Aperçu') })
431
- }
432
-
433
- if (props.resource.description) {
434
- options.push({ key: 'description', label: t('Description') })
435
- }
436
-
437
- if (hasTabularData.value) {
438
- options.push({ key: 'data-structure', label: t('Structure des données') })
439
- }
440
-
441
- options.push({ key: 'metadata', label: t('Métadonnées') })
442
- options.push({ key: 'downloads', label: t('Téléchargements') })
443
-
444
- if (hasTabularData.value) {
445
- options.push({ key: 'api', label: t('API') })
446
- }
447
-
448
- return options
449
- })
450
439
  const switchTab = (index: number) => {
451
440
  const option = tabsOptions.value[index]
452
441
  if (!option) {
@@ -480,8 +469,6 @@ const externalUrl = computed(() => resolveResourceExternalUrl(props.dataset, pro
480
469
  const resourceContentId = 'resource-' + props.resource.id
481
470
  const resourceHeaderId = 'resource-' + props.resource.id + '-header'
482
471
  const resourceTitleId = getResourceTitleId(props.resource)
483
-
484
- const isResourceUrl = computed(() => URL_FORMATS.includes(props.resource.format))
485
472
  </script>
486
473
 
487
474
  <style scoped>
@@ -0,0 +1,31 @@
1
+ <template>
2
+ <div class="flex flex-col items-center py-12">
3
+ <p class="fr-text--bold mb-1">
4
+ {{ t('Ce lien renvoie vers une page externe.') }}
5
+ </p>
6
+ <p class="text-sm text-gray-medium mb-4 text-center max-w-lg">
7
+ {{ t('Ce n\'est pas un fichier téléchargeable : suivez le lien pour consulter la ressource.') }}
8
+ </p>
9
+ <BrandedButton
10
+ :href="resource.latest"
11
+ new-tab
12
+ rel="ugc nofollow noopener"
13
+ @click="trackEvent('Jeux de données', 'Télécharger un fichier', 'Bouton : télécharger un fichier')"
14
+ >
15
+ {{ t('Visiter la ressource') }}
16
+ </BrandedButton>
17
+ </div>
18
+ </template>
19
+
20
+ <script setup lang="ts">
21
+ import BrandedButton from '../BrandedButton.vue'
22
+ import type { Resource } from '../../types/resources'
23
+ import { useTranslation } from '../../composables/useTranslation'
24
+ import { trackEvent } from '../../functions/matomo'
25
+
26
+ defineProps<{
27
+ resource: Resource
28
+ }>()
29
+
30
+ const { t } = useTranslation()
31
+ </script>
@@ -5,6 +5,7 @@
5
5
  :resource="resource"
6
6
  :max-size="config.maxXmlPreviewCharSize"
7
7
  :load="load"
8
+ :can-edit="canEdit"
8
9
  >
9
10
  <XmlViewer :xml="(data as string)" />
10
11
  </PreviewWrapper>
@@ -23,6 +24,7 @@ const XmlViewer = defineAsyncComponent(() =>
23
24
 
24
25
  const props = defineProps<{
25
26
  resource: Resource
27
+ canEdit?: boolean
26
28
  }>()
27
29
 
28
30
  const config = useComponentsConfig()
@@ -49,12 +49,13 @@
49
49
  >
50
50
  <ResourceExplorerViewer
51
51
  :key="selectedResource.id"
52
- :dataset
52
+ :dataset="dataset"
53
53
  :resource="selectedResource"
54
54
  :resources="flatResources"
55
55
  :resource-to="resourceTo"
56
56
  :explore-to="exploreTo"
57
57
  :resource-external-url="resourceExternalUrl"
58
+ :can-edit="canEdit"
58
59
  replace
59
60
  :fullscreen
60
61
  />
@@ -132,6 +133,7 @@ const props = withDefaults(defineProps<{
132
133
  exploreTo?: (resource: Resource) => string
133
134
  // Overrides the "Copier le lien" target.
134
135
  resourceExternalUrl?: (resource: Resource) => string
136
+ canEdit?: boolean
135
137
  }>(), {
136
138
  noResultsImage: '',
137
139
  fullscreen: false,
@@ -44,14 +44,15 @@
44
44
  :dataset="dataset"
45
45
  />
46
46
  <MapContainer
47
- v-if="ogcWms"
47
+ v-else-if="ogcWms"
48
48
  :resource="resource"
49
49
  />
50
- <PreviewUnavailable v-if="!hasPmtiles && !ogcWms && hasPmtilesError">
51
- {{ t("La carte n'a pas pu être générée automatiquement pour ce fichier.") }}
52
- <br>
53
- <span class="text-gray-medium text-xs">{{ pmtilesError }}</span>
54
- </PreviewUnavailable>
50
+ <PreviewError
51
+ v-else-if="hasPmtilesError"
52
+ :resource="resource"
53
+ error-type="map_generation"
54
+ :detail="pmtilesError ?? undefined"
55
+ />
55
56
  </div>
56
57
  <div
57
58
  v-if="tab.key === 'data'"
@@ -91,6 +92,7 @@
91
92
  v-else-if="previewKind === 'pdf'"
92
93
  :resource="resource"
93
94
  :fill="fullscreen"
95
+ :can-edit="canEdit"
94
96
  />
95
97
 
96
98
  <!-- Text previews stay padded inside the tab panel -->
@@ -98,17 +100,24 @@
98
100
  v-else
99
101
  class="p-4"
100
102
  >
103
+ <UrlPreview
104
+ v-if="previewKind === 'url'"
105
+ :resource="resource"
106
+ />
101
107
  <JsonPreview
102
- v-if="previewKind === 'json'"
108
+ v-else-if="previewKind === 'json'"
103
109
  :resource="resource"
110
+ :can-edit="canEdit"
104
111
  />
105
112
  <XmlPreview
106
113
  v-else-if="previewKind === 'xml'"
107
114
  :resource="resource"
115
+ :can-edit="canEdit"
108
116
  />
109
117
  <ImagePreview
110
118
  v-else-if="previewKind === 'image'"
111
119
  :resource="resource"
120
+ :can-edit="canEdit"
112
121
  />
113
122
  <DatafairPreview
114
123
  v-else-if="previewKind === 'datafair'"
@@ -119,20 +128,11 @@
119
128
  v-else-if="previewKind === 'openapi'"
120
129
  :url="resource.extras['apidocUrl'] as string"
121
130
  />
122
- <PreviewUnavailable v-else>
123
- <!-- "File too large to download" is the only analysis:error value from hydra for now -->
124
- <template v-if="resource.extras['analysis:error'] === 'File too large to download'">
125
- {{ t("Ce fichier est trop volumineux pour être analysé et prévisualisé. Téléchargez-le avec le bouton Télécharger.") }}
126
- </template>
127
- <template v-else-if="resource.extras['analysis:parsing:error']">
128
- {{ t("L'analyse de ce fichier a rencontré une erreur, l'aperçu n'est pas disponible. Téléchargez-le avec le bouton Télécharger.") }}
129
- <br>
130
- <span class="text-gray-medium text-xs">{{ resource.extras['analysis:parsing:error'] }}</span>
131
- </template>
132
- <template v-else>
133
- {{ t("Ce fichier ne peut pas être prévisualisé. Téléchargez-le avec le bouton Télécharger.") }}
134
- </template>
135
- </PreviewUnavailable>
131
+ <PreviewError
132
+ v-else
133
+ :resource="resource"
134
+ :show-producer-cta="canEdit"
135
+ />
136
136
  </div>
137
137
  </div>
138
138
  <div v-if="tab.key === 'description'">
@@ -175,7 +175,8 @@
175
175
  <script setup lang="ts">
176
176
  import { computed, defineAsyncComponent, ref } from 'vue'
177
177
  import { useRoute, useRouter } from 'vue-router'
178
- import PreviewUnavailable from '../ResourceAccordion/PreviewUnavailable.vue'
178
+ import PreviewError from '../ResourceAccordion/PreviewError.vue'
179
+ import UrlPreview from '../ResourceAccordion/UrlPreview.vue'
179
180
  import MarkdownViewer from '../MarkdownViewer.vue'
180
181
  import OpenApiViewer from '../OpenApiViewer/OpenApiViewer.vue'
181
182
  import TabGroup from '../Tabs/TabGroup.vue'
@@ -238,6 +239,7 @@ const props = withDefaults(defineProps<{
238
239
  // bottom, and hide the inline download/visit/copy actions — they're shown in the
239
240
  // dataset context bar above. Inline mode (dataset page) shows them in the header.
240
241
  fullscreen?: boolean
242
+ canEdit?: boolean
241
243
  }>(), {
242
244
  fullscreen: false,
243
245
  })
@@ -1,10 +1,10 @@
1
1
  <template>
2
2
  <div class="flex min-h-0 flex-1 flex-col">
3
- <PreviewUnavailable v-if="previewError">
4
- {{ t("L'aperçu de ce fichier n'a pas pu être chargé.") }}
5
- <br>
6
- <span class="text-xs break-words">{{ previewError }}</span>
7
- </PreviewUnavailable>
3
+ <PreviewError
4
+ v-if="previewError"
5
+ error-type="load_failed"
6
+ :detail="typeof previewError === 'string' ? previewError : undefined"
7
+ />
8
8
 
9
9
  <!-- Same skeleton as the Suspense fallback above us: in both cases the slot isn't
10
10
  rendered yet, so its toolbar is a placeholder too. -->
@@ -31,7 +31,7 @@ import { useComponentsConfig } from '../../config'
31
31
  import { useTranslation } from '../../composables/useTranslation'
32
32
  import { injectTabularProfile } from '../../composables/useTabularProfile'
33
33
  import { hasFilterForColumn as _hasFilterForColumn, buildDateFilterParams, buildGlobalSearchConditions, isSameSort, useFormatTabular } from '../../functions/tabular'
34
- import PreviewUnavailable from '../ResourceAccordion/PreviewUnavailable.vue'
34
+ import PreviewError from '../ResourceAccordion/PreviewError.vue'
35
35
  import TabularSkeleton from './TabularSkeleton.vue'
36
36
  import type { TabularDataResponse, TabularRow, SortConfig, ColumnFilters, DateFilter, TabularUrlAlias } from './types'
37
37
  import { provideTabularContext, type ActiveFilter } from './useTabularContext'
@@ -2,7 +2,8 @@ import { computed, type MaybeRefOrGetter, toValue } from 'vue'
2
2
  import { useComponentsConfig } from '../config'
3
3
  import { isOrganizationCertified } from '../functions/organizations'
4
4
  import { getGeneratedFormats, getWfsExportFormats } from '../functions/resourceCapabilities'
5
- import { detectOgcService, getParsingErrorMessage, getParsingErrorStep, isImagePreviewFormat } from '../functions/resources'
5
+ import { hasPreviewError } from '../functions/previewErrors'
6
+ import { detectOgcService, getParsingErrorMessage, getParsingErrorStep, isImagePreviewFormat, isPmtilesSourceFormat, isTabularPipelineFormat } from '../functions/resources'
6
7
  import type { Dataset, DatasetV2 } from '../types/datasets'
7
8
  import type { Resource, WfsMetadata } from '../types/resources'
8
9
  import { useHasTabularData } from './useHasTabularData'
@@ -13,7 +14,7 @@ const URL_FORMATS = ['url', 'doi', 'www:link', 'www:link-1.0-http--link', 'www:l
13
14
  // Which preview the data tab shows. Single source of truth: the viewer renders it and
14
15
  // the skeleton picks the matching placeholder shape, so each holding its own copy of
15
16
  // this precedence would let the two drift apart.
16
- export type PreviewKind = 'json' | 'pdf' | 'xml' | 'image' | 'datafair' | 'openapi' | 'tabular' | 'unavailable'
17
+ export type PreviewKind = 'json' | 'pdf' | 'xml' | 'image' | 'datafair' | 'openapi' | 'tabular' | 'url' | 'unavailable'
17
18
 
18
19
  export function useResourceCapabilities(
19
20
  resource: MaybeRefOrGetter<Resource>,
@@ -50,7 +51,11 @@ export function useResourceCapabilities(
50
51
 
51
52
  // The map is built from a pmtiles export; when that export fails we still want
52
53
  // to show the Carte tab, but with the reason it could not be generated.
53
- const hasPmtilesError = computed(() => getParsingErrorStep(toValue(resource)) === 'pmtiles_export')
54
+ const hasPmtilesError = computed(() => {
55
+ const r = toValue(resource)
56
+ if (getParsingErrorStep(r) === 'pmtiles_export') return true
57
+ return r.extras['analysis:error'] === 'File too large to download' && isPmtilesSourceFormat(r.format)
58
+ })
54
59
  const pmtilesError = computed(() => hasPmtilesError.value ? getParsingErrorMessage(toValue(resource)) : null)
55
60
 
56
61
  const generatedFormats = computed(() => getGeneratedFormats(toValue(resource), config.tabularApiUrl))
@@ -72,6 +77,7 @@ export function useResourceCapabilities(
72
77
  // carries a parsing table is a PDF first.
73
78
  const previewKind = computed<PreviewKind>(() => {
74
79
  const format = toValue(resource).format?.toLowerCase()
80
+ if (isResourceUrl.value) return 'url'
75
81
  if (format === 'json') return 'json'
76
82
  if (format === 'pdf') return 'pdf'
77
83
  if (format === 'xml') return 'xml'
@@ -83,8 +89,9 @@ export function useResourceCapabilities(
83
89
  })
84
90
 
85
91
  // Whether opening the resource shows its content (a preview or a map), not just
86
- // its metadata.
87
- const hasPreview = computed(() => previewKind.value !== 'unavailable' || !!hasPmtiles.value || ogcWms.value)
92
+ // its metadata. A link resource is only ever meant to be visited, exploring
93
+ // nothing in product — the eye badge in lists must not claim otherwise.
94
+ const hasPreview = computed(() => (previewKind.value !== 'unavailable' && previewKind.value !== 'url') || !!hasPmtiles.value || ogcWms.value)
88
95
 
89
96
  const tabsOptions = computed(() => {
90
97
  const r = toValue(resource)
@@ -94,16 +101,25 @@ export function useResourceCapabilities(
94
101
  const mapTab = { key: 'map', label: t('Carte') }
95
102
  const hasMap = hasPmtiles.value || ogcWms.value
96
103
 
97
- // The map is the most visual preview: when it is available, show it first.
98
- // When its generation failed, keep the data preview first and surface the
99
- // Carte tab (with its error) right after.
104
+ // The map is the most visual preview: when it is available, show it first,
105
+ // and keep the data tab only when another preview (table, PDF, JSON…)
106
+ // exists for the same resource.
100
107
  if (hasMap) {
101
- options.push(mapTab, dataTab)
108
+ options.push(mapTab)
109
+ if (previewKind.value !== 'unavailable') {
110
+ options.push(dataTab)
111
+ }
102
112
  }
103
113
  else if (hasPmtilesError.value) {
104
- options.push(dataTab, mapTab)
114
+ if (previewKind.value !== 'unavailable') {
115
+ options.push(dataTab)
116
+ }
117
+ options.push(mapTab)
105
118
  }
106
- else {
119
+ // Without a map, keep the data tab when it can show something: a real preview,
120
+ // a diagnosable error explaining why it cannot render, or a tabular-pipeline
121
+ // format whose table the robot has not parsed yet.
122
+ else if (previewKind.value !== 'unavailable' || hasPreviewError(r) || isTabularPipelineFormat(r.format)) {
107
123
  options.push(dataTab)
108
124
  }
109
125
 
package/src/config.ts CHANGED
@@ -52,6 +52,7 @@ export type PluginConfig = {
52
52
  useRoute?: () => RouteLocationNormalizedLoaded
53
53
  searchDebounce?: number
54
54
  forumUrl?: string
55
+ supportUrl?: string
55
56
  }
56
57
 
57
58
  export const configKey = Symbol() as InjectionKey<PluginConfig>