mirror of
https://github.com/podman-desktop/podman-desktop
synced 2026-05-24 10:18:53 +00:00
chore: add container statuses to pod (#7524)
This commit is contained in:
parent
26c41833cd
commit
34d0fb2869
2 changed files with 60 additions and 0 deletions
|
|
@ -44,3 +44,27 @@ test('Renders pod status correctly with hardcoded values', () => {
|
|||
expect(screen.getByText('Host IP')).toBeInTheDocument();
|
||||
expect(screen.getByText('192.168.1.2')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
test('show container statuses when present', () => {
|
||||
const fakePodStatusWithContainers: V1PodStatus = {
|
||||
phase: 'Running',
|
||||
containerStatuses: [
|
||||
{
|
||||
name: 'container1',
|
||||
state: {
|
||||
waiting: {
|
||||
reason: 'CrashLoopBackOff',
|
||||
message: 'Back-off restarting failed container',
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
} as V1PodStatus;
|
||||
|
||||
render(KubePodStatusArtifact, { artifact: fakePodStatusWithContainers });
|
||||
|
||||
expect(screen.getByText('Container Status')).toBeInTheDocument();
|
||||
expect(screen.getByText('container1')).toBeInTheDocument();
|
||||
expect(screen.getByText('CrashLoopBackOff')).toBeInTheDocument();
|
||||
expect(screen.getByText('Back-off restarting failed container')).toBeInTheDocument();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
import type { V1PodStatus } from '@kubernetes/client-node';
|
||||
|
||||
import Cell from './ui/Cell.svelte';
|
||||
import Subtitle from './ui/Subtitle.svelte';
|
||||
import Title from './ui/Title.svelte';
|
||||
|
||||
export let artifact: V1PodStatus | undefined;
|
||||
|
|
@ -31,4 +32,39 @@ if (artifact?.startTime) {
|
|||
<Cell>Start Time</Cell>
|
||||
<Cell>{artifact?.startTime}</Cell>
|
||||
</tr>
|
||||
|
||||
<!-- If containerStatus and at least one in the array has a 'state' that's not undefined.
|
||||
as the "state" information is where the warning is (unable to pull image, etc.) -->
|
||||
{#if artifact.containerStatuses?.some(containerStatus => containerStatus.state)}
|
||||
<tr>
|
||||
<Title>Container Status</Title>
|
||||
</tr>
|
||||
{#each artifact.containerStatuses as containerStatus}
|
||||
{#if containerStatus.state}
|
||||
<tr>
|
||||
<Subtitle>{containerStatus.name}</Subtitle>
|
||||
</tr>
|
||||
{#if containerStatus.state.waiting}
|
||||
<tr>
|
||||
<Cell>Waiting</Cell>
|
||||
<Cell>{containerStatus.state.waiting.reason}</Cell>
|
||||
</tr>
|
||||
<tr>
|
||||
<Cell>Message</Cell>
|
||||
<Cell>{containerStatus.state.waiting.message}</Cell>
|
||||
</tr>
|
||||
{/if}
|
||||
{#if containerStatus.state.terminated}
|
||||
<tr>
|
||||
<Cell>Terminated</Cell>
|
||||
<Cell>{containerStatus.state.terminated.reason}</Cell>
|
||||
</tr>
|
||||
<tr>
|
||||
<Cell>Exit Code</Cell>
|
||||
<Cell>{containerStatus.state.terminated.exitCode}</Cell>
|
||||
</tr>
|
||||
{/if}
|
||||
{/if}
|
||||
{/each}
|
||||
{/if}
|
||||
{/if}
|
||||
|
|
|
|||
Loading…
Reference in a new issue