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 <srichards@mirantis.com>
This commit is contained in:
Steve Richards committed 2020-10-07 10:35:23 +01:00
1 parent 44ce51613b
commit 888fa88754
2 files changed
+20 -1

No files matched your search

+10 -1
View File
@@ -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;
@@ -27,6 +27,7 @@ export class PodDetailsContainer extends React.Component<Props> {
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<Props> {
</span>
</DrawerItem>
}
{status &&
<DrawerItem name={<Trans>Last Status</Trans>}>
<span>
{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}` : ''}
</span>
</DrawerItem>
}
<DrawerItem name={<Trans>Image</Trans>}>
{image}
</DrawerItem>