1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-22 23:09:41 +02:00

fix(ingress): handle system resources [EE-4775] (#9972)

* fix(ingress): handle system resources [EE-4775]
This commit is contained in:
Ali 2023-08-23 09:13:35 +12:00 committed by GitHub
parent 5586910e9d
commit 1e61f7e305
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 105 additions and 60 deletions

View file

@ -4,11 +4,7 @@ import clsx from 'clsx';
import { Row } from '@tanstack/react-table';
import { useEnvironmentId } from '@/react/hooks/useEnvironmentId';
import {
Authorized,
useAuthorizations,
useCurrentUser,
} from '@/react/hooks/useUser';
import { Authorized, useAuthorizations } from '@/react/hooks/useUser';
import { notifyError, notifySuccess } from '@/portainer/services/notifications';
import { pluralize } from '@/portainer/helpers/strings';
@ -48,11 +44,13 @@ export function ServicesDatatable() {
);
const readOnly = !useAuthorizations(['K8sServiceW']);
const { isAdmin } = useCurrentUser();
const canAccessSystemResources = useAuthorizations(
'K8sAccessSystemNamespaces'
);
const filteredServices = services?.filter(
(service) =>
(isAdmin && tableState.showSystemResources) ||
(canAccessSystemResources && tableState.showSystemResources) ||
!isSystemNamespace(service.Namespace)
);
@ -75,13 +73,15 @@ export function ServicesDatatable() {
<TableSettingsMenu>
<DefaultDatatableSettings
settings={tableState}
hideShowSystemResources={!isAdmin}
hideShowSystemResources={!canAccessSystemResources}
/>
</TableSettingsMenu>
)}
description={
<SystemResourceDescription
showSystemResources={tableState.showSystemResources || !isAdmin}
showSystemResources={
tableState.showSystemResources || !canAccessSystemResources
}
/>
}
renderRow={servicesRenderRow}