1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-08-04 21:35:23 +02:00

feat(helm): make the atomic flag optional [r8s-314] (#733)

This commit is contained in:
Ali 2025-05-14 16:31:42 +12:00 committed by GitHub
parent 4ee349bd6b
commit d49fcd8f3e
11 changed files with 71 additions and 10 deletions

View file

@ -218,7 +218,9 @@ describe('HelmEventsDatatable', () => {
await waitFor(() => {
expect(
screen.getByText('Events reflect the latest revision only.')
screen.getByText(
'Only events for resources currently in the cluster will be displayed.'
)
).toBeInTheDocument();
});

View file

@ -42,7 +42,8 @@ export function HelmEventsDatatable({
dataset={eventsQuery.data || []}
title={
<TextTip inline color="blue" className="!text-xs">
Events reflect the latest revision only.
Only events for resources currently in the cluster will be
displayed.
</TextTip>
}
titleIcon={null}

View file

@ -167,9 +167,13 @@ describe('ResourcesTable', () => {
);
// Check that success badge is rendered
const successBadge = screen.getByText('MinimumReplicasAvailable');
const successBadge = screen.getByText(
(content, element) =>
content.includes('MinimumReplicasAvailable') &&
element !== null &&
element.className.includes('bg-success')
);
expect(successBadge).toBeInTheDocument();
expect(successBadge.className).toContain('bg-success');
});
it('should show error badges for failed resources', () => {
@ -177,8 +181,12 @@ describe('ResourcesTable', () => {
expect(screen.getByText('probe-failure-nginx-bad')).toBeInTheDocument();
// Check for the unhealthy status badge and make sure it has the error styling
const errorBadge = screen.getByText('InsufficientPods');
const errorBadge = screen.getByText(
(content, element) =>
content.includes('InsufficientPods') &&
element !== null &&
element.className.includes('bg-error')
);
expect(errorBadge).toBeInTheDocument();
expect(errorBadge.className).toContain('bg-error');
});
});

View file

@ -59,7 +59,7 @@ export function ResourcesTable() {
emptyContentLabel="No resources found"
title={
<TextTip inline color="blue" className="!text-xs">
Resources reflect the latest revision only.
Only resources currently in the cluster will be displayed.
</TextTip>
}
disableSelect

View file

@ -1,6 +1,20 @@
import { Row } from '@tanstack/react-table';
import { filterHOC } from '@@/datatables/Filter';
import { ResourceRow } from '../types';
import { columnHelper } from './helper';
export const resourceType = columnHelper.accessor((row) => row.resourceType, {
header: 'Resource type',
id: 'resourceType',
meta: {
filter: filterHOC('Filter by resource type'),
},
enableColumnFilter: true,
filterFn: (row: Row<ResourceRow>, _: string, filterValue: string[]) =>
filterValue.length === 0 ||
(!!row.original.resourceType &&
filterValue.includes(row.original.resourceType)),
});

View file

@ -1,6 +1,7 @@
import { CellContext } from '@tanstack/react-table';
import { CellContext, Row } from '@tanstack/react-table';
import { StatusBadge } from '@@/StatusBadge';
import { filterHOC } from '@@/datatables/Filter';
import { ResourceRow } from '../types';
@ -10,6 +11,21 @@ export const status = columnHelper.accessor((row) => row.status.label, {
header: 'Status',
id: 'status',
cell: Cell,
meta: {
filter: filterHOC(
'Filter by status',
// don't include empty values in the filter options
(rows: Row<ResourceRow>[]) =>
Array.from(
new Set(rows.map((row) => row.original.status.label).filter(Boolean))
)
),
},
enableColumnFilter: true,
filterFn: (row: Row<ResourceRow>, _: string, filterValue: string[]) =>
filterValue.length === 0 ||
(!!row.original.status.label &&
filterValue.includes(row.original.status.label)),
});
function Cell({ row }: CellContext<ResourceRow, string>) {