From 2ed82524c91cd0bdcc602e1cecd4e4cc3923b5e5 Mon Sep 17 00:00:00 2001 From: Emmanuel DEMEY Date: Mon, 2 Sep 2024 15:19:55 +0200 Subject: [PATCH] feat: migrate two files to typescript (#908) --- src/packages/model/Dataset.ts | 33 ++++++++++--------- src/packages/model/theme.ts | 5 +++ .../modules-datasets/datasets/useThemes.tsx | 4 +-- .../modules-datasets/datasets/view/menu.tsx | 6 +++- 4 files changed, 29 insertions(+), 19 deletions(-) create mode 100644 src/packages/model/theme.ts diff --git a/src/packages/model/Dataset.ts b/src/packages/model/Dataset.ts index 5d1f424f6..f369cc132 100644 --- a/src/packages/model/Dataset.ts +++ b/src/packages/model/Dataset.ts @@ -1,39 +1,40 @@ import { ValidationState } from '../components'; -export type CatalogRecord = { - created: string; - updated: string; - contributor: string; -}; - export type Dataset = { accessRights: string; accrualPeriodicity: string; confidentialityStatus: string; id?: string; - issued?: string; catalogRecord: CatalogRecord; - creators: string[]; - publisher: string; - wasGeneratedIRIs: string[]; - themes: string[]; + validationState: ValidationState; + observationNumber: number; + timeSeriesNumber: number; linkedDocuments: string[]; keywords: { lg1: string[]; lg2: string[]; }; - statisticalUnit: string[]; - dataStructure: string; temporalCoverageDataType: string; temporalCoverageStartDate: string; temporalCoverageEndDate: string; - type: string; temporalResolution: string; spacialCoverage: string; spacialTemporal: string; spacialResolutions: string[]; - observationNumber: number; - timeSeriesNumber: number; + creators: string[]; + publisher: string; + wasGeneratedIRIs: string[]; + themes: string[]; + statisticalUnit: string[]; + dataStructure: string; + issued?: string; + type: string; +}; +export type CatalogRecord = { + created: string; + updated: string; + contributor: string; + catalogRecord: CatalogRecord; validationState: ValidationState; }; export type Distribution = { diff --git a/src/packages/model/theme.ts b/src/packages/model/theme.ts new file mode 100644 index 000000000..81a51bb56 --- /dev/null +++ b/src/packages/model/theme.ts @@ -0,0 +1,5 @@ +export type Theme = { + label: string; + idConceptScheme: string; + uri: string; +}; diff --git a/src/packages/modules-datasets/datasets/useThemes.tsx b/src/packages/modules-datasets/datasets/useThemes.tsx index 3eb299dee..0f1e17457 100644 --- a/src/packages/modules-datasets/datasets/useThemes.tsx +++ b/src/packages/modules-datasets/datasets/useThemes.tsx @@ -1,7 +1,7 @@ import { useQuery } from '@tanstack/react-query'; -import { ThemesApi } from '../..//sdk'; -import { Theme } from '../../model/Theme'; +import { ThemesApi } from '../../sdk'; import { Options } from '../../model/SelectOption'; +import { Theme } from '../../model/Theme'; export const useThemes = () => useQuery({ diff --git a/src/packages/modules-datasets/datasets/view/menu.tsx b/src/packages/modules-datasets/datasets/view/menu.tsx index 8ffa5c177..92ad6da04 100644 --- a/src/packages/modules-datasets/datasets/view/menu.tsx +++ b/src/packages/modules-datasets/datasets/view/menu.tsx @@ -36,7 +36,11 @@ export const ViewMenu = ({ goBack('/datasets')} /> {(isAdmin || hasDatasetRightsBasedOnStamp) && ( - + )} {(isAdmin || (hasDatasetRightsBasedOnStamp &&