Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,41 +6,43 @@

<AdminTable>
<thead>
<AdminTableTh
:sorted="sorted('title')"
scope="col"
@sort="(direction: SortDirection) => $emit('sort', 'title', direction)"
>
{{ t("Titre de la ressource") }}
</AdminTableTh>
<AdminTableTh class="w-44">
{{ t("Statut") }}
</AdminTableTh>
<AdminTableTh class="w-14">
{{ t("Format") }}
</AdminTableTh>
<AdminTableTh
class="w-32"
:sorted="sorted('created_at_internal')"
scope="col"
@sort="(direction: SortDirection) => $emit('sort', 'created_at_internal', direction)"
>
{{ t("Créé le") }}
</AdminTableTh>
<AdminTableTh
class="w-32"
:sorted="sorted('last_modified_internal')"
scope="col"
@sort="(direction: SortDirection) => $emit('sort', 'last_modified_internal', direction)"
>
{{ t("Modifié le") }}
</AdminTableTh>
<AdminTableTh
class="w-32"
scope="col"
>
{{ t("Action") }}
</AdminTableTh>
<tr>
<AdminTableTh
:sorted="sorted('title')"
scope="col"
@sort="(direction: SortDirection) => $emit('sort', 'title', direction)"
>
{{ t("Titre de la ressource") }}
</AdminTableTh>
<AdminTableTh class="w-44">
{{ t("Statut") }}
</AdminTableTh>
<AdminTableTh class="w-14">
{{ t("Format") }}
</AdminTableTh>
<AdminTableTh
class="w-32"
:sorted="sorted('created_at_internal')"
scope="col"
@sort="(direction: SortDirection) => $emit('sort', 'created_at_internal', direction)"
>
{{ t("Créé le") }}
</AdminTableTh>
<AdminTableTh
class="w-32"
:sorted="sorted('last_modified_internal')"
scope="col"
@sort="(direction: SortDirection) => $emit('sort', 'last_modified_internal', direction)"
>
{{ t("Modifié le") }}
</AdminTableTh>
<AdminTableTh
class="w-32"
scope="col"
>
{{ t("Action") }}
</AdminTableTh>
</tr>
Comment on lines -9 to +45

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not linked to this PR but same hydratation mismatch than in AdminContactPointsTable

</thead>
<tbody>
<tr
Expand Down
Original file line number Diff line number Diff line change
@@ -1,26 +1,28 @@
<template>
<AdminTable>
<thead>
<AdminTableTh scope="col">
{{ t("Nom du point de contact") }}
</AdminTableTh>
<AdminTableTh class="w-44">
{{ t("Rôle") }}
</AdminTableTh>
<AdminTableTh>
{{ t("E-mail du contact") }}
</AdminTableTh>
<AdminTableTh
scope="col"
>
{{ t("Url du point de contact") }}
</AdminTableTh>
<AdminTableTh
class="w-32"
scope="col"
>
{{ t("Action") }}
</AdminTableTh>
<tr>

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolve an hydratation mismatch

<AdminTableTh scope="col">
{{ t("Nom du point de contact") }}
</AdminTableTh>
<AdminTableTh class="w-44">
{{ t("Rôle") }}
</AdminTableTh>
<AdminTableTh>
{{ t("E-mail du contact") }}
</AdminTableTh>
<AdminTableTh
scope="col"
>
{{ t("Url du point de contact") }}
</AdminTableTh>
<AdminTableTh
class="w-32"
scope="col"
>
{{ t("Action") }}
</AdminTableTh>
</tr>
</thead>
<tbody>
<tr
Expand Down
21 changes: 7 additions & 14 deletions components/ContactPointSelect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
v-model="contact"
:options="contactsWithNewOption"
:suggest="suggestContactPoint"
:label="showAttributions ? t(`Choisissez l'attribution avec laquelle vous voulez publier`) : t('Choisissez un point de contact')"
:placeholder="showAttributions ? t('Choisissez une attribution') : t('Sélectionner un contact')"
:display-value="(option: ContactPointInForm) => 'id' in option ? (option.name || option.email || $t('Inconnu')) : (showAttributions ? t('Nouvelle attribution') : t('Nouveau point de contact'))"
:label="t(`Choisissez l'attribution avec laquelle vous voulez publier`)"
:placeholder="t('Choisissez une attribution')"
:display-value="(option: ContactPointInForm) => 'id' in option ? (option.name || option.email || $t('Inconnu')) : t('Nouvelle attribution')"
:get-option-id="(option: ContactPointInForm) => 'id' in option ? option.id : 'new'"
:multiple="false"
:loading
Expand All @@ -27,19 +27,16 @@
{{ $t('Inconnu') }}
</template>
<AdminBadge
v-if="showAttributions && getRole(option.role)"
v-if="getRole(option.role)"
size="xs"
type="primary"
class="ml-1"
>
{{ getRole(option.role)?.label }}
</AdminBadge>
</span>
<span v-else-if="showAttributions">
{{ t('Nouvelle attribution') }}
</span>
<span v-else>
{{ t('Nouveau point de contact') }}
{{ t('Nouvelle attribution') }}
</span>
</template>
</SearchableSelect>
Expand All @@ -49,7 +46,6 @@
class="p-3 bg-gray-some grid grid-cols-2 gap-3 mt-2"
>
<SelectGroup
v-if="showAttributions"
v-model="newContactForm.role"
:options
class="mb-0"
Expand All @@ -63,7 +59,6 @@
<InputGroup
v-model="newContactForm.name"
class="mb-0"
:class="{ 'col-span-2': !showAttributions }"
required
:label="t('Nom')"
:placeholder="$t('ex: le nom du service')"
Expand Down Expand Up @@ -113,7 +108,7 @@
class="mt-2 fr-fieldset__element"
>
<p
v-if="showAttributions && contact && getRole(contact.role)"
v-if="contact && getRole(contact.role)"
class="flex items-center gap-1 mb-2"
>
{{ t("Rôle:") }}
Expand Down Expand Up @@ -152,7 +147,6 @@ const contact = defineModel<ContactPointInForm | null>()

const props = defineProps<{
organization: Organization | OrganizationReference
showAttributions?: boolean
errorText?: string | null
warningText?: string | null
}>()
Expand Down Expand Up @@ -203,8 +197,7 @@ function getRole(role: string) {
}

const contactsWithNewOption = computed<Array<ContactPointInForm>>(() => {
const attributions = [...contacts.value?.data ?? [], newContactForm.value]
return props.showAttributions ? attributions : attributions.filter(c => c.role === 'contact')
return [...contacts.value?.data ?? [], newContactForm.value]
})

async function suggestContactPoint(query: string): Promise<Array<ContactPoint>> {
Expand Down
3 changes: 0 additions & 3 deletions components/Dataservices/AdminUpdateDataservicePage.vue
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
<template>
<LoadingBlock
v-slot="{ data: dataservice }"

Check warning on line 3 in components/Dataservices/AdminUpdateDataservicePage.vue

View workflow job for this annotation

GitHub Actions / quality_and_test

Variable 'dataservice' is already declared in the upper scope
:status
:data="dataservice"
>
<DescribeDataservice
v-if="dataserviceForm"
v-model="dataserviceForm"
:harvested="harvested"
type="update"
@feature="feature"
@submit="save"
Expand Down Expand Up @@ -163,11 +162,9 @@
const url = computed(() => `/api/1/dataservices/${route.params.id}`)
const { data: dataservice, status, refresh } = await useAPI<Dataservice>(url, { redirectOn404: true })
const dataserviceForm = ref<DataserviceForm | null>(null)
const harvested = ref(false)
watchEffect(() => {
if (!dataservice.value) return
dataserviceForm.value = dataserviceToForm(dataservice.value)
harvested.value = isHarvested(dataservice.value)
})

async function save() {
Expand Down
7 changes: 2 additions & 5 deletions components/Dataservices/DescribeDataservice.vue
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@
class="fr-fieldset__legend"
>
<h2 class="text-sm font-bold uppercase mb-0">
{{ harvested ? t("Attributions et points de contacts") : t("Points de contact") }}
{{ t("Points de contact et attributions") }}
</h2>
</legend>
<LinkedToAccordion
Expand All @@ -363,14 +363,12 @@
v-model="form.contact_points[index]"
class="pt-3"
:organization="form.owned?.organization"
:show-attributions="harvested"
/>
<ContactPointSelect
v-if="form.contact_points.length === 0"
v-model="form.contact_points[0]"
class="pt-3"
:organization="form.owned?.organization"
:show-attributions="harvested"
/>
<BrandedButton
class="mt-3"
Expand All @@ -380,7 +378,7 @@
:icon="RiAddLine"
@click="form.contact_points.push({ ...defaultContactForm })"
>
{{ harvested ? t('Nouvelle attribution') : t('Nouveau contact') }}
{{ t('Nouvelle attribution') }}
</BrandedButton>
</LinkedToAccordion>
</fieldset>
Expand Down Expand Up @@ -561,7 +559,6 @@ import ProducerSelect from '~/components/ProducerSelect.vue'
import type { DataserviceForm } from '~/types/types'

const props = defineProps<{
harvested?: boolean
type: 'create' | 'update'
}>()
const dataserviceForm = defineModel<DataserviceForm>({ required: true })
Expand Down
3 changes: 0 additions & 3 deletions components/Datasets/AdminUpdateDatasetPage.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<LoadingBlock
v-slot="{ data: dataset }"

Check warning on line 3 in components/Datasets/AdminUpdateDatasetPage.vue

View workflow job for this annotation

GitHub Actions / quality_and_test

Variable 'dataset' is already declared in the upper scope
:status
:data="dataset"
>
Expand All @@ -8,7 +8,6 @@
v-if="datasetForm"
v-model="datasetForm"
type="update"
:harvested
:badges="dataset.badges"
:submit-label="t('Sauvegarder')"
:can-edit="dataset.permissions.edit"
Expand Down Expand Up @@ -158,12 +157,10 @@
})

const datasetForm = ref<DatasetForm | null>(null)
const harvested = ref(false)
const pendingBadges = ref<Array<Badge> | null>(null)
watchEffect(() => {
if (dataset.value) {
datasetForm.value = datasetToForm(dataset.value)
harvested.value = isHarvested(dataset.value)
}
})

Expand Down
7 changes: 2 additions & 5 deletions components/Datasets/DescribeDataset.vue
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@
class="fr-fieldset__legend"
>
<h2 class="text-sm font-bold uppercase mb-0">
{{ harvested ? t("Attributions et points de contact") : t("Points de contact") }}
{{ t("Points de contact et attributions") }}
</h2>
</legend>
<LinkedToAccordion
Expand All @@ -544,14 +544,12 @@
v-model="form.contact_points[index]"
class="pt-3"
:organization="form.owned?.organization"
:show-attributions="harvested"
/>
<ContactPointSelect
v-if="form.contact_points.length === 0"
v-model="form.contact_points[0]"
class="pt-3"
:organization="form.owned?.organization"
:show-attributions="harvested"
/>
<BrandedButton
class="mt-4"
Expand All @@ -561,7 +559,7 @@
:icon="RiAddLine"
@click="form.contact_points.push({ ...defaultContactForm })"
>
{{ harvested ? t('Nouvelle attribution') : t('Nouveau contact') }}
{{ t('Nouvelle attribution') }}
</BrandedButton>
</LinkedToAccordion>
</fieldset>
Expand Down Expand Up @@ -789,7 +787,6 @@ const datasetForm = defineModel<DatasetForm>({ required: true })
const props = withDefaults(defineProps<{
submitLabel: string
type: 'create' | 'update'
harvested?: boolean
badges?: Array<Badge>
canEdit?: boolean
readOnlyMessage?: string
Expand Down
Loading
Loading