From 888fa88754a9b956a138cba4a18f744031f368d4 Mon Sep 17 00:00:00 2001 From: Steve Richards Date: Wed, 7 Oct 2020 10:35:14 +0100 Subject: [PATCH] Issue:926 - Added Last Status information for Container - This update will support a last status of terminated and display the information for the termninated state. Signed-off-by: Steve Richards --- src/renderer/api/endpoints/pods.api.ts | 11 ++++++++++- .../+workloads-pods/pod-details-container.tsx | 10 ++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/renderer/api/endpoints/pods.api.ts b/src/renderer/api/endpoints/pods.api.ts index c1394ab6db..3439147dd7 100644 --- a/src/renderer/api/endpoints/pods.api.ts +++ b/src/renderer/api/endpoints/pods.api.ts @@ -149,7 +149,16 @@ export interface IPodContainerStatus { reason: string; }; }; - lastState: {}; + lastState: { + [index: string]: object; + terminated?: { + startedAt: string; + finishedAt: string; + exitCode: number; + reason: string; + containerID: string; + }; + }; ready: boolean; restartCount: number; image: string; diff --git a/src/renderer/components/+workloads-pods/pod-details-container.tsx b/src/renderer/components/+workloads-pods/pod-details-container.tsx index 79180b1130..cbcacd9ed4 100644 --- a/src/renderer/components/+workloads-pods/pod-details-container.tsx +++ b/src/renderer/components/+workloads-pods/pod-details-container.tsx @@ -27,6 +27,7 @@ export class PodDetailsContainer extends React.Component { const { name, image, imagePullPolicy, ports, volumeMounts, command, args } = container const status = pod.getContainerStatuses().find(status => status.name === container.name) const state = status ? Object.keys(status.state)[0] : "" + const lastState = status ? Object.keys(status.lastState)[0] : "" const ready = status ? status.ready : "" const liveness = pod.getLivenessProbe(container) const readiness = pod.getReadinessProbe(container) @@ -54,6 +55,15 @@ export class PodDetailsContainer extends React.Component { } + {status && + Last Status}> + + {lastState}{ready ? `, ${_i18n._(t`ready`)}` : ""} + {lastState === 'terminated' ? ` - ${status.lastState.terminated.reason} (${_i18n._(t`exit code`)}: ${status.lastState.terminated.exitCode}), + ${_i18n._(t`started at`)}: ${status.lastState.terminated.startedAt}, ${_i18n._(t`finished at`)}: ${status.lastState.terminated.finishedAt}` : ''} + + + } Image}> {image}