mirror of
https://github.com/portainer/portainer.git
synced 2025-07-22 06:49:40 +02:00
refactor(kube/apps): migrate stacks table to react [EE-4661] (#10091)
This commit is contained in:
parent
a5f60c64ef
commit
25d5e62f5c
31 changed files with 516 additions and 565 deletions
|
@ -1,54 +1,31 @@
|
|||
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;
|
||||
}
|
||||
import {
|
||||
SystemResourcesSettings,
|
||||
SystemResourcesTableSettings,
|
||||
} from './SystemResourcesSettings';
|
||||
|
||||
export interface TableSettings
|
||||
extends BasicTableSettings,
|
||||
RefreshableTableSettings,
|
||||
SystemResourcesTableSettings {}
|
||||
|
||||
export function systemResourcesSettings<T extends SystemResourcesTableSettings>(
|
||||
set: ZustandSetFunc<T>
|
||||
): SystemResourcesTableSettings {
|
||||
return {
|
||||
showSystemResources: false,
|
||||
setShowSystemResources(showSystemResources: boolean) {
|
||||
set((s) => ({
|
||||
...s,
|
||||
showSystemResources,
|
||||
}));
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
interface Props {
|
||||
settings: TableSettings;
|
||||
hideShowSystemResources?: boolean;
|
||||
}
|
||||
|
||||
export function DefaultDatatableSettings({
|
||||
settings,
|
||||
hideShowSystemResources = false,
|
||||
}: Props) {
|
||||
}: {
|
||||
settings: TableSettings;
|
||||
}) {
|
||||
return (
|
||||
<>
|
||||
{!hideShowSystemResources && (
|
||||
<Checkbox
|
||||
id="show-system-resources"
|
||||
label="Show system resources"
|
||||
checked={settings.showSystemResources}
|
||||
onChange={(e) => settings.setShowSystemResources(e.target.checked)}
|
||||
/>
|
||||
)}
|
||||
<SystemResourcesSettings
|
||||
value={settings.showSystemResources}
|
||||
onChange={(value) => settings.setShowSystemResources(value)}
|
||||
/>
|
||||
|
||||
<TableSettingsMenuAutoRefresh
|
||||
value={settings.autoRefreshRate}
|
||||
onChange={handleRefreshRateChange}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue