mirror of
https://github.com/portainer/portainer.git
synced 2025-07-25 08:19:40 +02:00
refactor(namespace): migrate namespace access view to react [r8s-141] (#87)
This commit is contained in:
parent
8ed7cd80cb
commit
e9fc6d5598
62 changed files with 1018 additions and 610 deletions
|
@ -23,7 +23,7 @@ import { InsightsBox } from '@@/InsightsBox';
|
|||
|
||||
import { useIngressControllerClassMapQuery } from '../../ingressClass/useIngressControllerClassMap';
|
||||
import { IngressControllerClassMap } from '../../ingressClass/types';
|
||||
import { useIsRBACEnabledQuery } from '../../getIsRBACEnabled';
|
||||
import { useIsRBACEnabled } from '../../useIsRBACEnabled';
|
||||
import { getIngressClassesFormValues } from '../../ingressClass/IngressClassDatatable/utils';
|
||||
|
||||
import { useStorageClassesFormValues } from './useStorageClasses';
|
||||
|
@ -102,7 +102,7 @@ function InnerForm({
|
|||
environmentId: EnvironmentId;
|
||||
}) {
|
||||
const { data: isRBACEnabled, ...isRBACEnabledQuery } =
|
||||
useIsRBACEnabledQuery(environmentId);
|
||||
useIsRBACEnabled(environmentId);
|
||||
|
||||
const onChangeControllers = useCallback(
|
||||
(controllerClassMap: IngressControllerClassMap[]) =>
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
diff a/app/react/kubernetes/cluster/ConfigureView/ConfigureForm/EnableMetricsInput.tsx b/app/react/kubernetes/cluster/ConfigureView/ConfigureForm/EnableMetricsInput.tsx (rejected hunks)
|
||||
@@ -103,7 +103,10 @@ export function EnableMetricsInput({ value, error, environmentId }: Props) {
|
||||
<TextTip color="red" icon={XCircle}>
|
||||
Unable to reach metrics API. You can enable the metrics-server
|
||||
addon in the{' '}
|
||||
- <Link to="kubernetes.cluster">Cluster Details view</Link>.
|
||||
+ <Link to="kubernetes.cluster" data-cy="cluster-details-view-link">
|
||||
+ Cluster Details view
|
||||
+ </Link>
|
||||
+ .
|
||||
</TextTip>
|
||||
)}
|
||||
{metricsFound === true && (
|
|
@ -2,20 +2,20 @@ import { useQuery } from '@tanstack/react-query';
|
|||
|
||||
import axios, { parseAxiosError } from '@/portainer/services/axios';
|
||||
import { EnvironmentId } from '@/react/portainer/environments/types';
|
||||
import { withError } from '@/react-tools/react-query';
|
||||
import { withGlobalError } from '@/react-tools/react-query';
|
||||
|
||||
export function useIsRBACEnabledQuery(environmentId: EnvironmentId) {
|
||||
export function useIsRBACEnabled(environmentId: EnvironmentId) {
|
||||
return useQuery<boolean, Error>(
|
||||
['environments', environmentId, 'rbacEnabled'],
|
||||
() => getIsRBACEnabled(environmentId),
|
||||
{
|
||||
enabled: !!environmentId,
|
||||
...withError('Unable to check if RBAC is enabled.'),
|
||||
...withGlobalError('Unable to check if RBAC is enabled.'),
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
export async function getIsRBACEnabled(environmentId: EnvironmentId) {
|
||||
async function getIsRBACEnabled(environmentId: EnvironmentId) {
|
||||
try {
|
||||
const { data } = await axios.get<boolean>(
|
||||
`kubernetes/${environmentId}/rbac_enabled`
|
Loading…
Add table
Add a link
Reference in a new issue