|
|
|
@ -1,5 +1,4 @@
|
|
|
|
|
import { List } from 'lucide-react';
|
|
|
|
|
import { useEffect } from 'react';
|
|
|
|
|
|
|
|
|
|
import { useAuthorizations } from '@/react/hooks/useUser';
|
|
|
|
|
import { SystemResourceDescription } from '@/react/kubernetes/datatables/SystemResourceDescription';
|
|
|
|
@ -7,16 +6,17 @@ import { createStore } from '@/react/kubernetes/datatables/default-kube-datatabl
|
|
|
|
|
import { useEnvironmentId } from '@/react/hooks/useEnvironmentId';
|
|
|
|
|
import { isSystemNamespace } from '@/react/kubernetes/namespaces/queries/useIsSystemNamespace';
|
|
|
|
|
import { useNamespacesQuery } from '@/react/kubernetes/namespaces/queries/useNamespacesQuery';
|
|
|
|
|
import { DefaultDatatableSettings } from '@/react/kubernetes/datatables/DefaultDatatableSettings';
|
|
|
|
|
|
|
|
|
|
import { ExpandableDatatable } from '@@/datatables/ExpandableDatatable';
|
|
|
|
|
import { useTableState } from '@@/datatables/useTableState';
|
|
|
|
|
import { TableSettingsMenu } from '@@/datatables';
|
|
|
|
|
|
|
|
|
|
import { useApplications } from '../../application.queries';
|
|
|
|
|
|
|
|
|
|
import { columns } from './columns';
|
|
|
|
|
import { SubRows } from './SubRows';
|
|
|
|
|
import { Namespace, Stack } from './types';
|
|
|
|
|
import { StacksSettingsMenu } from './StacksSettingsMenu';
|
|
|
|
|
import { NamespaceFilter } from './NamespaceFilter';
|
|
|
|
|
import { TableActions } from './TableActions';
|
|
|
|
|
import { getStacksFromApplications } from './getStacksFromApplications';
|
|
|
|
@ -30,8 +30,6 @@ interface Props {
|
|
|
|
|
namespace?: string;
|
|
|
|
|
namespaces: Array<Namespace>;
|
|
|
|
|
onNamespaceChange(namespace: string): void;
|
|
|
|
|
showSystem?: boolean;
|
|
|
|
|
setSystemResources(showSystem: boolean): void;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function ApplicationsStacksDatatable({
|
|
|
|
@ -39,17 +37,9 @@ export function ApplicationsStacksDatatable({
|
|
|
|
|
namespace = '',
|
|
|
|
|
namespaces,
|
|
|
|
|
onNamespaceChange,
|
|
|
|
|
showSystem,
|
|
|
|
|
setSystemResources,
|
|
|
|
|
}: Props) {
|
|
|
|
|
const tableState = useTableState(settingsStore, storageKey);
|
|
|
|
|
|
|
|
|
|
const { setShowSystemResources } = tableState;
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
setShowSystemResources(showSystem || false);
|
|
|
|
|
}, [showSystem, setShowSystemResources]);
|
|
|
|
|
|
|
|
|
|
const envId = useEnvironmentId();
|
|
|
|
|
const applicationsQuery = useApplications(envId, {
|
|
|
|
|
refetchInterval: tableState.autoRefreshRate * 1000,
|
|
|
|
@ -58,7 +48,7 @@ export function ApplicationsStacksDatatable({
|
|
|
|
|
});
|
|
|
|
|
const namespaceListQuery = useNamespacesQuery(envId);
|
|
|
|
|
const applications = applicationsQuery.data ?? [];
|
|
|
|
|
const filteredApplications = showSystem
|
|
|
|
|
const filteredApplications = tableState.showSystemResources
|
|
|
|
|
? applications
|
|
|
|
|
: applications.filter(
|
|
|
|
|
(item) =>
|
|
|
|
@ -90,12 +80,14 @@ export function ApplicationsStacksDatatable({
|
|
|
|
|
namespaces={namespaces}
|
|
|
|
|
value={namespace}
|
|
|
|
|
onChange={onNamespaceChange}
|
|
|
|
|
showSystem={showSystem}
|
|
|
|
|
showSystem={tableState.showSystemResources}
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div className="space-y-2">
|
|
|
|
|
<SystemResourceDescription showSystemResources={showSystem} />
|
|
|
|
|
<SystemResourceDescription
|
|
|
|
|
showSystemResources={tableState.showSystemResources}
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
}
|
|
|
|
@ -103,10 +95,9 @@ export function ApplicationsStacksDatatable({
|
|
|
|
|
<TableActions selectedItems={selectedItems} onRemove={onRemove} />
|
|
|
|
|
)}
|
|
|
|
|
renderTableSettings={() => (
|
|
|
|
|
<StacksSettingsMenu
|
|
|
|
|
setSystemResources={setSystemResources}
|
|
|
|
|
settings={tableState}
|
|
|
|
|
/>
|
|
|
|
|
<TableSettingsMenu>
|
|
|
|
|
<DefaultDatatableSettings settings={tableState} />
|
|
|
|
|
</TableSettingsMenu>
|
|
|
|
|
)}
|
|
|
|
|
getRowId={(row) => `${row.Name}-${row.ResourcePool}`}
|
|
|
|
|
data-cy="applications-stacks-datatable"
|
|
|
|
|