mirror of
https://github.com/portainer/portainer.git
synced 2025-07-24 15:59:41 +02:00
Co-authored-by: Cara Ryan <cara.ryan@portainer.io> Co-authored-by: James Player <james.player@portainer.io> Co-authored-by: stevensbkang <skan070@gmail.com>
38 lines
1.1 KiB
TypeScript
38 lines
1.1 KiB
TypeScript
import { Datatable } from '@@/datatables';
|
|
import { createPersistedStore } from '@@/datatables/types';
|
|
import { useTableState } from '@@/datatables/useTableState';
|
|
import { Widget } from '@@/Widget';
|
|
|
|
import { GenericResource } from '../../../types';
|
|
|
|
import { columns } from './columns';
|
|
import { useResourceRows } from './useResourceRows';
|
|
|
|
type Props = {
|
|
resources: GenericResource[];
|
|
};
|
|
|
|
const storageKey = 'helm-resources';
|
|
const settingsStore = createPersistedStore(storageKey, 'resourceType');
|
|
|
|
export function ResourcesTable({ resources }: Props) {
|
|
const tableState = useTableState(settingsStore, storageKey);
|
|
const rows = useResourceRows(resources);
|
|
|
|
return (
|
|
<Widget>
|
|
<Datatable
|
|
// no widget to avoid extra padding from app/react/components/datatables/TableContainer.tsx
|
|
noWidget
|
|
dataset={rows}
|
|
columns={columns}
|
|
includeSearch
|
|
settingsManager={tableState}
|
|
emptyContentLabel="No resources found"
|
|
disableSelect
|
|
getRowId={(row) => row.id}
|
|
data-cy="helm-resources-datatable"
|
|
/>
|
|
</Widget>
|
|
);
|
|
}
|