Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | 66x 66x 4x 34x 34x 34x 34x 4x 34x 4x 4x 4x 4x 4x 36x 36x 36x 34x 4x 34x | import { Outlet, useParams } from 'react-router-dom'
import { Page, EntityDetail, Crud } from '@/layers/L2R'
import type { PageConfig, DetailConfig, CrudConfig } from '@/layers/interfaces'
import { useEntityDetail } from '@/layers/L1/entityResolver'
import { formatDateTime } from '@/shared/utils/format'
import { CONTAINER_REGISTRY_FIELD_SET, CONTAINER_REGISTRY_FIELD_TYPES } from './containerRegistriesCrudConfig'
export function ContainerRegistryDetailPage() {
const { id } = useParams<{ id: string }>()
const { data: registry } = useEntityDetail('container-registries', id ?? '')
const pageConfig: PageConfig = {
title: registry?.name ?? 'Container Registry',
breadcrumbs: [
{ label: 'Dashboard', href: '/' },
{ label: 'Container Registries', href: '/container-registries' },
{ label: registry?.name ?? id ?? '' },
],
}
const detailConfig: DetailConfig = {
entityPath: 'container-registries',
title: 'Container Registry',
actionTargets: { edit: '/container-registries/:id/edit', delete: true },
readGrouping: [
{
label: 'Details',
fields: ['name', 'url', 'username', 'created_at', 'updated_at'],
},
],
fieldFormatters: {
created_at: (value: unknown) => formatDateTime(value as string | null | undefined),
updated_at: (value: unknown) => formatDateTime(value as string | null | undefined),
username: (value: unknown) => {
Iif (value === undefined || value === null || value === '') return '\u2014'
return String(value)
},
},
}
const crudConfig: CrudConfig = {
entityPath: 'container-registries',
fieldSet: CONTAINER_REGISTRY_FIELD_SET,
fieldTypes: CONTAINER_REGISTRY_FIELD_TYPES,
successTarget: '/container-registries/:id',
cancelTarget: '/container-registries/:id',
title: 'Edit Container Registry',
}
return (
<Page config={pageConfig}>
<EntityDetail config={detailConfig} />
<Crud config={crudConfig} />
<Outlet />
</Page>
)
}
|