mirror of
https://github.com/portainer/portainer.git
synced 2025-08-02 04:15:28 +02:00
feat(helm): helm actions [r8s-259] (#715)
Co-authored-by: James Player <james.player@portainer.io> Co-authored-by: Cara Ryan <cara.ryan@portainer.io> Co-authored-by: stevensbkang <skan070@gmail.com>
This commit is contained in:
parent
dfa32b6755
commit
4ee349bd6b
117 changed files with 4161 additions and 696 deletions
|
@ -6,7 +6,17 @@ import { DescribeModal } from './DescribeModal';
|
|||
|
||||
const mockUseDescribeResource = vi.fn();
|
||||
|
||||
vi.mock('yaml-schema', () => ({}));
|
||||
// Mock the CodeEditor component instead of yaml-schema
|
||||
vi.mock('@@/CodeEditor', () => ({
|
||||
CodeEditor: ({
|
||||
value,
|
||||
'data-cy': dataCy,
|
||||
}: {
|
||||
value: string;
|
||||
'data-cy'?: string;
|
||||
}) => <div data-cy={dataCy}>{value}</div>,
|
||||
}));
|
||||
|
||||
vi.mock('./queries/useDescribeResource', () => ({
|
||||
useDescribeResource: (...args: unknown[]) => mockUseDescribeResource(...args),
|
||||
}));
|
||||
|
|
|
@ -11,6 +11,7 @@ import {
|
|||
import { useTableState } from '@@/datatables/useTableState';
|
||||
import { Widget } from '@@/Widget';
|
||||
import { TableSettingsMenuAutoRefresh } from '@@/datatables/TableSettingsMenuAutoRefresh';
|
||||
import { TextTip } from '@@/Tip/TextTip';
|
||||
|
||||
import { useHelmRelease } from '../../queries/useHelmRelease';
|
||||
|
||||
|
@ -34,12 +35,14 @@ const settingsStore = createStore('helm-resources');
|
|||
export function ResourcesTable() {
|
||||
const environmentId = useEnvironmentId();
|
||||
const { params } = useCurrentStateAndParams();
|
||||
const { name, namespace } = params;
|
||||
const { name, namespace, revision } = params;
|
||||
const revisionNumber = revision ? parseInt(revision, 10) : undefined;
|
||||
|
||||
const tableState = useTableState(settingsStore, storageKey);
|
||||
const helmReleaseQuery = useHelmRelease(environmentId, name, namespace, {
|
||||
showResources: true,
|
||||
refetchInterval: tableState.autoRefreshRate * 1000,
|
||||
revision: revisionNumber,
|
||||
});
|
||||
const rows = useResourceRows(helmReleaseQuery.data?.info?.resources);
|
||||
|
||||
|
@ -48,11 +51,17 @@ export function ResourcesTable() {
|
|||
<Datatable
|
||||
// no widget to avoid extra padding from app/react/components/datatables/TableContainer.tsx
|
||||
noWidget
|
||||
isLoading={helmReleaseQuery.isLoading}
|
||||
dataset={rows}
|
||||
columns={columns}
|
||||
includeSearch
|
||||
settingsManager={tableState}
|
||||
emptyContentLabel="No resources found"
|
||||
title={
|
||||
<TextTip inline color="blue" className="!text-xs">
|
||||
Resources reflect the latest revision only.
|
||||
</TextTip>
|
||||
}
|
||||
disableSelect
|
||||
getRowId={(row) => row.id}
|
||||
data-cy="helm-resources-datatable"
|
||||
|
|
|
@ -14,5 +14,9 @@ export const status = columnHelper.accessor((row) => row.status.label, {
|
|||
|
||||
function Cell({ row }: CellContext<ResourceRow, string>) {
|
||||
const { status } = row.original;
|
||||
if (!status.label) {
|
||||
return '-';
|
||||
}
|
||||
|
||||
return <StatusBadge color={status.type}>{status.label}</StatusBadge>;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue