Skip to content
Merged
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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ jobs:
- browser: chromium
projects: "--project=setup --project=setup-normal-user --project=chromium --project=chromium-normal-user --project=chromium-2fa-user"
- browser: firefox
projects: "--project=setup --project=firefox"
projects: "--project=setup --project=setup-normal-user --project=firefox"
container:
image: mcr.microsoft.com/playwright:v1.57.0-noble
options: --user 1001
Expand Down
5 changes: 3 additions & 2 deletions components/AdminMembershipRequest/AdminMembershipRequest.vue
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
{{ t('Rôle proposé :') }}
<AdminBadge
size="xs"
:type="request.role === 'admin' ? 'primary' : 'secondary'"
:type="getRoleBadgeType(request.role)"
>
{{ roleLabel }}
</AdminBadge>
Expand Down Expand Up @@ -193,7 +193,8 @@ import { RiCheckLine, RiMailLine, RiMailSendLine, RiUserAddLine } from '@remixic
import InputGroup from '../InputGroup/InputGroup.vue'
import ModalWithButton from '../Modal/ModalWithButton.vue'
import AdminBadge from '../AdminBadge/AdminBadge.vue'
import type { MemberRole, PendingMembershipRequest } from '~/types/types'
import type { MemberRole } from '@datagouv/components-next'
import type { PendingMembershipRequest } from '~/types/types'

const props = defineProps<{
oid: string
Expand Down
7 changes: 4 additions & 3 deletions components/AdminOrgInvitation/AdminOrgInvitation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
{{ t('Rôle proposé :') }}
<AdminBadge
size="xs"
:type="invitation.role === 'admin' ? 'primary' : 'secondary'"
:type="getRoleBadgeType(invitation.role)"
>
{{ roleLabel }}
</AdminBadge>
Expand All @@ -61,7 +61,7 @@
{{ formatDate(new Date(invitation.created), { dateStyle: 'long', timeStyle: 'short' }) }}
</div>
</div>
<div class="flex flex-col gap-2.5 items-end">
<div class="flex gap-2.5 items-start">
<BrandedButton
color="primary"
size="xs"
Expand Down Expand Up @@ -89,7 +89,8 @@ import { BrandedButton, useFormatDate } from '@datagouv/components-next'
import { ref } from 'vue'
import { RiBuilding2Line, RiCheckLine, RiUserAddLine } from '@remixicon/vue'
import AdminBadge from '../AdminBadge/AdminBadge.vue'
import type { MemberRole, OrgInvitation } from '~/types/types'
import type { MemberRole } from '@datagouv/components-next'
import type { OrgInvitation } from '~/types/types'

const props = defineProps<{
invitation: OrgInvitation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@
keep-margins-even-without-borders
/>
<BrandedButton
v-if="dataservice.permissions.edit"
size="xs"
color="tertiary"
:href="getDataserviceAdminUrl(dataservice)"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@
keep-margins-even-without-borders
/>
<BrandedButton
v-if="dataset.permissions.edit"
size="xs"
color="tertiary"
:href="getDatasetAdminUrl(dataset)"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@
keep-margins-even-without-borders
/>
<BrandedButton
v-if="reuse.permissions.edit"
size="xs"
color="tertiary"
:href="getReuseAdminUrl(reuse)"
Expand Down
17 changes: 15 additions & 2 deletions components/Dataservices/AdminUpdateDataserviceDatasetsPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,20 @@
</SimpleBanner>
</div>
<div v-else>
<DatasetsSelect v-model="datasets" />
<div class="fr-grid-row fr-grid-row--right">
<DatasetsSelect
v-model="datasets"
:read-only="!canEdit"
>
<template #empty>
<p class="text-sm text-gray-medium">
{{ t('Aucun jeu de données associé.') }}
</p>
</template>
</DatasetsSelect>
<div
v-if="canEdit"
class="fr-grid-row fr-grid-row--right"
>
<BrandedButton
color="primary"
@click="submit"
Expand All @@ -52,6 +64,7 @@ const { $api } = useNuxtApp()
const route = useRoute()
const url = computed(() => `/api/1/dataservices/${route.params.id}`)
const { data: dataservice } = await useAPI<Dataservice>(url, { redirectOn404: true })
const canEdit = computed(() => dataservice.value?.permissions.edit ?? false)

const tooManyDatasets = computed(() => (dataservice.value?.datasets.total ?? 0) > config.public.maxNumberOfDatasetsForDataserviceUpdate)
const datasets = ref<Array<DatasetV2 | DatasetSuggest>>([])
Expand Down
138 changes: 76 additions & 62 deletions components/Dataservices/AdminUpdateDataservicePage.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<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

Variable 'dataservice' is already declared in the upper scope
:status
:data="dataservice"
>
Expand All @@ -12,7 +12,10 @@
@feature="feature"
@submit="save"
>
<template #top>
<template
v-if="dataservice.permissions.edit"
#top
>
<BannerAction
v-if="!dataservice.deleted_at && !dataservice.archived_at"
class="mb-4"
Expand Down Expand Up @@ -65,69 +68,80 @@
</BannerAction>
</template>
<template #button="attrs">
<BrandedButton
type="submit"
v-bind="attrs"
:loading="isLoading"
>
{{ t("Sauvegarder") }}
</BrandedButton>
<div class="flex items-center gap-3">
<p
v-if="!dataservice.permissions.edit"
class="text-sm text-gray-medium m-0"
>
{{ t('Vous n\'avez pas la permission de modifier cette API.') }}
</p>
<BrandedButton
type="submit"
v-bind="attrs"
:loading="isLoading"
:disabled="!dataservice.permissions.edit"
>
{{ t("Sauvegarder") }}
</BrandedButton>
</div>
</template>
<div class="mt-5 space-y-5">
<TransferBanner
type="Dataservice"
:subject="dataservice"
:label="$t(`Transférer l'API`)"
/>
<BannerAction
type="warning"
:title="dataservice.archived_at ? $t('Désarchiver cette API') : $t('Archiver cette API')"
>
{{ $t("Une API archivée n'est plus indexée mais reste accessible aux utilisateurs avec un lien direct.") }}
<template v-if="dataservice.permissions.edit">
<div class="mt-5 space-y-5">
<TransferBanner
type="Dataservice"
:subject="dataservice"
:label="$t(`Transférer l'API`)"
/>
<BannerAction
type="warning"
:title="dataservice.archived_at ? $t('Désarchiver cette API') : $t('Archiver cette API')"
>
{{ $t("Une API archivée n'est plus indexée mais reste accessible aux utilisateurs avec un lien direct.") }}

<template #button>
<BrandedButton
:icon="RiArchiveLine"
@click="archiveDataservice"
>
{{ dataservice.archived_at ? $t('Désarchiver') : $t('Archiver') }}
</BrandedButton>
</template>
</BannerAction>
<BannerAction
v-if="!dataservice.deleted_at"
type="danger"
:title="$t(`Supprimer l'API`)"
>
{{ $t("Attention, cette action ne peut pas être annulée.") }}
<template #button>
<AdminDeleteModal
:title="$t('Êtes-vous sûr de vouloir supprimer cette API ?')"
:delete-url="`/api/1/dataservices/${route.params.id}`"
:delete-button-label="$t(`Supprimer l'API`)"
:deletable-object="dataservice"
object-type="dataservice"
:object-title="dataservice.title"
@deleted="onDataserviceDeleted"
>
<template #button="{ attrs, listeners }">
<BrandedButton
color="danger"
size="xs"
:icon="RiDeleteBin6Line"
v-bind="attrs"
v-on="listeners"
>
{{ $t('Supprimer') }}
</BrandedButton>
</template>
<p class="fr-text--bold">
{{ $t("Cette action est irréversible.") }}
</p>
</AdminDeleteModal>
</template>
</BannerAction>
</div>
<template #button>
<BrandedButton
:icon="RiArchiveLine"
@click="archiveDataservice"
>
{{ dataservice.archived_at ? $t('Désarchiver') : $t('Archiver') }}
</BrandedButton>
</template>
</BannerAction>
<BannerAction
v-if="!dataservice.deleted_at"
type="danger"
:title="$t(`Supprimer l'API`)"
>
{{ $t("Attention, cette action ne peut pas être annulée.") }}
<template #button>
<AdminDeleteModal
:title="$t('Êtes-vous sûr de vouloir supprimer cette API ?')"
:delete-url="`/api/1/dataservices/${route.params.id}`"
:delete-button-label="$t(`Supprimer l'API`)"
:deletable-object="dataservice"
object-type="dataservice"
:object-title="dataservice.title"
@deleted="onDataserviceDeleted"
>
<template #button="{ attrs, listeners }">
<BrandedButton
color="danger"
size="xs"
:icon="RiDeleteBin6Line"
v-bind="attrs"
v-on="listeners"
>
{{ $t('Supprimer') }}
</BrandedButton>
</template>
<p class="fr-text--bold">
{{ $t("Cette action est irréversible.") }}
</p>
</AdminDeleteModal>
</template>
</BannerAction>
</div>
</template>
</DescribeDataservice>
</LoadingBlock>
</template>
Expand Down
9 changes: 9 additions & 0 deletions components/DataservicesSelect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
:a-label="$t('une API')"
:this-label="$t('cette API')"
:allow-reorder
:read-only
:suggest="(query) => $api<PaginatedArray<Dataservice>>('/api/1/dataservices/', { query }).then(({ data }) => data)"
:fetch="(id) => $api<Dataservice>(`/api/1/dataservices/${id}/`)"
:object-image-url="(dataservice) => ''"
Expand All @@ -19,6 +20,12 @@
class="w-full"
/>
</template>
<template
v-if="$slots.empty"
#empty
>
<slot name="empty" />
</template>
</ObjectsSelect>
</template>

Expand All @@ -30,9 +37,11 @@ withDefaults(defineProps<{
single?: boolean
label?: string
allowReorder?: boolean
readOnly?: boolean
}>(), {
single: false,
allowReorder: true,
readOnly: false,
})

const selectedDataservices = defineModel<Array<Dataservice>>({ required: true })
Expand Down
Loading
Loading