import { TableSettingsMenuAutoRefresh } from '@@/datatables/TableSettingsMenuAutoRefresh'; import { Checkbox } from '@@/form-components/Checkbox'; import { BasicTableSettings, RefreshableTableSettings, ZustandSetFunc, } from '@@/datatables/types'; interface SystemResourcesTableSettings { showSystemResources: boolean; setShowSystemResources: (value: boolean) => void; } export interface TableSettings extends BasicTableSettings, RefreshableTableSettings, SystemResourcesTableSettings {} export function systemResourcesSettings( set: ZustandSetFunc ): SystemResourcesTableSettings { return { showSystemResources: false, setShowSystemResources(showSystemResources: boolean) { set((s) => ({ ...s, showSystemResources, })); }, }; } interface Props { settings: TableSettings; hideShowSystemResources?: boolean; } export function DefaultDatatableSettings({ settings, hideShowSystemResources = false, }: Props) { return ( <> {!hideShowSystemResources && ( settings.setShowSystemResources(e.target.checked)} /> )} ); function handleRefreshRateChange(autoRefreshRate: number) { settings.setAutoRefreshRate(autoRefreshRate); } }