@datagouv/components-next 1.0.2-dev.161 → 1.0.2-dev.162

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 (48) hide show
  1. package/dist/{Datafair.client-Bz1l4SLK.js → Datafair.client-DXPU1V24.js} +1 -1
  2. package/dist/{JsonPreview.client-XwLb74J8.js → JsonPreview.client-D1SnGfWG.js} +2 -2
  3. package/dist/{MapContainer.client-DJm7fYDx.js → MapContainer.client-DlsaEVGx.js} +2 -2
  4. package/dist/{PdfPreview.client-CoLz0aZp.js → PdfPreview.client-C9OrLR0z.js} +2 -2
  5. package/dist/{Pmtiles.client-bKmHL2Qg.js → Pmtiles.client-CyylWfTy.js} +5660 -5842
  6. package/dist/{PreviewWrapper.vue_vue_type_script_setup_true_lang-CxXJ7rC5.js → PreviewWrapper.vue_vue_type_script_setup_true_lang-CtXZOHXI.js} +10 -7
  7. package/dist/{XmlPreview.client-Baetgqam.js → XmlPreview.client-DoX7RurH.js} +3 -3
  8. package/dist/components-next.css +1 -1
  9. package/dist/components-next.js +171 -178
  10. package/dist/components.css +1 -1
  11. package/dist/{index-Crp28Eov.js → index-Br1sa7wQ.js} +4293 -4392
  12. package/dist/{leaflet-src-CRXb3b2x.js → leaflet-src-DWG7tmpQ.js} +1 -1
  13. package/dist/{main-Cmq8fQdM.js → main-BU6kP4dE.js} +14044 -14487
  14. package/dist/{vue3-xml-viewer.common-H2czi46-.js → vue3-xml-viewer.common-Cpui-Yi9.js} +1 -1
  15. package/package.json +5 -4
  16. package/src/components/Chart/ChartViewer.vue +10 -103
  17. package/src/components/Chart/ChartViewerWrapper.vue +0 -8
  18. package/src/components/DataserviceCard.vue +0 -6
  19. package/src/components/DatasetQuality.vue +11 -11
  20. package/src/components/DatasetQualityInline.vue +2 -2
  21. package/src/components/DatasetQualityTooltipContent.vue +1 -1
  22. package/src/components/ResourceAccordion/ResourceAccordion.vue +3 -8
  23. package/src/components/ResourceExplorer/ResourceExplorerViewer.vue +1 -15
  24. package/src/components/ReuseCard.vue +2 -2
  25. package/src/components/ReuseDetails.vue +2 -2
  26. package/src/components/ReuseHorizontalCard.vue +2 -2
  27. package/src/components/Search/GlobalSearch.vue +2 -2
  28. package/src/components/TabularExplorer/TabularExplorer.vue +5 -31
  29. package/src/components/TabularExplorer/types.ts +2 -2
  30. package/src/composables/useHasTabularData.ts +1 -2
  31. package/src/composables/useResourceCapabilities.ts +14 -27
  32. package/src/config.ts +0 -1
  33. package/src/functions/charts.ts +2 -18
  34. package/src/functions/resources.ts +0 -56
  35. package/src/main.ts +5 -12
  36. package/src/types/dataservices.ts +0 -15
  37. package/src/types/organizations.ts +0 -10
  38. package/src/types/reuses.ts +1 -12
  39. package/src/types/search.ts +2 -2
  40. package/src/types/visualizations.ts +1 -1
  41. package/dist/ImagePreview.client-CogDiX0n.js +0 -36
  42. package/src/components/DataserviceQuality.vue +0 -82
  43. package/src/components/DataserviceQualityInline.vue +0 -31
  44. package/src/components/DataserviceQualityTooltipContent.vue +0 -79
  45. package/src/components/ResourceAccordion/ImagePreview.client.vue +0 -48
  46. /package/src/components/{QualityItem.vue → DatasetQualityItem.vue} +0 -0
  47. /package/src/components/{QualityItemWarning.vue → DatasetQualityItemWarning.vue} +0 -0
  48. /package/src/components/{QualityScore.vue → DatasetQualityScore.vue} +0 -0
@@ -1,12 +1,12 @@
1
- import { computed, type MaybeRefOrGetter, toValue } from 'vue'
1
+ import { computed, toValue, type MaybeRefOrGetter } from 'vue'
2
2
  import { useComponentsConfig } from '../config'
3
+ import { useTranslation } from './useTranslation'
4
+ import { useHasTabularData } from './useHasTabularData'
5
+ import { detectOgcService } from '../functions/resources'
3
6
  import { isOrganizationCertified } from '../functions/organizations'
4
- import { getWfsExportFormats } from '../functions/resourceCapabilities'
5
- import { detectOgcService, getParsingErrorMessage, getParsingErrorStep, isImagePreviewFormat } from '../functions/resources'
6
- import type { Dataset, DatasetV2 } from '../types/datasets'
7
7
  import type { Resource, WfsMetadata } from '../types/resources'
8
- import { useHasTabularData } from './useHasTabularData'
9
- import { useTranslation } from './useTranslation'
8
+ import type { Dataset, DatasetV2 } from '../types/datasets'
9
+ import { getWfsExportFormats } from '../functions/resourceCapabilities'
10
10
 
11
11
  const GENERATED_FORMATS = ['parquet', 'pmtiles', 'geojson']
12
12
  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']
@@ -21,7 +21,7 @@ export function useResourceCapabilities(
21
21
 
22
22
  const hasPreview = computed(() => {
23
23
  const format = toValue(resource).format?.toLowerCase()
24
- return format === 'json' || format === 'pdf' || format === 'xml' || isImagePreviewFormat(format)
24
+ return format === 'json' || format === 'pdf' || format === 'xml'
25
25
  })
26
26
 
27
27
  const hasTabularData = computed(() => {
@@ -49,11 +49,6 @@ export function useResourceCapabilities(
49
49
  const ogcService = computed(() => detectOgcService(toValue(resource)))
50
50
  const ogcWms = computed(() => ogcService.value === 'wms')
51
51
 
52
- // The map is built from a pmtiles export; when that export fails we still want
53
- // to show the Carte tab, but with the reason it could not be generated.
54
- const hasPmtilesError = computed(() => getParsingErrorStep(toValue(resource)) === 'pmtiles_export')
55
- const pmtilesError = computed(() => hasPmtilesError.value ? getParsingErrorMessage(toValue(resource)) : null)
56
-
57
52
  const generatedFormats = computed(() => {
58
53
  const r = toValue(resource)
59
54
  const formats = GENERATED_FORMATS
@@ -90,27 +85,21 @@ export function useResourceCapabilities(
90
85
  const r = toValue(resource)
91
86
  const options = []
92
87
 
93
- const dataTab = { key: 'data', label: hasTabularData.value ? t('Données') : t('Aperçu') }
94
- const mapTab = { key: 'map', label: t('Carte') }
95
- const hasMap = hasPmtiles.value || ogcWms.value
96
-
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.
100
- if (hasMap) {
101
- options.push(mapTab, dataTab)
102
- }
103
- else if (hasPmtilesError.value) {
104
- options.push(dataTab, mapTab)
88
+ if (hasTabularData.value) {
89
+ options.push({ key: 'data', label: t('Données') })
105
90
  }
106
91
  else {
107
- options.push(dataTab)
92
+ options.push({ key: 'data', label: t('Aperçu') })
108
93
  }
109
94
 
110
95
  if (hasTabularData.value) {
111
96
  options.push({ key: 'data-structure', label: t('Structure des données') })
112
97
  }
113
98
 
99
+ if (hasPmtiles.value || ogcWms.value) {
100
+ options.push({ key: 'map', label: t('Carte') })
101
+ }
102
+
114
103
  if (r.description) {
115
104
  options.push({ key: 'description', label: t('Description') })
116
105
  }
@@ -129,8 +118,6 @@ export function useResourceCapabilities(
129
118
  hasPreview,
130
119
  hasTabularData,
131
120
  hasPmtiles,
132
- hasPmtilesError,
133
- pmtilesError,
134
121
  hasDatafairPreview,
135
122
  hasOpenAPIPreview,
136
123
  ogcService,
package/src/config.ts CHANGED
@@ -12,7 +12,6 @@ export type PluginConfig = {
12
12
  datasetQualityGuideUrl?: string
13
13
  maxJsonPreviewCharSize?: number // Maximum size of JSON to preview in characters. JSON preview module is partly collapsed by default so we can have a preview for large files.
14
14
  maxPdfPreviewByteSize?: number // Maximum size of PDF to preview in bytes
15
- maxImagePreviewByteSize?: number // Maximum size of image to preview in bytes
16
15
  maxXmlPreviewCharSize?: number // Maximum size of XML to preview in characters. XML preview module can NOT be collapsed by default so we should not have a preview for large files.
17
16
  pmtilesViewerBaseUrl?: string | null // Base URL of a pmtiles viewer (ex: https://pmtiles.io/#url=)
18
17
  metricsApiUrl?: string
@@ -1,5 +1,5 @@
1
1
  import type { Chart, ChartForm, ChartForApi, Filter, ColumnDefinition } from '../types/visualizations'
2
- import type { ColumnType, TabularProfile } from '../components/TabularExplorer/types'
2
+ import type { TabularProfile } from '../components/TabularExplorer/types'
3
3
  import { resolveColumnType } from './tabular'
4
4
 
5
5
  export function toChartForm(chart: Chart) {
@@ -74,22 +74,6 @@ export function buildColumnsFromProfile(profile: { profile: TabularProfile }): A
74
74
  const colInfo = profile.profile.columns[name]
75
75
  const isCategorical = profile.profile.categorical.includes(name)
76
76
  const colType = resolveColumnType(colInfo ?? { python_type: 'unknown', format: undefined }, isCategorical)
77
- const colProfile = profile.profile.profile[name]
78
- return {
79
- name,
80
- type: colType,
81
- min: normalizeProfileNumber(colProfile?.min, colType),
82
- max: normalizeProfileNumber(colProfile?.max, colType),
83
- }
77
+ return { name, type: colType }
84
78
  })
85
79
  }
86
-
87
- function normalizeProfileNumber(value: number | string | undefined, type: ColumnType): number | undefined {
88
- if (value === undefined || value === null) return undefined
89
- if (type === 'date' && typeof value === 'string') {
90
- const timestamp = new Date(value).getTime()
91
- return Number.isNaN(timestamp) ? undefined : timestamp
92
- }
93
- const parsed = Number(value)
94
- return Number.isNaN(parsed) ? undefined : parsed
95
- }
@@ -105,29 +105,14 @@ export const getResourceLabel = (type: ResourceType, count?: number) => {
105
105
  }
106
106
  return t('Fichiers principaux')
107
107
  case 'documentation':
108
- if (typeof count === 'number') {
109
- return t('Aucun fichier de documentation | 1 fichier de documentation | {n} fichiers de documentation', count)
110
- }
111
108
  return t('Documentation')
112
109
  case 'update':
113
- if (typeof count === 'number') {
114
- return t('Aucune mise à jour | 1 mise à jour | {n} mises à jour', count)
115
- }
116
110
  return t('Mise à jour')
117
111
  case 'api':
118
- if (typeof count === 'number') {
119
- return t('Aucune API | 1 API | {n} API', count)
120
- }
121
112
  return t('API')
122
113
  case 'code':
123
- if (typeof count === 'number') {
124
- return t('Aucun fichier de code source | 1 fichier de code source | {n} fichiers de code source', count)
125
- }
126
114
  return t('Code source')
127
115
  case 'other':
128
- if (typeof count === 'number') {
129
- return t('Aucun autre fichier | 1 autre fichier | {n} autres fichiers', count)
130
- }
131
116
  return t('Autre')
132
117
  }
133
118
  }
@@ -167,47 +152,6 @@ export function getResourceFilesize(resource: Resource): null | number {
167
152
  return null
168
153
  }
169
154
 
170
- const IMAGE_PREVIEW_FORMATS = ['png', 'jpg', 'jpeg', 'jpe', 'gif', 'webp'] as const
171
-
172
- export function isImagePreviewFormat(format: string | undefined | null): boolean {
173
- if (!format) return false
174
- return IMAGE_PREVIEW_FORMATS.includes(format.toLowerCase() as typeof IMAGE_PREVIEW_FORMATS[number])
175
- }
176
-
177
- // Parsing errors are stored as `<step>:<message>`, where `<step>` names the
178
- // analysis step that failed (e.g. `pmtiles_export`, `geojson_export`).
179
-
180
- /** The analysis step that failed, or null when there is no parsing error. */
181
- export function getParsingErrorStep(resource: Resource): string | null {
182
- const error = resource.extras['analysis:parsing:error']
183
- if (typeof error !== 'string' || !error) return null
184
- const [step] = error.split(':', 1)
185
- return step ?? null
186
- }
187
-
188
- /** The parsing error message without its `<step>:` prefix, or null when there is none. */
189
- export function getParsingErrorMessage(resource: Resource): string | null {
190
- const error = resource.extras['analysis:parsing:error']
191
- if (typeof error !== 'string' || !error) return null
192
- const colon = error.indexOf(':')
193
- return colon === -1 ? error : error.slice(colon + 1)
194
- }
195
-
196
- // Geo/format export steps run *after* the tabular table has been built, so a
197
- // failure here (e.g. a huge geometry timing out the pmtiles export) leaves the
198
- // tabular data fully usable and must not disable the tabular explorer.
199
- const NON_TABULAR_PARSING_ERROR_STEPS = ['pmtiles_export', 'geojson_export']
200
-
201
- /**
202
- * Whether the resource's parsing error prevents reading its tabular data.
203
- * Only errors from the tabular parsing itself are fatal; downstream geo/format
204
- * export failures are not.
205
- */
206
- export function hasTabularParsingError(resource: Resource): boolean {
207
- const step = getParsingErrorStep(resource)
208
- return step !== null && !NON_TABULAR_PARSING_ERROR_STEPS.includes(step)
209
- }
210
-
211
155
  type CorsStatus = 'allowed' | 'blocked' | 'unknown'
212
156
 
213
157
  export const getResourceCorsStatus = (resource: Resource): CorsStatus => {
package/src/main.ts CHANGED
@@ -15,7 +15,7 @@ import type { Owned, OwnedWithFullObject, OwnedWithId } from './types/owned'
15
15
  import type { Comment, Thread } from './types/discussions'
16
16
  import type { PageBloc, ContentBloc, BlocWithTitle, DatasetsListBloc, DataservicesListBloc, ReusesListBloc, LinkInBloc, LinksListBloc, MarkdownBloc, AccordionItemBloc, AccordionListBloc, HeroBloc } from './types/pages'
17
17
  import type { Post } from './types/posts'
18
- import type { ReuseReference, NewReuse, Reuse, ReuseV2, ReuseTopic, ReuseType } from './types/reuses'
18
+ import type { ReuseReference, NewReuse, Reuse, ReuseTopic, ReuseType } from './types/reuses'
19
19
  import type { RegisteredSchema, Schema, SchemaDetails, SchemaField, SchemaPath, SchemaPublicationMode, SchemaResponseData, SchemaVersion, ValidataError } from './types/schemas'
20
20
  import type { TopicV2, TopicElement, TopicElementClass, TopicElementRel } from './types/topics'
21
21
  import type { CommunityResource, FileResourceFileType, RemoteResourceFileType, ResourceFileType, ResourceGroup, ResourceType, Resource } from './types/resources'
@@ -40,9 +40,6 @@ import BannerAction from './components/BannerAction.vue'
40
40
  import BrandedButton from './components/BrandedButton.vue'
41
41
  import CopyButton from './components/CopyButton.vue'
42
42
  import DataserviceCard from './components/DataserviceCard.vue'
43
- import DataserviceQuality from './components/DataserviceQuality.vue'
44
- import DataserviceQualityInline from './components/DataserviceQualityInline.vue'
45
- import DataserviceQualityTooltipContent from './components/DataserviceQualityTooltipContent.vue'
46
43
  import DatasetCard from './components/DatasetCard.vue'
47
44
  import DataStructure from './components/ResourceAccordion/DataStructure.vue'
48
45
  import Downloads from './components/ResourceAccordion/Downloads.vue'
@@ -57,8 +54,8 @@ import LicenseBadge from './components/LicenseBadge.vue'
57
54
  import Tag from './components/Tag.vue'
58
55
  import DatasetQuality from './components/DatasetQuality.vue'
59
56
  import DatasetQualityInline from './components/DatasetQualityInline.vue'
60
- import QualityItem from './components/QualityItem.vue'
61
- import QualityScore from './components/QualityScore.vue'
57
+ import DatasetQualityItem from './components/DatasetQualityItem.vue'
58
+ import DatasetQualityScore from './components/DatasetQualityScore.vue'
62
59
  import ProgressBar from './components/ProgressBar.vue'
63
60
  import DatasetQualityTooltipContent from './components/DatasetQualityTooltipContent.vue'
64
61
  import ExtraAccordion from './components/ExtraAccordion.vue'
@@ -231,7 +228,6 @@ export type {
231
228
  ResourceType,
232
229
  ReuseReference,
233
230
  Reuse,
234
- ReuseV2,
235
231
  ReuseTopic,
236
232
  ReuseType,
237
233
  Schema,
@@ -338,9 +334,6 @@ export {
338
334
  BrandedButton,
339
335
  CopyButton,
340
336
  DataserviceCard,
341
- DataserviceQuality,
342
- DataserviceQualityInline,
343
- DataserviceQualityTooltipContent,
344
337
  DatasetCard,
345
338
  DataStructure,
346
339
  Downloads,
@@ -355,8 +348,8 @@ export {
355
348
  DiscussionMessageCard,
356
349
  DatasetQuality,
357
350
  DatasetQualityInline,
358
- QualityItem,
359
- QualityScore,
351
+ DatasetQualityItem,
352
+ DatasetQualityScore,
360
353
  DatasetQualityTooltipContent,
361
354
  DateRangeDetails,
362
355
  ExtraAccordion,
@@ -31,20 +31,6 @@ export type BaseDataservice = Owned & WithAccessType & {
31
31
 
32
32
  export type NewDataservice = Omit<BaseDataservice, keyof OwnedWithId> & OwnedWithId
33
33
 
34
- export type DataserviceQuality = {
35
- has_description: boolean
36
- has_machine_documentation: boolean
37
- has_technical_documentation: boolean
38
- has_business_documentation: boolean
39
- license: boolean
40
- has_contact_point: boolean
41
- has_base_api_url: boolean
42
- availability_documented: boolean
43
- rate_limiting_documented: boolean
44
- access_conditions_clear: boolean
45
- score: number
46
- }
47
-
48
34
  export type Dataservice = Owned & WithAccessType & {
49
35
  acronym: string
50
36
  archived_at: string | null
@@ -86,5 +72,4 @@ export type Dataservice = Owned & WithAccessType & {
86
72
  slug: string
87
73
  tags: Array<string>
88
74
  title: string
89
- quality?: DataserviceQuality
90
75
  }
@@ -1,6 +1,5 @@
1
1
  import type { User } from './users'
2
2
  import type { Badges } from './badges'
3
- import type { PageBloc } from './pages'
4
3
 
5
4
  export type MemberRole = 'admin' | 'editor' | 'partial_editor'
6
5
 
@@ -69,13 +68,4 @@ export type Organization = {
69
68
  reuses_by_months: Record<string, number>
70
69
  views: number
71
70
  }
72
- // Editorial blocs powering the organization "Présentation" tab. Excluded from
73
- // the default API read mask, so only present when requested with X-Fields.
74
- // Read through the API's `public_presentation_blocs`: hidden from the public until
75
- // published, but always returned to organization administrators.
76
- presentation_blocs?: Array<PageBloc>
77
- // Publication date of the blocs. `null` means draft (never public); a set date
78
- // means published. Like `presentation_blocs`, only present when requested with
79
- // X-Fields.
80
- presentation_blocs_published_at?: string | null
81
71
  }
@@ -1,5 +1,5 @@
1
1
  import type { Owned, OwnedWithId } from './owned'
2
- import type { Dataset, Rel } from './datasets'
2
+ import type { Dataset } from './datasets'
3
3
  import type { Badges } from './badges'
4
4
  import type { Dataservice } from './dataservices'
5
5
 
@@ -51,17 +51,6 @@ export type Reuse = BaseReuse & {
51
51
  permissions: { edit: boolean, delete: boolean }
52
52
  }
53
53
 
54
- /**
55
- * Lightweight reuse returned by the listing endpoints (`/api/2/reuses/` and
56
- * `/api/2/reuses/search/`): the `datasets` and `dataservices` reference lists
57
- * are replaced by links to their respective listing endpoints filtered on this
58
- * reuse, so that listing reuses does not dereference every linked dataset.
59
- */
60
- export type ReuseV2 = Owned & Omit<Reuse, 'datasets' | 'dataservices'> & {
61
- datasets: Rel
62
- dataservices: Rel
63
- }
64
-
65
54
  export type ReuseType = {
66
55
  id: string
67
56
  label: string
@@ -4,7 +4,7 @@ import type { AccessType } from './access_types'
4
4
  import type { Dataset } from './datasets'
5
5
  import type { Dataservice } from './dataservices'
6
6
  import type { Organization } from './organizations'
7
- import type { ReuseV2 } from './reuses'
7
+ import type { Reuse } from './reuses'
8
8
  import type { TopicV2 } from './topics'
9
9
  import type {
10
10
  CERTIFIED,
@@ -372,7 +372,7 @@ export type GlobalSearchConfig = SearchTypeConfig[]
372
372
  export type SearchResponseByClass = {
373
373
  datasets: DatasetSearchResponse<Dataset>
374
374
  dataservices: DataserviceSearchResponse<Dataservice>
375
- reuses: ReuseSearchResponse<ReuseV2>
375
+ reuses: ReuseSearchResponse<Reuse>
376
376
  organizations: OrganizationSearchResponse<Organization>
377
377
  topics: TopicSearchResponse<TopicV2>
378
378
  }
@@ -89,5 +89,5 @@ export type ChartForm = Omit<ChartForApi, 'x_axis' | 'series' | 'owner' | 'organ
89
89
  filter: GenericFilter | null
90
90
  }
91
91
 
92
- export type ColumnDefinition = { name: string, type: ColumnType, min?: number, max?: number }
92
+ export type ColumnDefinition = { name: string, type: ColumnType }
93
93
  export type ColumnsDefinition = Record<string, Array<ColumnDefinition>>
@@ -1,36 +0,0 @@
1
- import { defineComponent as T, ref as _, computed as l, openBlock as r, createElementBlock as u, createBlock as p, withCtx as f, createTextVNode as m, toDisplayString as g, unref as o } from "vue";
2
- import { a as y, u as z, b as k, _ as d } from "./main-Cmq8fQdM.js";
3
- const w = { class: "text-xs" }, B = ["src"], E = /* @__PURE__ */ T({
4
- __name: "ImagePreview.client",
5
- props: {
6
- resource: {}
7
- },
8
- setup(a) {
9
- const n = a, { t } = y(), h = z(), i = _(!1), v = l(() => n.resource.format?.toUpperCase() ?? t("Fichier")), c = l(() => k(n.resource)), x = l(() => {
10
- const s = c.value, e = h.maxImagePreviewByteSize;
11
- return !s || !e ? !1 : s <= e;
12
- });
13
- return (s, e) => (r(), u("div", w, [
14
- x.value ? i.value ? (r(), p(d, { key: 1 }, {
15
- default: f(() => [
16
- m(g(o(t)("L'aperçu de ce fichier n'a pas pu être chargé. Téléchargez-le depuis l'onglet Téléchargements.")), 1)
17
- ]),
18
- _: 1
19
- })) : (r(), u("img", {
20
- key: 2,
21
- src: a.resource.url,
22
- alt: "",
23
- class: "block w-full h-auto max-w-[800px]",
24
- onError: e[0] || (e[0] = (C) => i.value = !0)
25
- }, null, 40, B)) : (r(), p(d, { key: 0 }, {
26
- default: f(() => [
27
- m(g(c.value ? o(t)("Le fichier {fileType} est trop volumineux pour être prévisualisé. Téléchargez-le depuis l'onglet Téléchargements.", { fileType: v.value }) : o(t)("La taille du fichier est inconnue, l'aperçu n'est pas disponible. Téléchargez-le depuis l'onglet Téléchargements.")), 1)
28
- ]),
29
- _: 1
30
- }))
31
- ]));
32
- }
33
- });
34
- export {
35
- E as default
36
- };
@@ -1,82 +0,0 @@
1
- <template>
2
- <Toggletip
3
- :styled-button="false"
4
- button-class="flex items-center gap-1 rounded-sm p-1.5 -m-1.5 border-transparent -outline-offset-2 hover:bg-gray-some transition-colors w-full text-left"
5
- :button-props="{ title: t('Qualité des métadonnées') }"
6
- >
7
- <QualityScore
8
- :score="quality.score"
9
- class="w-full"
10
- />
11
- <RiInformationLine
12
- class="size-5 shrink-0"
13
- aria-hidden="true"
14
- />
15
- <template #toggletip>
16
- <DataserviceQualityTooltipContent :quality />
17
- </template>
18
- </Toggletip>
19
- <template v-if="!hideWarnings">
20
- <ul class="list-none pl-0">
21
- <QualityItemWarning
22
- :quality-item="quality.has_description"
23
- :message="t('Description non renseignée')"
24
- />
25
- <QualityItemWarning
26
- :quality-item="quality.has_machine_documentation"
27
- :message="t('Documentation machine (OpenAPI) manquante')"
28
- />
29
- <QualityItemWarning
30
- :quality-item="quality.has_technical_documentation"
31
- :message="t('Documentation technique manquante')"
32
- />
33
- <QualityItemWarning
34
- :quality-item="quality.has_business_documentation"
35
- :message="t('Documentation métier manquante')"
36
- />
37
- <QualityItemWarning
38
- :quality-item="quality.license"
39
- :message="t('Licence non renseignée')"
40
- />
41
- <QualityItemWarning
42
- :quality-item="quality.has_contact_point"
43
- :message="t('Point de contact non renseigné')"
44
- />
45
- <QualityItemWarning
46
- :quality-item="quality.has_base_api_url"
47
- :message="t(`URL de base de l'API non renseignée`)"
48
- />
49
- <QualityItemWarning
50
- :quality-item="quality.availability_documented"
51
- :message="t('Disponibilité non documentée')"
52
- />
53
- <QualityItemWarning
54
- :quality-item="quality.rate_limiting_documented"
55
- :message="t(`Limite d'appels non documentée`)"
56
- />
57
- <QualityItemWarning
58
- :quality-item="quality.access_conditions_clear"
59
- :message="t(`Conditions d'accès non précisées`)"
60
- />
61
- </ul>
62
- </template>
63
- </template>
64
-
65
- <script setup lang="ts">
66
- import { RiInformationLine } from '@remixicon/vue'
67
- import type { DataserviceQuality } from '../types/dataservices'
68
- import QualityScore from './QualityScore.vue'
69
- import QualityItemWarning from './QualityItemWarning.vue'
70
- import DataserviceQualityTooltipContent from './DataserviceQualityTooltipContent.vue'
71
- import Toggletip from './Toggletip.vue'
72
- import { useTranslation } from '../composables/useTranslation'
73
-
74
- withDefaults(defineProps<{
75
- quality: DataserviceQuality
76
- hideWarnings?: boolean
77
- }>(), {
78
- hideWarnings: false,
79
- })
80
-
81
- const { t } = useTranslation()
82
- </script>
@@ -1,31 +0,0 @@
1
- <template>
2
- <div class="m-0 text-sm text-gray-medium">
3
- <Toggletip
4
- :styled-button="false"
5
- button-class="border-transparent -outline-offset-2 inline-flex items-center justify-center hover:bg-gray-lower transition-colors"
6
- :button-props="{ class: 'relative z-2 gap-1 rounded-sm px-1 -mx-1 group/quality', title: t('Qualité des métadonnées') }"
7
- >
8
- <RiInformationLine class="size-3.5 shrink-0" />
9
- <span class="text-gray-medium text-sm group-hover/quality:underline">{{ t('Métadonnées :') }}</span>
10
- <QualityScore :score="quality.score" />
11
- <template #toggletip>
12
- <DataserviceQualityTooltipContent :quality />
13
- </template>
14
- </Toggletip>
15
- </div>
16
- </template>
17
-
18
- <script setup lang="ts">
19
- import { RiInformationLine } from '@remixicon/vue'
20
- import type { DataserviceQuality } from '../types/dataservices'
21
- import QualityScore from './QualityScore.vue'
22
- import DataserviceQualityTooltipContent from './DataserviceQualityTooltipContent.vue'
23
- import Toggletip from './Toggletip.vue'
24
- import { useTranslation } from '../composables/useTranslation'
25
-
26
- defineProps<{
27
- quality: DataserviceQuality
28
- }>()
29
-
30
- const { t } = useTranslation()
31
- </script>
@@ -1,79 +0,0 @@
1
- <template>
2
- <p class="text-sm text-gray-plain font-bold mb-0">
3
- {{ t("Qualité des métadonnées :") }}
4
- </p>
5
- <ul class="list-none pl-0 space-y-2">
6
- <QualityItem
7
- :passed="quality.has_description"
8
- :message-passed="t('Description renseignée')"
9
- :message-failed="t('Description non renseignée')"
10
- class="pb-0"
11
- />
12
- <QualityItem
13
- :passed="quality.has_machine_documentation"
14
- :message-passed="t('Documentation machine (OpenAPI) disponible')"
15
- :message-failed="t('Documentation machine (OpenAPI) manquante')"
16
- class="pb-0"
17
- />
18
- <QualityItem
19
- :passed="quality.has_technical_documentation"
20
- :message-passed="t('Documentation technique renseignée')"
21
- :message-failed="t('Documentation technique manquante')"
22
- class="pb-0"
23
- />
24
- <QualityItem
25
- :passed="quality.has_business_documentation"
26
- :message-passed="t('Documentation métier renseignée')"
27
- :message-failed="t('Documentation métier manquante')"
28
- class="pb-0"
29
- />
30
- <QualityItem
31
- :passed="quality.license"
32
- :message-passed="t('Licence renseignée')"
33
- :message-failed="t('Licence non renseignée')"
34
- class="pb-0"
35
- />
36
- <QualityItem
37
- :passed="quality.has_contact_point"
38
- :message-passed="t('Point de contact renseigné')"
39
- :message-failed="t('Point de contact non renseigné')"
40
- class="pb-0"
41
- />
42
- <QualityItem
43
- :passed="quality.has_base_api_url"
44
- :message-passed="t(`URL de base de l'API renseignée`)"
45
- :message-failed="t(`URL de base de l'API non renseignée`)"
46
- class="pb-0"
47
- />
48
- <QualityItem
49
- :passed="quality.availability_documented"
50
- :message-passed="t('Disponibilité documentée')"
51
- :message-failed="t('Disponibilité non documentée')"
52
- class="pb-0"
53
- />
54
- <QualityItem
55
- :passed="quality.rate_limiting_documented"
56
- :message-passed="t(`Limite d'appels documentée`)"
57
- :message-failed="t(`Limite d'appels non documentée`)"
58
- class="pb-0"
59
- />
60
- <QualityItem
61
- :passed="quality.access_conditions_clear"
62
- :message-passed="t(`Conditions d'accès claires`)"
63
- :message-failed="t(`Conditions d'accès non précisées`)"
64
- class="pb-0"
65
- />
66
- </ul>
67
- </template>
68
-
69
- <script setup lang="ts">
70
- import type { DataserviceQuality } from '../types/dataservices'
71
- import { useTranslation } from '../composables/useTranslation'
72
- import QualityItem from './QualityItem.vue'
73
-
74
- defineProps<{
75
- quality: DataserviceQuality
76
- }>()
77
-
78
- const { t } = useTranslation()
79
- </script>
@@ -1,48 +0,0 @@
1
- <template>
2
- <div class="text-xs">
3
- <PreviewUnavailable v-if="!isSizeAllowed">
4
- {{ fileSizeBytes
5
- ? t("Le fichier {fileType} est trop volumineux pour être prévisualisé. Téléchargez-le depuis l'onglet Téléchargements.", { fileType })
6
- : t("La taille du fichier est inconnue, l'aperçu n'est pas disponible. Téléchargez-le depuis l'onglet Téléchargements.")
7
- }}
8
- </PreviewUnavailable>
9
- <PreviewUnavailable v-else-if="hasError">
10
- {{ t("L'aperçu de ce fichier n'a pas pu être chargé. Téléchargez-le depuis l'onglet Téléchargements.") }}
11
- </PreviewUnavailable>
12
- <img
13
- v-else
14
- :src="resource.url"
15
- alt=""
16
- class="block w-full h-auto max-w-[800px]"
17
- @error="hasError = true"
18
- >
19
- </div>
20
- </template>
21
-
22
- <script setup lang="ts">
23
- import { computed, ref } from 'vue'
24
- import PreviewUnavailable from './PreviewUnavailable.vue'
25
- import type { Resource } from '../../types/resources'
26
- import { getResourceFilesize } from '../../functions/resources'
27
- import { useTranslation } from '../../composables/useTranslation'
28
- import { useComponentsConfig } from '../../config'
29
-
30
- const props = defineProps<{
31
- resource: Resource
32
- }>()
33
-
34
- const { t } = useTranslation()
35
- const config = useComponentsConfig()
36
-
37
- const hasError = ref(false)
38
-
39
- const fileType = computed(() => props.resource.format?.toUpperCase() ?? t('Fichier'))
40
- const fileSizeBytes = computed(() => getResourceFilesize(props.resource))
41
-
42
- const isSizeAllowed = computed(() => {
43
- const size = fileSizeBytes.value
44
- const max = config.maxImagePreviewByteSize
45
- if (!size || !max) return false
46
- return size <= max
47
- })
48
- </script>