Skip to content

Commit

Permalink
fix(ui): deployments table not showing accurate available count (#192)
Browse files Browse the repository at this point in the history
  • Loading branch information
TristanHoladay committed Aug 10, 2024
1 parent cb05f2c commit 7f66ae2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 8 additions & 2 deletions ui/src/lib/features/k8s/workloads/deployments/component.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,13 @@ suite('DeploymentTable Component', () => {
const mockData = [
{
metadata: { name: 'test', namespace: 'default', creationTimestamp: '2024-09-29T20:00:00Z' },
status: { readyReplicas: 1, replicas: 2, updatedReplicas: 1, conditions: [{ type: 'Available' }] },
status: {
availableReplicas: 2,
readyReplicas: 1,
replicas: 2,
updatedReplicas: 1,
conditions: [{ type: 'Available' }],
},
},
] as unknown as V1Deployment[]

Expand All @@ -54,7 +60,7 @@ suite('DeploymentTable Component', () => {
namespace: 'default',
ready: '1 / 2',
up_to_date: 1,
available: 1,
available: 2,
},
]

Expand Down
2 changes: 1 addition & 1 deletion ui/src/lib/features/k8s/workloads/deployments/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export function createStore(): ResourceStoreInterface<Resource, Row> {
const transform = transformResource<Resource, Row>((r) => ({
ready: `${r.status?.readyReplicas ?? 0} / ${r.status?.replicas ?? 0}`,
up_to_date: r.status?.updatedReplicas ?? 0,
available: r.status?.conditions?.filter((c) => c.type === 'Available').length ?? 0,
available: r.status?.availableReplicas ?? 0,
}))

const store = new ResourceStore<Resource, Row>(url, transform, 'name')
Expand Down

0 comments on commit 7f66ae2

Please sign in to comment.