mirror of
https://github.com/portainer/portainer.git
synced 2025-07-24 15:59:41 +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
|
@ -1,27 +0,0 @@
|
|||
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';
|
||||
|
||||
export function useIsRBACEnabledQuery(environmentId: EnvironmentId) {
|
||||
return useQuery<boolean, Error>(
|
||||
['environments', environmentId, 'rbacEnabled'],
|
||||
() => getIsRBACEnabled(environmentId),
|
||||
{
|
||||
enabled: !!environmentId,
|
||||
...withError('Unable to check if RBAC is enabled.'),
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
export async function getIsRBACEnabled(environmentId: EnvironmentId) {
|
||||
try {
|
||||
const { data } = await axios.get<boolean>(
|
||||
`kubernetes/${environmentId}/rbac_enabled`
|
||||
);
|
||||
return data;
|
||||
} catch (e) {
|
||||
throw parseAxiosError(e, 'Unable to check if RBAC is enabled.');
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue