mirror of
https://github.com/portainer/portainer.git
synced 2025-07-22 23:09:41 +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
42
app/react/kubernetes/datatables/SystemResourcesSettings.tsx
Normal file
42
app/react/kubernetes/datatables/SystemResourcesSettings.tsx
Normal file
|
@ -0,0 +1,42 @@
|
|||
import { Authorized } from '@/react/hooks/useUser';
|
||||
|
||||
import { ZustandSetFunc } from '@@/datatables/types';
|
||||
import { Checkbox } from '@@/form-components/Checkbox';
|
||||
|
||||
export function SystemResourcesSettings({
|
||||
value,
|
||||
onChange,
|
||||
}: {
|
||||
value: boolean;
|
||||
onChange: (value: boolean) => void;
|
||||
}) {
|
||||
return (
|
||||
<Authorized authorizations="K8sAccessSystemNamespaces" adminOnlyCE>
|
||||
<Checkbox
|
||||
id="show-system-resources"
|
||||
label="Show system resources"
|
||||
checked={value}
|
||||
onChange={(e) => onChange(e.target.checked)}
|
||||
/>
|
||||
</Authorized>
|
||||
);
|
||||
}
|
||||
|
||||
export interface SystemResourcesTableSettings {
|
||||
showSystemResources: boolean;
|
||||
setShowSystemResources: (value: boolean) => void;
|
||||
}
|
||||
|
||||
export function systemResourcesSettings<T extends SystemResourcesTableSettings>(
|
||||
set: ZustandSetFunc<T>
|
||||
): SystemResourcesTableSettings {
|
||||
return {
|
||||
showSystemResources: false,
|
||||
setShowSystemResources(showSystemResources: boolean) {
|
||||
set((s) => ({
|
||||
...s,
|
||||
showSystemResources,
|
||||
}));
|
||||
},
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue