|
|
@ -1,11 +1,11 @@
|
|
|
|
import { List } from 'lucide-react';
|
|
|
|
import { List } from 'lucide-react';
|
|
|
|
|
|
|
|
import { useEffect } from 'react';
|
|
|
|
|
|
|
|
|
|
|
|
import { useAuthorizations } from '@/react/hooks/useUser';
|
|
|
|
import { useAuthorizations } from '@/react/hooks/useUser';
|
|
|
|
import { SystemResourceDescription } from '@/react/kubernetes/datatables/SystemResourceDescription';
|
|
|
|
import { SystemResourceDescription } from '@/react/kubernetes/datatables/SystemResourceDescription';
|
|
|
|
import { systemResourcesSettings } from '@/react/kubernetes/datatables/SystemResourcesSettings';
|
|
|
|
import { createStore } from '@/react/kubernetes/datatables/default-kube-datatable-store';
|
|
|
|
|
|
|
|
|
|
|
|
import { ExpandableDatatable } from '@@/datatables/ExpandableDatatable';
|
|
|
|
import { ExpandableDatatable } from '@@/datatables/ExpandableDatatable';
|
|
|
|
import { createPersistedStore, refreshableSettings } from '@@/datatables/types';
|
|
|
|
|
|
|
|
import { useRepeater } from '@@/datatables/useRepeater';
|
|
|
|
import { useRepeater } from '@@/datatables/useRepeater';
|
|
|
|
import { useTableState } from '@@/datatables/useTableState';
|
|
|
|
import { useTableState } from '@@/datatables/useTableState';
|
|
|
|
import { InsightsBox } from '@@/InsightsBox';
|
|
|
|
import { InsightsBox } from '@@/InsightsBox';
|
|
|
@ -14,21 +14,14 @@ import { KubernetesStack } from '../../types';
|
|
|
|
|
|
|
|
|
|
|
|
import { columns } from './columns';
|
|
|
|
import { columns } from './columns';
|
|
|
|
import { SubRows } from './SubRows';
|
|
|
|
import { SubRows } from './SubRows';
|
|
|
|
import { Namespace, TableSettings } from './types';
|
|
|
|
import { Namespace } from './types';
|
|
|
|
import { StacksSettingsMenu } from './StacksSettingsMenu';
|
|
|
|
import { StacksSettingsMenu } from './StacksSettingsMenu';
|
|
|
|
import { NamespaceFilter } from './NamespaceFilter';
|
|
|
|
import { NamespaceFilter } from './NamespaceFilter';
|
|
|
|
import { TableActions } from './TableActions';
|
|
|
|
import { TableActions } from './TableActions';
|
|
|
|
|
|
|
|
|
|
|
|
const storageKey = 'kubernetes.applications.stacks';
|
|
|
|
const storageKey = 'kubernetes.applications.stacks';
|
|
|
|
|
|
|
|
|
|
|
|
const settingsStore = createPersistedStore<TableSettings>(
|
|
|
|
const settingsStore = createStore(storageKey);
|
|
|
|
storageKey,
|
|
|
|
|
|
|
|
'name',
|
|
|
|
|
|
|
|
(set) => ({
|
|
|
|
|
|
|
|
...systemResourcesSettings(set),
|
|
|
|
|
|
|
|
...refreshableSettings(set),
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
interface Props {
|
|
|
|
interface Props {
|
|
|
|
dataset: Array<KubernetesStack>;
|
|
|
|
dataset: Array<KubernetesStack>;
|
|
|
@ -38,6 +31,8 @@ interface Props {
|
|
|
|
namespaces: Array<Namespace>;
|
|
|
|
namespaces: Array<Namespace>;
|
|
|
|
onNamespaceChange(namespace: string): void;
|
|
|
|
onNamespaceChange(namespace: string): void;
|
|
|
|
isLoading?: boolean;
|
|
|
|
isLoading?: boolean;
|
|
|
|
|
|
|
|
showSystem?: boolean;
|
|
|
|
|
|
|
|
setSystemResources(showSystem: boolean): void;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
export function ApplicationsStacksDatatable({
|
|
|
|
export function ApplicationsStacksDatatable({
|
|
|
@ -48,9 +43,16 @@ export function ApplicationsStacksDatatable({
|
|
|
|
namespaces,
|
|
|
|
namespaces,
|
|
|
|
onNamespaceChange,
|
|
|
|
onNamespaceChange,
|
|
|
|
isLoading,
|
|
|
|
isLoading,
|
|
|
|
|
|
|
|
showSystem,
|
|
|
|
|
|
|
|
setSystemResources,
|
|
|
|
}: Props) {
|
|
|
|
}: Props) {
|
|
|
|
const tableState = useTableState(settingsStore, storageKey);
|
|
|
|
const tableState = useTableState(settingsStore, storageKey);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
|
|
|
tableState.setShowSystemResources(showSystem || false);
|
|
|
|
|
|
|
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
|
|
|
|
|
|
}, [showSystem]);
|
|
|
|
|
|
|
|
|
|
|
|
const authorized = useAuthorizations('K8sApplicationsW');
|
|
|
|
const authorized = useAuthorizations('K8sApplicationsW');
|
|
|
|
useRepeater(tableState.autoRefreshRate, onRefresh);
|
|
|
|
useRepeater(tableState.autoRefreshRate, onRefresh);
|
|
|
|
|
|
|
|
|
|
|
@ -98,7 +100,12 @@ export function ApplicationsStacksDatatable({
|
|
|
|
renderTableActions={(selectedItems) => (
|
|
|
|
renderTableActions={(selectedItems) => (
|
|
|
|
<TableActions selectedItems={selectedItems} onRemove={onRemove} />
|
|
|
|
<TableActions selectedItems={selectedItems} onRemove={onRemove} />
|
|
|
|
)}
|
|
|
|
)}
|
|
|
|
renderTableSettings={() => <StacksSettingsMenu settings={tableState} />}
|
|
|
|
renderTableSettings={() => (
|
|
|
|
|
|
|
|
<StacksSettingsMenu
|
|
|
|
|
|
|
|
setSystemResources={setSystemResources}
|
|
|
|
|
|
|
|
settings={tableState}
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
)}
|
|
|
|
getRowId={(row) => `${row.Name}-${row.ResourcePool}`}
|
|
|
|
getRowId={(row) => `${row.Name}-${row.ResourcePool}`}
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
);
|
|
|
|