mirror of https://github.com/portainer/portainer
feat(kubernetes): fix wordings for ingresses toggle EE-2647 (#8151)
parent
d6a3fe23e9
commit
a61b18dd93
|
@ -135,7 +135,7 @@
|
|||
<div class="col-sm-12 mt-5">
|
||||
<por-switch-field
|
||||
name="'restrictStandardUserIngressW'"
|
||||
label="'Only allow deployment of ingresses by admins'"
|
||||
label="'Only allow admins to deploy ingresses'"
|
||||
tooltip="'Enforces only allowing admins to deploy ingresses (and disallows standard users from doing so).'"
|
||||
label-class="'col-sm-5 col-lg-4 px-0 !m-0'"
|
||||
switch-class="'col-sm-8 text-muted'"
|
||||
|
|
|
@ -6,7 +6,8 @@ import { useEnvironmentId } from '@/react/hooks/useEnvironmentId';
|
|||
import { useConfigurations } from '@/react/kubernetes/configs/queries';
|
||||
import { useNamespaces } from '@/react/kubernetes/namespaces/queries';
|
||||
import { useServices } from '@/react/kubernetes/networks/services/queries';
|
||||
import { notifySuccess } from '@/portainer/services/notifications';
|
||||
import { notifySuccess, notifyError } from '@/portainer/services/notifications';
|
||||
import { useAuthorizations } from '@/react/hooks/useUser';
|
||||
|
||||
import { Link } from '@@/Link';
|
||||
import { PageHeader } from '@@/PageHeader';
|
||||
|
@ -35,10 +36,20 @@ import {
|
|||
export function CreateIngressView() {
|
||||
const environmentId = useEnvironmentId();
|
||||
const { params } = useCurrentStateAndParams();
|
||||
const isAuthorisedToAddEdit = useAuthorizations(['K8sIngressesW']);
|
||||
|
||||
const router = useRouter();
|
||||
const isEdit = !!params.namespace;
|
||||
|
||||
useEffect(() => {
|
||||
if (!isAuthorisedToAddEdit) {
|
||||
const message = `Not authorized to ${isEdit ? 'edit' : 'add'} ingresses`;
|
||||
notifyError('Error', new Error(message));
|
||||
router.stateService.go('kubernetes.ingresses');
|
||||
}
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [isAuthorisedToAddEdit, isEdit]);
|
||||
|
||||
const [namespace, setNamespace] = useState<string>(params.namespace || '');
|
||||
const [ingressRule, setIngressRule] = useState<Rule>({} as Rule);
|
||||
|
||||
|
|
Loading…
Reference in New Issue