diff --git a/apps/client/src/views/admin/AdminProject.vue b/apps/client/src/views/admin/AdminProject.vue index 566ec9a4d..683670a59 100644 --- a/apps/client/src/views/admin/AdminProject.vue +++ b/apps/client/src/views/admin/AdminProject.vue @@ -2,8 +2,7 @@ import { onBeforeMount, ref } from 'vue' // @ts-ignore '@gouvminint/vue-dsfr' missing types import { getRandomId } from '@gouvminint/vue-dsfr' -import type { Environment, Log, PluginsUpdateBody, ProjectService, ProjectV2 } from '@cpn-console/shared' -import { sortArrByObjKeyAsc } from '@cpn-console/shared' +import type { Environment, Log, PluginsUpdateBody, ProjectService, ProjectV2, Repo } from '@cpn-console/shared' import fr from 'javascript-time-ago/locale/fr' import TimeAgo from 'javascript-time-ago' import { useSnackbarStore } from '@/stores/snackbar.js' @@ -39,38 +38,13 @@ const logsId = 'logsView' const project = computed(() => projectStore.projectsById[props.projectId]) const environments = ref() +const repositories = ref() // Add locale-specific relative date/time formatting rules. TimeAgo.addLocale(fr) // Create relative date/time formatter. const timeAgo = new TimeAgo('fr-FR') -const repoRows = computed(() => { - if (!project.value.repositories?.length) { - return [[{ - text: 'Aucun dépôt existant', - cellAttrs: { - colspan: headerRepos.length, - }, - }]] - } - return sortArrByObjKeyAsc(project.value.repositories, 'internalRepoName') - .map(({ internalRepoName, isInfra, externalRepoUrl, isPrivate, createdAt }) => ( - [ - internalRepoName, - isInfra ? 'Infra' : 'Applicatif', - isPrivate ? 'oui' : 'non', - externalRepoUrl || '-', - { - text: timeAgo.format(new Date(createdAt)), - title: (new Date(createdAt)).toLocaleString(), - component: 'span', - }, - ] - ), - ) -}) - function unSelectProject() { router.push({ name: 'ListProjects' }) } @@ -109,12 +83,13 @@ async function transferOwnerShip(nextOwnerId: string) { async function getProjectDetails() { try { - const [envs] = await Promise.all([ + const [projectDetails] = await Promise.all([ project.value.refresh(), reloadProjectServices(), showLogs(0), ]) - environments.value = envs.environments + environments.value = projectDetails.environments + repositories.value = projectDetails.repositories } catch (error) { console.trace(error) } @@ -314,49 +289,49 @@ async function getProjectLogs({ offset, limit }: { offset: number, limit: number :key="environmentsCtKey" title="Environnements" > - - - {{ header }} - - - - - {{ env.name }} - {{ stageStore.stages.find(stage => stage.id === env.stageId)?.name ?? 'Type inconnu...' }} - - - +