diff --git a/frontend/src/views/Project/RolePage/components/RolePermissionsSection/RolePermissionsSection.tsx b/frontend/src/views/Project/RolePage/components/RolePermissionsSection/RolePermissionsSection.tsx
index d906a19fa..7e37e076c 100644
--- a/frontend/src/views/Project/RolePage/components/RolePermissionsSection/RolePermissionsSection.tsx
+++ b/frontend/src/views/Project/RolePage/components/RolePermissionsSection/RolePermissionsSection.tsx
@@ -2,9 +2,10 @@ import { FormProvider, useForm } from "react-hook-form";
import { faCancel, faPlus, faSave } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { zodResolver } from "@hookform/resolvers/zod";
+import { twMerge } from "tailwind-merge";
import { createNotification } from "@app/components/notifications";
-import { Button, Modal, ModalContent, ModalTrigger, Spinner } from "@app/components/v2";
+import { Button, IconButton, Modal, ModalContent, ModalTrigger, Tooltip } from "@app/components/v2";
import { ProjectPermissionSub, useWorkspace } from "@app/context";
import { usePopUp } from "@app/hooks";
import { useGetProjectRoleBySlug, useUpdateProjectRole } from "@app/hooks/api";
@@ -78,67 +79,73 @@ export const RolePermissionsSection = ({ roleSlug, isDisabled }: Props) => {
{isCustomRole && (
<>
-
}
- >
- Save
-
-
+ {isDirty && (
+
+ )}
+
+ }
+ >
+ Save
+
+ handlePopUpToggle("createPolicy", isOpen)}
+ >
+
+
+
+
+
+
+
+
+ handlePopUpToggle("createPolicy")} />
+
+
+
>
)}
- {isSubmitting ? (
-
-
-
Saving your policy.
-
- ) : (
- <>
-
- {!isLoading &&
}
- {(Object.keys(PROJECT_PERMISSION_OBJECT) as ProjectPermissionSub[]).map((subject) => (
-
- {subject === ProjectPermissionSub.Secrets ? (
-
- ) : undefined}
-
- ))}
-
- handlePopUpToggle("createPolicy", isOpen)}
+
+ {!isLoading &&
}
+ {(Object.keys(PROJECT_PERMISSION_OBJECT) as ProjectPermissionSub[]).map((subject) => (
+
-
- }>
- Add Policy
-
-
-
- handlePopUpToggle("createPolicy")} />
-
-
- >
- )}
+ {subject === ProjectPermissionSub.Secrets ? (
+
+ ) : undefined}
+
+ ))}
+
);
diff --git a/frontend/src/views/Project/RolePage/components/RolePermissionsSection/components/GeneralPermissionOptions.tsx b/frontend/src/views/Project/RolePage/components/RolePermissionsSection/components/GeneralPermissionOptions.tsx
index 3dc4dcb86..cdf0f5151 100644
--- a/frontend/src/views/Project/RolePage/components/RolePermissionsSection/components/GeneralPermissionOptions.tsx
+++ b/frontend/src/views/Project/RolePage/components/RolePermissionsSection/components/GeneralPermissionOptions.tsx
@@ -2,7 +2,7 @@ import { cloneElement } from "react";
import { Controller, useFieldArray, useFormContext } from "react-hook-form";
import { faChevronDown, faChevronRight, faPlus, faTrash } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
-import { AnimatePresence, motion } from "framer-motion";
+import { twMerge } from "tailwind-merge";
import { Button, Checkbox, Tag } from "@app/components/v2";
import { ProjectPermissionSub } from "@app/context";
@@ -59,94 +59,81 @@ export const GeneralPermissionOptions =
)}
-
- {isOpen && (
-
-
- {items.fields.map((el, rootIndex) => (
-
-
-
Actions
-
- {actions.map(({ label, value }) => {
- if (typeof value !== "string") return undefined;
- return (
-
(
-
-
- {label}
-
-
- )}
- />
- );
- })}
-
-
- {children &&
- cloneElement(children, {
- position: rootIndex
- })}
-
- {!isDisabled && subject === ProjectPermissionSub.Secrets && (
- }
- variant="star"
- size="xs"
- className="mt-2"
- onClick={() => {
- items.insert(rootIndex, [
- { read: false, edit: false, create: false, delete: false } as any
- ]);
- }}
- isDisabled={isDisabled}
- >
- Add policy
-
- )}
- {!isDisabled && (
- }
- variant="outline_bg"
- size="xs"
- className="mt-2 hover:border-red"
- onClick={() => items.remove(rootIndex)}
- isDisabled={isDisabled}
- >
- Remove policy
-
- )}{" "}
-
-
- ))}
-
-
- )}
-
+ {isOpen && (
+
+ {items.fields.map((el, rootIndex) => (
+
+
+
Actions
+
+ {actions.map(({ label, value }) => {
+ if (typeof value !== "string") return undefined;
+ return (
+
(
+
+
+ {label}
+
+
+ )}
+ />
+ );
+ })}
+
+
+ {children &&
+ cloneElement(children, {
+ position: rootIndex
+ })}
+
+ {!isDisabled && subject === ProjectPermissionSub.Secrets && (
+ }
+ variant="star"
+ size="xs"
+ className="mt-2"
+ onClick={() => {
+ items.insert(rootIndex, [
+ { read: false, edit: false, create: false, delete: false } as any
+ ]);
+ }}
+ isDisabled={isDisabled}
+ >
+ Add policy
+
+ )}
+ {!isDisabled && (
+ }
+ variant="outline_bg"
+ size="xs"
+ className="mt-2 hover:border-red"
+ onClick={() => items.remove(rootIndex)}
+ isDisabled={isDisabled}
+ >
+ Remove policy
+
+ )}{" "}
+
+
+ ))}
+
+ )}
);
};
diff --git a/frontend/src/views/Project/RolePage/components/RolePermissionsSection/components/SecretPermissionConditions.tsx b/frontend/src/views/Project/RolePage/components/RolePermissionsSection/components/SecretPermissionConditions.tsx
index 54b1c49af..38f60cc71 100644
--- a/frontend/src/views/Project/RolePage/components/RolePermissionsSection/components/SecretPermissionConditions.tsx
+++ b/frontend/src/views/Project/RolePage/components/RolePermissionsSection/components/SecretPermissionConditions.tsx
@@ -1,7 +1,6 @@
import { Controller, useFieldArray, useFormContext } from "react-hook-form";
import { faPlus, faTrash, faWarning } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
-import { twMerge } from "tailwind-merge";
import { Button, FormControl, IconButton, Input, Select, SelectItem } from "@app/components/v2";
import { PermissionConditionOperators } from "@app/context/ProjectPermissionContext/types";
@@ -31,12 +30,7 @@ export const SecretPermissionConditions = ({ position = 0, isDisabled }: Props)
});
return (
-
+
{items.fields.map((el, index) => {
const lhs = watch(`permissions.secrets.${position}.conditions.${index}.lhs`);