11import { notFound } from 'next/navigation' ;
22
3- import { getImage , getImageVersions } from '@/src/app/actions/deployments' ;
3+ import { getContainers , getImage , getImageVersions } from '@/src/app/actions/deployments' ;
44import ImageView from '@/src/components/Images/View/ImageView' ;
55import { SaveValidationContextProvider } from '@/src/context/SaveValidationContext' ;
66import { Image , ImageVersion } from '@/src/models/deployments/images' ;
77import { errorObjLog } from '@/src/server/logger' ;
88import { getRouteByType } from '@/src/utils/deployments/entity' ;
99import { getImageType } from '@/src/utils/deployments/images' ;
10+ import { Container } from '@/src/models/deployments/containers' ;
1011
1112export const dynamic = 'force-dynamic' ;
1213
@@ -18,15 +19,16 @@ interface Params {
1819export default async function Page ( params : Params ) {
1920 let image : Image | null = null ;
2021 let versions : ImageVersion [ ] | null = null ;
22+ let containers : Container [ ] | null = null ;
2123
2224 try {
2325 const imageResponse = await getImage ( ( await params . params ) . id ) ;
24-
26+ const containersResponse = await getContainers ( ) ;
2527 const versionsResponse = await getImageVersions (
2628 imageResponse . response . name ,
2729 getImageType ( getRouteByType ( imageResponse . response . $type ) ) ,
2830 ) ;
29-
31+ containers = containersResponse . response as Container [ ] ;
3032 image = imageResponse . response as Image ;
3133 versions = versionsResponse . response as ImageVersion [ ] ;
3234 } catch ( e ) {
@@ -37,9 +39,11 @@ export default async function Page(params: Params) {
3739 notFound ( ) ;
3840 }
3941
42+ const names = containers ?. map ( ( container ) => container . name || '' ) || [ ] ;
43+
4044 return (
4145 < SaveValidationContextProvider >
42- < ImageView image = { image } versions = { versions || [ ] } />
46+ < ImageView image = { image } versions = { versions || [ ] } containerNames = { names } />
4347 </ SaveValidationContextProvider >
4448 ) ;
4549}
0 commit comments