import { createColumnHelper } from '@tanstack/react-table'; import { Lock, Plus, Trash2 } from 'lucide-react'; import { SecretViewModel } from '@/docker/models/secret'; import { isoDate } from '@/portainer/filters/filters'; import { buildNameColumn } from '@@/datatables/buildNameColumn'; import { Datatable, TableSettingsMenu } from '@@/datatables'; import { BasicTableSettings, RefreshableTableSettings, createPersistedStore, refreshableSettings, } from '@@/datatables/types'; import { useTableState } from '@@/datatables/useTableState'; import { TableSettingsMenuAutoRefresh } from '@@/datatables/TableSettingsMenuAutoRefresh'; import { Button } from '@@/buttons'; import { Link } from '@@/Link'; import { useRepeater } from '@@/datatables/useRepeater'; import { createOwnershipColumn } from '../../components/datatable-helpers/createOwnershipColumn'; const columnHelper = createColumnHelper(); const columns = [ buildNameColumn('Name', 'Id', '.secret'), columnHelper.accessor((item) => isoDate(item.CreatedAt), { header: 'Creation Date', }), createOwnershipColumn(), ]; interface TableSettings extends BasicTableSettings, RefreshableTableSettings {} const storageKey = 'docker-secrets'; const store = createPersistedStore( storageKey, undefined, (set) => ({ ...refreshableSettings(set), }) ); export function SecretsDatatable({ dataset, onRemove, onRefresh, }: { dataset?: Array; onRemove(items: Array): void; onRefresh(): Promise; }) { const tableState = useTableState(store, storageKey); useRepeater(tableState.autoRefreshRate, onRefresh); return ( ( )} renderTableSettings={() => ( tableState.setAutoRefreshRate(value)} /> )} /> ); } function TableActions({ selectedItems, onRemove, }: { selectedItems: Array; onRemove(items: Array): void; }) { return (
); }