mirror of
https://github.com/portainer/portainer.git
synced 2025-07-22 14:59:41 +02:00
refactor(app): app events datatable [EE-5355] (#10024)
This commit is contained in:
parent
0eaf296e1b
commit
c472fe9c18
19 changed files with 277 additions and 19 deletions
|
@ -0,0 +1,51 @@
|
|||
import { Event } from 'kubernetes-types/core/v1';
|
||||
import { History } from 'lucide-react';
|
||||
|
||||
import { IndexOptional } from '@/react/kubernetes/configs/types';
|
||||
import { TableSettings } from '@/react/kubernetes/datatables/DefaultDatatableSettings';
|
||||
|
||||
import { Datatable, TableSettingsMenu } from '@@/datatables';
|
||||
import { TableSettingsMenuAutoRefresh } from '@@/datatables/TableSettingsMenuAutoRefresh';
|
||||
import { TableState } from '@@/datatables/useTableState';
|
||||
|
||||
import { columns } from './columns';
|
||||
|
||||
type Props = {
|
||||
dataset: Event[];
|
||||
tableState: TableState<TableSettings>;
|
||||
isLoading: boolean;
|
||||
'data-cy': string;
|
||||
noWidget: boolean;
|
||||
};
|
||||
|
||||
export function EventsDatatable({
|
||||
dataset,
|
||||
tableState,
|
||||
isLoading,
|
||||
'data-cy': dataCy,
|
||||
noWidget,
|
||||
}: Props) {
|
||||
return (
|
||||
<Datatable<IndexOptional<Event>>
|
||||
dataset={dataset}
|
||||
columns={columns}
|
||||
settingsManager={tableState}
|
||||
isLoading={isLoading}
|
||||
emptyContentLabel="No event available."
|
||||
title="Events"
|
||||
titleIcon={History}
|
||||
getRowId={(row) => row.metadata?.uid || ''}
|
||||
disableSelect
|
||||
renderTableSettings={() => (
|
||||
<TableSettingsMenu>
|
||||
<TableSettingsMenuAutoRefresh
|
||||
value={tableState.autoRefreshRate}
|
||||
onChange={(value) => tableState.setAutoRefreshRate(value)}
|
||||
/>
|
||||
</TableSettingsMenu>
|
||||
)}
|
||||
data-cy={dataCy}
|
||||
noWidget={noWidget}
|
||||
/>
|
||||
);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue