mirror of
https://github.com/portainer/portainer.git
synced 2025-07-22 23:09:41 +02:00
refactor(kube/apps): migrate integrated apps table to react [EE-4690] (#11025)
This commit is contained in:
parent
26bb028ace
commit
946166319f
16 changed files with 291 additions and 260 deletions
|
@ -0,0 +1,59 @@
|
|||
import LaptopCode from '@/assets/ico/laptop-code.svg?c';
|
||||
|
||||
import { Datatable, TableSettingsMenu } from '@@/datatables';
|
||||
import { useRepeater } from '@@/datatables/useRepeater';
|
||||
import { TableSettingsMenuAutoRefresh } from '@@/datatables/TableSettingsMenuAutoRefresh';
|
||||
import { useTableStateWithStorage } from '@@/datatables/useTableState';
|
||||
import {
|
||||
BasicTableSettings,
|
||||
refreshableSettings,
|
||||
RefreshableTableSettings,
|
||||
} from '@@/datatables/types';
|
||||
|
||||
import { columns } from './columns';
|
||||
import { IntegratedApp } from './types';
|
||||
|
||||
interface TableSettings extends BasicTableSettings, RefreshableTableSettings {}
|
||||
|
||||
export function IntegratedAppsDatatable({
|
||||
dataset,
|
||||
onRefresh,
|
||||
isLoading,
|
||||
tableKey,
|
||||
tableTitle,
|
||||
}: {
|
||||
dataset: Array<IntegratedApp>;
|
||||
onRefresh: () => void;
|
||||
isLoading: boolean;
|
||||
tableKey: string;
|
||||
tableTitle: string;
|
||||
}) {
|
||||
const tableState = useTableStateWithStorage<TableSettings>(
|
||||
tableKey,
|
||||
'Name',
|
||||
(set) => ({
|
||||
...refreshableSettings(set),
|
||||
})
|
||||
);
|
||||
useRepeater(tableState.autoRefreshRate, onRefresh);
|
||||
|
||||
return (
|
||||
<Datatable
|
||||
dataset={dataset}
|
||||
settingsManager={tableState}
|
||||
columns={columns}
|
||||
disableSelect
|
||||
title={tableTitle}
|
||||
titleIcon={LaptopCode}
|
||||
isLoading={isLoading}
|
||||
renderTableSettings={() => (
|
||||
<TableSettingsMenu>
|
||||
<TableSettingsMenuAutoRefresh
|
||||
value={tableState.autoRefreshRate}
|
||||
onChange={tableState.setAutoRefreshRate}
|
||||
/>
|
||||
</TableSettingsMenu>
|
||||
)}
|
||||
/>
|
||||
);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue