feat(auth): add useIsEdgeAdmin hook [EE-6627] (#11101)

This commit is contained in:
Chaim Lev-Ari
2024-02-15 00:50:26 +02:00
committed by GitHub
parent c08b5af85a
commit edea9e3481
48 changed files with 389 additions and 198 deletions

View File

@@ -1,6 +1,6 @@
import { useMemo } from 'react';
import { useCurrentUser } from '@/react/hooks/useUser';
import { useIsEdgeAdmin } from '@/react/hooks/useUser';
import { Link } from '@@/Link';
import { TextTip } from '@@/Tip/TextTip';
@@ -22,11 +22,14 @@ export function StackName({
inputClassName,
textTip = "Enter or select a 'stack' name to group multiple deployments together, or else leave empty to ignore.",
}: Props) {
const { isAdmin } = useCurrentUser();
const isAdminQuery = useIsEdgeAdmin();
const stackResults = useMemo(
() => stacks.filter((stack) => stack.includes(stackName ?? '')),
[stacks, stackName]
);
const { isAdmin } = isAdminQuery;
const tooltip = (
<>
You may specify a stack name to label resources that you want to group.