mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-16 17:30:06 +00:00
feat(infisical-pg): changed frontend api types _id to normal id
This commit is contained in:
@@ -18,18 +18,25 @@ export const SecretApprovalPage = () => {
|
||||
const workspaceId = currentWorkspace?.id || "";
|
||||
|
||||
return (
|
||||
<div className="container mx-auto bg-bunker-800 text-white w-full h-full max-w-7xl px-6">
|
||||
<div className="py-6 flex justify-between items-center">
|
||||
<div className="flex flex-col w-full">
|
||||
<div className="container mx-auto h-full w-full max-w-7xl bg-bunker-800 px-6 text-white">
|
||||
<div className="flex items-center justify-between py-6">
|
||||
<div className="flex w-full flex-col">
|
||||
<h2 className="text-3xl font-semibold text-gray-200">Secret Approval Workflows</h2>
|
||||
<p className="text-bunker-300">Create approval policies for any modifications to secrets in sensitive environments and folders.</p>
|
||||
<p className="text-bunker-300">
|
||||
Create approval policies for any modifications to secrets in sensitive environments and
|
||||
folders.
|
||||
</p>
|
||||
</div>
|
||||
<div className="flex justify-center w-max">
|
||||
<div className="flex w-max justify-center">
|
||||
<Link href="https://infisical.com/docs/documentation/platform/pr-workflows">
|
||||
<span className="rounded-md px-4 py-2 w-max text-mineshaft-200 hover:text-white bg-mineshaft-600 border border-mineshaft-500 hover:bg-primary/10 hover:border-primary/40 duration-200 cursor-pointer">
|
||||
Documentation <FontAwesomeIcon icon={faArrowUpRightFromSquare} className="text-xs mb-[0.06rem] ml-1"/>
|
||||
<span className="w-max cursor-pointer rounded-md border border-mineshaft-500 bg-mineshaft-600 px-4 py-2 text-mineshaft-200 duration-200 hover:border-primary/40 hover:bg-primary/10 hover:text-white">
|
||||
Documentation{" "}
|
||||
<FontAwesomeIcon
|
||||
icon={faArrowUpRightFromSquare}
|
||||
className="mb-[0.06rem] ml-1 text-xs"
|
||||
/>
|
||||
</span>
|
||||
</Link>
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
<Tabs defaultValue={TabSection.ApprovalRequests}>
|
||||
|
||||
+3
-3
@@ -59,7 +59,7 @@ export const SecretApprovalPolicyList = ({ workspaceId }: Props) => {
|
||||
const { mutateAsync: deleteSecretApprovalPolicy } = useDeleteSecretApprovalPolicy();
|
||||
|
||||
const handleDeletePolicy = async () => {
|
||||
const { id: id } = popUp.deletePolicy.data as TSecretApprovalPolicy;
|
||||
const { id } = popUp.deletePolicy.data as TSecretApprovalPolicy;
|
||||
try {
|
||||
await deleteSecretApprovalPolicy({
|
||||
workspaceId,
|
||||
@@ -81,10 +81,10 @@ export const SecretApprovalPolicyList = ({ workspaceId }: Props) => {
|
||||
|
||||
return (
|
||||
<div>
|
||||
<div className="flex justify-between mb-6">
|
||||
<div className="mb-6 flex justify-between">
|
||||
<div className="flex flex-col">
|
||||
<span className="text-xl font-semibold text-mineshaft-100">Approval Policies</span>
|
||||
<div className="text-bunker-300 mt-2 text-sm">
|
||||
<div className="mt-2 text-sm text-bunker-300">
|
||||
Implement policies to prevent unauthorized secret changes.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
+8
-6
@@ -50,7 +50,7 @@ export const SecretApprovalPolicyRow = ({
|
||||
updateSecretApprovalPolicy(
|
||||
{
|
||||
workspaceId,
|
||||
id: policy._id,
|
||||
id: policy.id,
|
||||
approvers: selectedApprovers
|
||||
},
|
||||
{
|
||||
@@ -81,18 +81,20 @@ export const SecretApprovalPolicyRow = ({
|
||||
style={{ width: "var(--radix-dropdown-menu-trigger-width)" }}
|
||||
align="start"
|
||||
>
|
||||
<DropdownMenuLabel>Select members that are allowed to approve changes</DropdownMenuLabel>
|
||||
{members?.map(({ _id, user }) => {
|
||||
const isChecked = selectedApprovers.includes(_id);
|
||||
<DropdownMenuLabel>
|
||||
Select members that are allowed to approve changes
|
||||
</DropdownMenuLabel>
|
||||
{members?.map(({ id, user }) => {
|
||||
const isChecked = selectedApprovers.includes(id);
|
||||
return (
|
||||
<DropdownMenuItem
|
||||
onClick={(evt) => {
|
||||
evt.preventDefault();
|
||||
setSelectedApprovers((state) =>
|
||||
isChecked ? state.filter((el) => el !== _id) : [...state, _id]
|
||||
isChecked ? state.filter((el) => el !== id) : [...state, id]
|
||||
);
|
||||
}}
|
||||
key={`create-policy-members-${_id}`}
|
||||
key={`create-policy-members-${id}`}
|
||||
iconPos="right"
|
||||
icon={isChecked && <FontAwesomeIcon icon={faCheckCircle} />}
|
||||
>
|
||||
|
||||
+10
-10
@@ -98,10 +98,10 @@ export const SecretPolicyForm = ({
|
||||
};
|
||||
|
||||
const handleUpdatePolicy = async (data: TFormSchema) => {
|
||||
if (!editValues?._id) return;
|
||||
if (!editValues?.id) return;
|
||||
try {
|
||||
await updateSecretApprovalPolicy({
|
||||
id: editValues?._id,
|
||||
id: editValues?.id,
|
||||
...data,
|
||||
secretPath: data.secretPath || null,
|
||||
workspaceId
|
||||
@@ -199,20 +199,20 @@ export const SecretPolicyForm = ({
|
||||
style={{ width: "var(--radix-dropdown-menu-trigger-width)" }}
|
||||
align="start"
|
||||
>
|
||||
<DropdownMenuLabel>Select members that are allowed to approve changes</DropdownMenuLabel>
|
||||
{members.map(({ _id, user }) => {
|
||||
const isChecked = value?.includes(_id);
|
||||
<DropdownMenuLabel>
|
||||
Select members that are allowed to approve changes
|
||||
</DropdownMenuLabel>
|
||||
{members.map(({ id, user }) => {
|
||||
const isChecked = value?.includes(id);
|
||||
return (
|
||||
<DropdownMenuItem
|
||||
onClick={(evt) => {
|
||||
evt.preventDefault();
|
||||
onChange(
|
||||
isChecked
|
||||
? value?.filter((el) => el !== _id)
|
||||
: [...(value || []), _id]
|
||||
isChecked ? value?.filter((el) => el !== id) : [...(value || []), id]
|
||||
);
|
||||
}}
|
||||
key={`create-policy-members-${_id}`}
|
||||
key={`create-policy-members-${id}`}
|
||||
iconPos="right"
|
||||
icon={isChecked && <FontAwesomeIcon icon={faCheckCircle} />}
|
||||
>
|
||||
@@ -243,7 +243,7 @@ export const SecretPolicyForm = ({
|
||||
</FormControl>
|
||||
)}
|
||||
/>
|
||||
<div className="flex mt-8 space-x-4 items-center">
|
||||
<div className="mt-8 flex items-center space-x-4">
|
||||
<Button type="submit" isLoading={isSubmitting} isDisabled={isSubmitting}>
|
||||
Save
|
||||
</Button>
|
||||
|
||||
+9
-11
@@ -34,7 +34,7 @@ import {
|
||||
|
||||
export const SecretApprovalRequest = () => {
|
||||
const { currentWorkspace } = useWorkspace();
|
||||
const workspaceId = currentWorkspace?._id || "";
|
||||
const workspaceId = currentWorkspace?.id || "";
|
||||
const [selectedApproval, setSelectedApproval] = useState<TSecretApprovalRequest | null>(null);
|
||||
|
||||
// filters
|
||||
@@ -60,10 +60,10 @@ export const SecretApprovalRequest = () => {
|
||||
const { user: presentUser } = useUser();
|
||||
const { data: members } = useGetWorkspaceUsers(workspaceId);
|
||||
const membersGroupById = members?.reduce<Record<string, TWorkspaceUser>>(
|
||||
(prev, curr) => ({ ...prev, [curr._id]: curr }),
|
||||
(prev, curr) => ({ ...prev, [curr.id]: curr }),
|
||||
{}
|
||||
);
|
||||
const myMembershipId = members?.find(({ user }) => user._id === presentUser?._id)?._id;
|
||||
const myMembershipId = members?.find(({ user }) => user.id === presentUser.id)?.id;
|
||||
const isSecretApprovalScreen = Boolean(selectedApproval);
|
||||
|
||||
const handleGoBackSecretRequestDetail = () => {
|
||||
@@ -87,7 +87,7 @@ export const SecretApprovalRequest = () => {
|
||||
<SecretApprovalRequestChanges
|
||||
workspaceId={workspaceId}
|
||||
members={membersGroupById}
|
||||
approvalRequestId={selectedApproval?._id || ""}
|
||||
approvalRequestId={selectedApproval?.id || ""}
|
||||
onGoBack={handleGoBackSecretRequestDetail}
|
||||
committer={membersGroupById?.[selectedApproval?.committer || ""]}
|
||||
/>
|
||||
@@ -169,13 +169,11 @@ export const SecretApprovalRequest = () => {
|
||||
</DropdownMenuTrigger>
|
||||
<DropdownMenuContent align="end">
|
||||
<DropdownMenuLabel>Select an author</DropdownMenuLabel>
|
||||
{members?.map(({ user, _id }) => (
|
||||
{members?.map(({ user, id }) => (
|
||||
<DropdownMenuItem
|
||||
onClick={() =>
|
||||
setCommitterFilter((state) => (state === _id ? undefined : _id))
|
||||
}
|
||||
key={`request-filter-member-${_id}`}
|
||||
icon={committerFilter === _id && <FontAwesomeIcon icon={faCheckCircle} />}
|
||||
onClick={() => setCommitterFilter((state) => (state === id ? undefined : id))}
|
||||
key={`request-filter-member-${id}`}
|
||||
icon={committerFilter === id && <FontAwesomeIcon icon={faCheckCircle} />}
|
||||
iconPos="right"
|
||||
>
|
||||
{user.email}
|
||||
@@ -195,7 +193,7 @@ export const SecretApprovalRequest = () => {
|
||||
<Fragment key={`secret-approval-request-${i + 1}`}>
|
||||
{group?.map((secretApproval) => {
|
||||
const {
|
||||
_id: reqId,
|
||||
id: reqId,
|
||||
commits,
|
||||
committer,
|
||||
createdAt,
|
||||
|
||||
+11
-11
@@ -58,17 +58,17 @@ export const SecretApprovalRequestChangeItem = ({
|
||||
const hasConflict = Boolean(itemConflict);
|
||||
|
||||
return (
|
||||
<div className="bg-bunker-500 rounded-lg pt-2 pb-4 px-4">
|
||||
<div className="py-3 px-1 flex items-center">
|
||||
<div className="rounded-lg bg-bunker-500 px-4 pt-2 pb-4">
|
||||
<div className="flex items-center py-3 px-1">
|
||||
<div className="flex-grow">{generateItemTitle(op)}</div>
|
||||
{!hasMerged && isStale && (
|
||||
<div className="flex items-center">
|
||||
<FontAwesomeIcon icon={faInfo} className="text-primary-600 text-sm" />
|
||||
<span className="text-xs ml-2">Secret has been changed(stale)</span>
|
||||
<FontAwesomeIcon icon={faInfo} className="text-sm text-primary-600" />
|
||||
<span className="ml-2 text-xs">Secret has been changed(stale)</span>
|
||||
</div>
|
||||
)}
|
||||
{hasMerged && hasConflict && (
|
||||
<div className="flex items-center text-sm text-bunker-300 space-x-2">
|
||||
<div className="flex items-center space-x-2 text-sm text-bunker-300">
|
||||
<Tooltip content="Merge Conflict">
|
||||
<FontAwesomeIcon icon={faExclamationTriangle} className="text-red-700" />
|
||||
</Tooltip>
|
||||
@@ -99,11 +99,11 @@ export const SecretApprovalRequestChangeItem = ({
|
||||
<Td>
|
||||
{secretVersion?.tags?.map(({ name, id: tagId, tagColor }) => (
|
||||
<Tag
|
||||
className="flex items-center space-x-2 w-min"
|
||||
className="flex w-min items-center space-x-2"
|
||||
key={`${secretVersion.id}-${tagId}`}
|
||||
>
|
||||
<div
|
||||
className="w-3 h-3 rounded-full"
|
||||
className="h-3 w-3 rounded-full"
|
||||
style={{ backgroundColor: tagColor || "#bec2c8" }}
|
||||
/>
|
||||
<div className="text-sm">{name}</div>
|
||||
@@ -121,11 +121,11 @@ export const SecretApprovalRequestChangeItem = ({
|
||||
<Td>
|
||||
{newVersion?.tags?.map(({ name, id: tagId, tagColor }) => (
|
||||
<Tag
|
||||
className="flex items-center space-x-2 w-min"
|
||||
className="flex w-min items-center space-x-2"
|
||||
key={`${newVersion.id}-${tagId}`}
|
||||
>
|
||||
<div
|
||||
className="w-3 h-3 rounded-full"
|
||||
className="h-3 w-3 rounded-full"
|
||||
style={{ backgroundColor: tagColor || "#bec2c8" }}
|
||||
/>
|
||||
<div className="text-sm">{name}</div>
|
||||
@@ -153,13 +153,13 @@ export const SecretApprovalRequestChangeItem = ({
|
||||
{(op === CommitType.CREATE ? newVersion?.tags : secretVersion?.tags)?.map(
|
||||
({ name, id: tagId, tagColor }) => (
|
||||
<Tag
|
||||
className="flex items-center space-x-2 w-min"
|
||||
className="flex w-min items-center space-x-2"
|
||||
key={`${
|
||||
op === CommitType.CREATE ? newVersion?.id : secretVersion?.id
|
||||
}-${tagId}`}
|
||||
>
|
||||
<div
|
||||
className="w-3 h-3 rounded-full"
|
||||
className="h-3 w-3 rounded-full"
|
||||
style={{ backgroundColor: tagColor || "#bec2c8" }}
|
||||
/>
|
||||
<div className="text-sm">{name}</div>
|
||||
|
||||
+3
-3
@@ -107,7 +107,7 @@ export const SecretApprovalRequestChanges = ({
|
||||
const myMembership = Object.values(members).find(
|
||||
({ user: membershipUser }) => membershipUser.email === user.email
|
||||
);
|
||||
const myMembershipId = myMembership?._id || "";
|
||||
const myMembershipId = myMembership?.id || "";
|
||||
const canApprove = secretApprovalRequestDetails?.policy?.approvers?.includes(myMembershipId);
|
||||
const reviewedMembers = secretApprovalRequestDetails?.reviewers?.reduce<
|
||||
Record<string, ApprovalStatus>
|
||||
@@ -226,7 +226,7 @@ export const SecretApprovalRequestChanges = ({
|
||||
secretVersion={secretVersion}
|
||||
presentSecretVersionNumber={secret?.version || 0}
|
||||
newVersion={newVersion}
|
||||
key={`${op}-${index + 1}-${secretVersion?._id}`}
|
||||
key={`${op}-${index + 1}-${secretVersion?.id}`}
|
||||
/>
|
||||
)
|
||||
)}
|
||||
@@ -234,7 +234,7 @@ export const SecretApprovalRequestChanges = ({
|
||||
<div className="mt-8 flex items-center space-x-6 rounded-lg bg-mineshaft-800 px-5 py-6">
|
||||
<SecretApprovalRequestAction
|
||||
canApprove={canApprove}
|
||||
approvalRequestId={secretApprovalRequestDetails._id}
|
||||
approvalRequestId={secretApprovalRequestDetails.id}
|
||||
hasMerged={hasMerged}
|
||||
approvals={secretApprovalRequestDetails.policy.approvals || 0}
|
||||
status={secretApprovalRequestDetails.status}
|
||||
|
||||
Reference in New Issue
Block a user