mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-04 02:26:19 +00:00
chore(frontend): rename approverUserIds to approvers in registerSecretApprovalPolicy
This commit is contained in:
@@ -9,12 +9,12 @@ export const useCreateSecretApprovalPolicy = () => {
|
|||||||
const queryClient = useQueryClient();
|
const queryClient = useQueryClient();
|
||||||
|
|
||||||
return useMutation<{}, {}, TCreateSecretPolicyDTO>({
|
return useMutation<{}, {}, TCreateSecretPolicyDTO>({
|
||||||
mutationFn: async ({ environment, workspaceId, approvals, approverUserIds, secretPath, name }) => {
|
mutationFn: async ({ environment, workspaceId, approvals, approvers, secretPath, name }) => {
|
||||||
const { data } = await apiRequest.post("/api/v1/secret-approvals", {
|
const { data } = await apiRequest.post("/api/v1/secret-approvals", {
|
||||||
environment,
|
environment,
|
||||||
workspaceId,
|
workspaceId,
|
||||||
approvals,
|
approvals,
|
||||||
approverUserIds,
|
approvers,
|
||||||
secretPath,
|
secretPath,
|
||||||
name
|
name
|
||||||
});
|
});
|
||||||
@@ -30,10 +30,10 @@ export const useUpdateSecretApprovalPolicy = () => {
|
|||||||
const queryClient = useQueryClient();
|
const queryClient = useQueryClient();
|
||||||
|
|
||||||
return useMutation<{}, {}, TUpdateSecretPolicyDTO>({
|
return useMutation<{}, {}, TUpdateSecretPolicyDTO>({
|
||||||
mutationFn: async ({ id, approverUserIds, approvals, secretPath, name }) => {
|
mutationFn: async ({ id, approvers, approvals, secretPath, name }) => {
|
||||||
const { data } = await apiRequest.patch(`/api/v1/secret-approvals/${id}`, {
|
const { data } = await apiRequest.patch(`/api/v1/secret-approvals/${id}`, {
|
||||||
approvals,
|
approvals,
|
||||||
approverUserIds,
|
approvers,
|
||||||
secretPath,
|
secretPath,
|
||||||
name
|
name
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ export type TSecretApprovalPolicy = {
|
|||||||
secretPath?: string;
|
secretPath?: string;
|
||||||
approvals: number;
|
approvals: number;
|
||||||
userApprovers: { userId: string }[];
|
userApprovers: { userId: string }[];
|
||||||
|
updatedAt: Date;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type TGetSecretApprovalPoliciesDTO = {
|
export type TGetSecretApprovalPoliciesDTO = {
|
||||||
@@ -26,14 +27,14 @@ export type TCreateSecretPolicyDTO = {
|
|||||||
name?: string;
|
name?: string;
|
||||||
environment: string;
|
environment: string;
|
||||||
secretPath?: string | null;
|
secretPath?: string | null;
|
||||||
approverUserIds?: string[];
|
approvers?: string[];
|
||||||
approvals?: number;
|
approvals?: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type TUpdateSecretPolicyDTO = {
|
export type TUpdateSecretPolicyDTO = {
|
||||||
id: string;
|
id: string;
|
||||||
name?: string;
|
name?: string;
|
||||||
approverUserIds?: string[];
|
approvers?: string[];
|
||||||
secretPath?: string | null;
|
secretPath?: string | null;
|
||||||
approvals?: number;
|
approvals?: number;
|
||||||
// for invalidating list
|
// for invalidating list
|
||||||
|
|||||||
+1
-1
@@ -51,7 +51,7 @@ export const SecretApprovalPolicyRow = ({
|
|||||||
{
|
{
|
||||||
workspaceId,
|
workspaceId,
|
||||||
id: policy.id,
|
id: policy.id,
|
||||||
approverUserIds: selectedApprovers
|
approvers: selectedApprovers
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
onSettled: () => {
|
onSettled: () => {
|
||||||
|
|||||||
+4
-4
@@ -37,9 +37,9 @@ const formSchema = z
|
|||||||
name: z.string().optional(),
|
name: z.string().optional(),
|
||||||
secretPath: z.string().optional().nullable(),
|
secretPath: z.string().optional().nullable(),
|
||||||
approvals: z.number().min(1),
|
approvals: z.number().min(1),
|
||||||
approverUserIds: z.string().array().min(1)
|
approvers: z.string().array().min(1)
|
||||||
})
|
})
|
||||||
.refine((data) => data.approvals <= data.approverUserIds.length, {
|
.refine((data) => data.approvals <= data.approvers.length, {
|
||||||
path: ["approvals"],
|
path: ["approvals"],
|
||||||
message: "The number of approvals should be lower than the number of approvers."
|
message: "The number of approvals should be lower than the number of approvers."
|
||||||
});
|
});
|
||||||
@@ -62,7 +62,7 @@ export const SecretPolicyForm = ({
|
|||||||
values: editValues
|
values: editValues
|
||||||
? {
|
? {
|
||||||
...editValues,
|
...editValues,
|
||||||
approverUserIds: editValues.userApprovers.map(({ userId }) => userId),
|
approvers: editValues.userApprovers.map(({ userId }) => userId),
|
||||||
environment: editValues.environment.slug
|
environment: editValues.environment.slug
|
||||||
}
|
}
|
||||||
: undefined
|
: undefined
|
||||||
@@ -183,7 +183,7 @@ export const SecretPolicyForm = ({
|
|||||||
/>
|
/>
|
||||||
<Controller
|
<Controller
|
||||||
control={control}
|
control={control}
|
||||||
name="approverUserIds"
|
name="approvers"
|
||||||
render={({ field: { value, onChange }, fieldState: { error } }) => (
|
render={({ field: { value, onChange }, fieldState: { error } }) => (
|
||||||
<FormControl
|
<FormControl
|
||||||
label="Approvers Required"
|
label="Approvers Required"
|
||||||
|
|||||||
Reference in New Issue
Block a user