Skip to content
Snippets Groups Projects
Commit 293b6afa authored by simon.mellerin's avatar simon.mellerin
Browse files

#23 - Datasets - multistep - step 2 - 3d work

parent 6940c706
No related branches found
No related tags found
1 merge request!41#23 - Datasets - multistep - step 2 - first work
Pipeline #10405 passed
...@@ -188,11 +188,7 @@ ...@@ -188,11 +188,7 @@
</OcField> </OcField>
<Message v-if="errorMessage" severity="error">{{ errorMessage }}</Message> <Message v-if="errorMessage" severity="error">{{ errorMessage }}</Message>
</Field> </Field>
<Field <Field name="accrualPeriodicity" v-slot="{ value, errorMessage, handleChange }">
name="accrualPeriodicity "
v-slot="{ value, errorMessage, handleChange }"
v-if="showFair"
>
<OcField for="accrualPeriodicity" :metadata="formMetadata.accrualPeriodicity"> <OcField for="accrualPeriodicity" :metadata="formMetadata.accrualPeriodicity">
<Select <Select
inputId="accrualPeriodicity " inputId="accrualPeriodicity "
...@@ -373,12 +369,17 @@ const validationSchema = toTypedSchema( ...@@ -373,12 +369,17 @@ const validationSchema = toTypedSchema(
creator: yup creator: yup
.array() .array()
.of(yup.object<OcPerson | OcOrganization>()) .of(yup.object<OcPerson | OcOrganization>())
.ensure()
.min(1) .min(1)
.label(translateValue(formMetadata.creator.label)), .label(translateValue(formMetadata.creator.label)),
publisher: yup publisher: yup
.object<OcOrganization>() .object<OcOrganization>()
.required() .required()
.label(translateValue(formMetadata.publisher.label)), .label(translateValue(formMetadata.publisher.label)),
accrualPeriodicity: yup
.object<OcVocabulary>()
.required()
.label(translateValue(formMetadata.accrualPeriodicity.label)),
contactPoint: yup contactPoint: yup
.mixed<OcPerson | OcOrganization>() .mixed<OcPerson | OcOrganization>()
.required() .required()
...@@ -387,18 +388,16 @@ const validationSchema = toTypedSchema( ...@@ -387,18 +388,16 @@ const validationSchema = toTypedSchema(
theme: yup theme: yup
.array() .array()
.of(yup.object<OcVocabulary>()) .of(yup.object<OcVocabulary>())
.ensure()
.min(1) .min(1)
.label(translateValue(formMetadata.theme.label)), .label(translateValue(formMetadata.theme.label)),
accrualPeriodicity: yup
.object<OcVocabulary>()
.required()
.label(translateValue(formMetadata.accrualPeriodicity.label)),
status: yup.mixed<OcVocabulary>().label(translateValue(formMetadata.status.label)), status: yup.mixed<OcVocabulary>().label(translateValue(formMetadata.status.label)),
issued: yup.date().required().label(translateValue(formMetadata.issued.label)), issued: yup.date().required().label(translateValue(formMetadata.issued.label)),
modified: yup.date().label(translateValue(formMetadata.modified.label)), modified: yup.date().label(translateValue(formMetadata.modified.label)),
language: yup language: yup
.array() .array()
.of(yup.object<OcVocabulary>()) .of(yup.object<OcVocabulary>())
.ensure()
.min(1) .min(1)
.label(translateValue(formMetadata.language.label)), .label(translateValue(formMetadata.language.label)),
keyword: yup.array().of(yup.string()).label(translateValue(formMetadata.keyword.label)), keyword: yup.array().of(yup.string()).label(translateValue(formMetadata.keyword.label)),
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<Form <Form
class="flex flex-col gap-2" class="flex flex-col gap-2"
:validation-schema="validationSchema" :validation-schema="validationSchema"
:initial-values="{ catalog: model }" :initial-values="model"
@submit="submit" @submit="submit"
> >
<Field name="catalog" v-slot="{ value, errorMessage, handleChange }"> <Field name="catalog" v-slot="{ value, errorMessage, handleChange }">
...@@ -48,14 +48,14 @@ import * as yup from 'yup' ...@@ -48,14 +48,14 @@ import * as yup from 'yup'
import Button from 'primevue/button' import Button from 'primevue/button'
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
import type { PropType } from 'vue' import type { PropType } from 'vue'
import type { OcCatalog } from '@/declarations' import type { OcCatalog, OcDataset } from '@/declarations'
import OcCatalogAutocomplete from '@/components/FormInputs/OcCatalogAutocomplete/OcCatalogAutocomplete.vue' import OcCatalogAutocomplete from '@/components/FormInputs/OcCatalogAutocomplete/OcCatalogAutocomplete.vue'
import Divider from 'primevue/divider' import Divider from 'primevue/divider'
import Message from 'primevue/message' import Message from 'primevue/message'
import { datasetsMetadata } from '@/modelMetadata/datasets' import { datasetsMetadata } from '@/modelMetadata/datasets'
import OcField from '@/components/FormInputs/OcField/OcField.vue' import OcField from '@/components/FormInputs/OcField/OcField.vue'
const model = defineModel<OcCatalog>({ required: true }) const model = defineModel<Partial<OcDataset>>({ required: true })
const emit = defineEmits(['back', 'next']) const emit = defineEmits(['back', 'next'])
...@@ -75,7 +75,7 @@ const validationSchema = toTypedSchema( ...@@ -75,7 +75,7 @@ const validationSchema = toTypedSchema(
) )
const submit = (values: GenericObject, ctx: SubmissionContext) => { const submit = (values: GenericObject, ctx: SubmissionContext) => {
model.value = values.catalog model.value.catalog = values.catalog
const event = ctx.evt as SubmitEvent const event = ctx.evt as SubmitEvent
const action = ((event?.submitter as HTMLInputElement)?.value ?? 'next') as 'back' | 'next' const action = ((event?.submitter as HTMLInputElement)?.value ?? 'next') as 'back' | 'next'
......
...@@ -100,76 +100,12 @@ const { t, locale } = useI18n() ...@@ -100,76 +100,12 @@ const { t, locale } = useI18n()
const { data: community } = useCommunityData() const { data: community } = useCommunityData()
// Default value is "My Data" catalog
const catalog = ref<OcCatalog>({
'@id': 'https://www.irit.fr/opencommon/resourceTree/MyData',
title: 'My data'
})
const dataset = ref<Partial<OcDataset>>({ const dataset = ref<Partial<OcDataset>>({
title: 'eezrz', // Default catalog is "My Data"
description: 'sdq"zed', catalog: {
creator: [ '@id': 'https://www.irit.fr/opencommon/resourceTree/MyData',
{ title: 'My data'
'@id': }
'https://www.irit.fr/opencommon/agents/organization/9e33853c-a19c-424e-9f39-1f8eee395a32',
'@type': ['http://xmlns.com/foaf/0.1/Agent', 'http://xmlns.com/foaf/0.1/Organization'],
name: { '@none': 'Université de Toulouse' }
}
],
publisher: {
'@id':
'https://www.irit.fr/opencommon/agents/organization/9e33853c-a19c-424e-9f39-1f8eee395a32',
'@type': ['http://xmlns.com/foaf/0.1/Agent', 'http://xmlns.com/foaf/0.1/Organization'],
name: { '@none': 'Université de Toulouse' }
},
contactPoint: {
'@id':
'https://www.irit.fr/opencommon/agents/organization/9e33853c-a19c-424e-9f39-1f8eee395a32',
'@type': ['http://xmlns.com/foaf/0.1/Agent', 'http://xmlns.com/foaf/0.1/Organization'],
name: { '@none': 'Université de Toulouse' }
},
type: {
'@id': 'http://publications.europa.eu/resource/authority/dataset-type/SYNTAX_ECD_SCHEME',
prefLabel: { en: 'Syntax encoding scheme', fr: 'Schème d’encodage de syntaxe' }
},
theme: [
{
'@id': 'http://publications.europa.eu/resource/authority/data-theme/EDUC',
prefLabel: { en: 'Education, culture and sport', fr: 'Éducation, culture et sport' }
}
],
accrualPeriodicity: {
'@id': 'http://publications.europa.eu/resource/authority/frequency/ANNUAL_3',
prefLabel: { fr: 'trois fois par an', en: 'three times a year' }
},
issued: new Date('2024-09-17T00:00:00.000'),
language: [
{
'@id': 'http://publications.europa.eu/resource/authority/language/FSL',
prefLabel: { fr: 'langue des signes française' }
},
{
'@id': 'http://publications.europa.eu/resource/authority/language/FRA',
prefLabel: { fr: 'français' }
}
],
keyword: ['test', 'Boutique Ferlo Sénégal'],
status: {
'@id': 'http://publications.europa.eu/resource/authority/dataset-status/DEPRECATED',
prefLabel: {
fr: 'déconseillé',
en: 'deprecated'
}
},
modified: new Date('2024-10-15T00:00:00.000'),
temporal: [new Date('2024-10-22T00:00:00.000'), new Date('2024-10-25T00:00:00.000')],
spatial: {
'@id': 'http://publications.europa.eu/resource/authority/country/FXX',
prefLabel: { fr: 'France métropolitaine' }
},
landingPage: 'https://duckduckgo.fr',
version: '0.0.1'
}) })
const frequencyList = ref<OcVocabulary[]>([]) const frequencyList = ref<OcVocabulary[]>([])
...@@ -217,7 +153,7 @@ const send = () => { ...@@ -217,7 +153,7 @@ const send = () => {
dataset.value, dataset.value,
accountStore.infos.hasPrivateGraph, accountStore.infos.hasPrivateGraph,
community.value, community.value,
catalog.value, dataset.value.catalog as OcCatalog,
accountStore.profile, accountStore.profile,
accountStore.auth accountStore.auth
) )
...@@ -278,7 +214,7 @@ const steps = computed(() => { ...@@ -278,7 +214,7 @@ const steps = computed(() => {
return graph return graph
} }
}, },
model: catalog.value, model: dataset.value,
back: '1', back: '1',
next: '3' next: '3'
}, },
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment