mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-07 12:27:28 +00:00
Fix: Move to project slug
This commit is contained in:
+21
-5
@@ -32,7 +32,7 @@ type Props = {
|
|||||||
isOpen?: boolean;
|
isOpen?: boolean;
|
||||||
onToggle: (isOpen: boolean) => void;
|
onToggle: (isOpen: boolean) => void;
|
||||||
members?: TWorkspaceUser[];
|
members?: TWorkspaceUser[];
|
||||||
workspaceId: string;
|
projectSlug: string;
|
||||||
editValues?: TAccessApprovalPolicy;
|
editValues?: TAccessApprovalPolicy;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -40,7 +40,7 @@ const formSchema = z
|
|||||||
.object({
|
.object({
|
||||||
environment: z.string(),
|
environment: z.string(),
|
||||||
name: z.string().optional(),
|
name: z.string().optional(),
|
||||||
secretPath: z.string().optional().nullable(),
|
secretPath: z.string().optional(),
|
||||||
approvals: z.number().min(1),
|
approvals: z.number().min(1),
|
||||||
approvers: z.string().array().min(1)
|
approvers: z.string().array().min(1)
|
||||||
})
|
})
|
||||||
@@ -55,7 +55,7 @@ export const AccessPolicyForm = ({
|
|||||||
isOpen,
|
isOpen,
|
||||||
onToggle,
|
onToggle,
|
||||||
members = [],
|
members = [],
|
||||||
workspaceId,
|
projectSlug,
|
||||||
editValues
|
editValues
|
||||||
}: Props) => {
|
}: Props) => {
|
||||||
const {
|
const {
|
||||||
@@ -80,10 +80,12 @@ export const AccessPolicyForm = ({
|
|||||||
const { mutateAsync: updateAccessApprovalPolicy } = useUpdateAccessApprovalPolicy();
|
const { mutateAsync: updateAccessApprovalPolicy } = useUpdateAccessApprovalPolicy();
|
||||||
|
|
||||||
const handleCreatePolicy = async (data: TFormSchema) => {
|
const handleCreatePolicy = async (data: TFormSchema) => {
|
||||||
|
if (!projectSlug) return;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await createAccessApprovalPolicy({
|
await createAccessApprovalPolicy({
|
||||||
...data,
|
...data,
|
||||||
workspaceId
|
projectSlug
|
||||||
});
|
});
|
||||||
createNotification({
|
createNotification({
|
||||||
type: "success",
|
type: "success",
|
||||||
@@ -100,12 +102,14 @@ export const AccessPolicyForm = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleUpdatePolicy = async (data: TFormSchema) => {
|
const handleUpdatePolicy = async (data: TFormSchema) => {
|
||||||
|
if (!projectSlug) return;
|
||||||
if (!editValues?.id) return;
|
if (!editValues?.id) return;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await updateAccessApprovalPolicy({
|
await updateAccessApprovalPolicy({
|
||||||
id: editValues?.id,
|
id: editValues?.id,
|
||||||
...data,
|
...data,
|
||||||
workspaceId
|
projectSlug
|
||||||
});
|
});
|
||||||
createNotification({
|
createNotification({
|
||||||
type: "success",
|
type: "success",
|
||||||
@@ -154,6 +158,7 @@ export const AccessPolicyForm = ({
|
|||||||
errorText={error?.message}
|
errorText={error?.message}
|
||||||
>
|
>
|
||||||
<Select
|
<Select
|
||||||
|
isDisabled={isEditMode}
|
||||||
value={value}
|
value={value}
|
||||||
onValueChange={(val) => onChange(val)}
|
onValueChange={(val) => onChange(val)}
|
||||||
className="w-full border border-mineshaft-500"
|
className="w-full border border-mineshaft-500"
|
||||||
@@ -170,6 +175,17 @@ export const AccessPolicyForm = ({
|
|||||||
</FormControl>
|
</FormControl>
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<Controller
|
||||||
|
control={control}
|
||||||
|
name="secretPath"
|
||||||
|
render={({ field, fieldState: { error } }) => (
|
||||||
|
<FormControl label="Secret Path" isError={Boolean(error)} errorText={error?.message}>
|
||||||
|
<Input {...field} value={field.value || ""} />
|
||||||
|
</FormControl>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
|
||||||
<Controller
|
<Controller
|
||||||
control={control}
|
control={control}
|
||||||
name="approvers"
|
name="approvers"
|
||||||
|
|||||||
Reference in New Issue
Block a user