diff --git a/web/crux-ui/src/components/deployments/deployment-container-status-list.tsx b/web/crux-ui/src/components/deployments/deployment-container-status-list.tsx index 6121ec5b9..f636bd2e5 100644 --- a/web/crux-ui/src/components/deployments/deployment-container-status-list.tsx +++ b/web/crux-ui/src/components/deployments/deployment-container-status-list.tsx @@ -13,6 +13,7 @@ import { containerPrefixNameOf, ContainersStateListMessage, DeploymentRoot, + nameOfInstance, WatchContainerStatusMessage, WS_TYPE_CONTAINERS_STATE_LIST, WS_TYPE_WATCH_CONTAINERS_STATE, @@ -26,7 +27,7 @@ export type ContainerProgress = { progress: number } -interface DeploymentContainerStatusListProps { +type DeploymentContainerStatusListProps = { className?: string deployment: DeploymentRoot progress: Record @@ -49,7 +50,7 @@ const DeploymentContainerStatusList = (props: DeploymentContainerStatusListProps configId: it.config.id, id: { prefix: deployment.prefix, - name: it.config.name ?? it.image.config.name, + name: nameOfInstance(it), }, createdAt: null, state: null, @@ -93,9 +94,9 @@ const DeploymentContainerStatusList = (props: DeploymentContainerStatusListProps }) } - sock.on(WS_TYPE_CONTAINERS_STATE_LIST, (message: ContainersStateListMessage) => - setContainers(it => merge(it, message.containers)), - ) + sock.on(WS_TYPE_CONTAINERS_STATE_LIST, (message: ContainersStateListMessage) => { + setContainers(it => merge(it, message.containers)) + }) const formatContainerTime = (container: Container) => { if (!container.createdAt) { diff --git a/web/crux-ui/src/components/deployments/deployment-view-list.tsx b/web/crux-ui/src/components/deployments/deployment-view-list.tsx index 9bf91fe5b..cbcff0ccd 100644 --- a/web/crux-ui/src/components/deployments/deployment-view-list.tsx +++ b/web/crux-ui/src/components/deployments/deployment-view-list.tsx @@ -3,7 +3,7 @@ import DyoIcon from '@app/elements/dyo-icon' import DyoLink from '@app/elements/dyo-link' import DyoTable, { DyoColumn, dyoCheckboxColumn, sortDate, sortString } from '@app/elements/dyo-table' import useTeamRoutes from '@app/hooks/use-team-routes' -import { Instance, containerNameOfInstance } from '@app/models' +import { Instance, nameOfInstance } from '@app/models' import { utcDateToLocale } from '@app/utils' import useTranslation from 'next-translate/useTranslation' import { DeploymentActions, DeploymentState } from './use-deployment-state' @@ -34,9 +34,9 @@ const DeploymentViewList = (props: DeploymentViewListProps) => { header={t('containerName')} className="w-4/12" sortable - sortField={containerNameOfInstance} + sortField={nameOfInstance} sort={sortString} - body={containerNameOfInstance} + body={nameOfInstance} /> - instance.config.name ?? containerNameOfImage(instance.image) +export const nameOfInstance = (instance: Instance) => instance.config.name ?? containerNameOfImage(instance.image) diff --git a/web/crux/src/app/node/node.dto.ts b/web/crux/src/app/node/node.dto.ts index 8dc8635b6..6da84e834 100755 --- a/web/crux/src/app/node/node.dto.ts +++ b/web/crux/src/app/node/node.dto.ts @@ -195,8 +195,10 @@ export class ContainerPort { } export class ContainerDto { + @ValidateNested() id: ContainerIdentifierDto + @IsString() command: string @Type(() => Date) @@ -208,14 +210,19 @@ export class ContainerDto { state: ContainerState // kubernetes reason (like crashloop backoff) or docker state + @IsString() reason: string + @IsString() imageName: string + @IsString() imageTag: string + @ValidateNested({ each: true }) ports: ContainerPort[] + @IsObject() labels: Record }