mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-07 08:27:36 +00:00
improvement: add merge/closed status badge to closed secret change request table
This commit is contained in:
@@ -43,6 +43,7 @@ export type TSecretApprovalRequest = {
|
|||||||
isReplicated?: boolean;
|
isReplicated?: boolean;
|
||||||
slug: string;
|
slug: string;
|
||||||
createdAt: string;
|
createdAt: string;
|
||||||
|
updatedAt: string;
|
||||||
committerUserId: string;
|
committerUserId: string;
|
||||||
reviewers: {
|
reviewers: {
|
||||||
userId: string;
|
userId: string;
|
||||||
|
|||||||
+48
-27
@@ -6,16 +6,19 @@ import {
|
|||||||
faCheckCircle,
|
faCheckCircle,
|
||||||
faChevronDown,
|
faChevronDown,
|
||||||
faCodeBranch,
|
faCodeBranch,
|
||||||
|
faCodeMerge,
|
||||||
faMagnifyingGlass,
|
faMagnifyingGlass,
|
||||||
faSearch
|
faSearch,
|
||||||
|
faXmark
|
||||||
} from "@fortawesome/free-solid-svg-icons";
|
} from "@fortawesome/free-solid-svg-icons";
|
||||||
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
||||||
import { useSearch } from "@tanstack/react-router";
|
import { useSearch } from "@tanstack/react-router";
|
||||||
import { formatDistance } from "date-fns";
|
import { format, formatDistance } from "date-fns";
|
||||||
import { AnimatePresence, motion } from "framer-motion";
|
import { AnimatePresence, motion } from "framer-motion";
|
||||||
import { twMerge } from "tailwind-merge";
|
import { twMerge } from "tailwind-merge";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
Badge,
|
||||||
Button,
|
Button,
|
||||||
DropdownMenu,
|
DropdownMenu,
|
||||||
DropdownMenuContent,
|
DropdownMenuContent,
|
||||||
@@ -25,7 +28,8 @@ import {
|
|||||||
EmptyState,
|
EmptyState,
|
||||||
Input,
|
Input,
|
||||||
Pagination,
|
Pagination,
|
||||||
Skeleton
|
Skeleton,
|
||||||
|
Tooltip
|
||||||
} from "@app/components/v2";
|
} from "@app/components/v2";
|
||||||
import { ROUTE_PATHS } from "@app/const/routes";
|
import { ROUTE_PATHS } from "@app/const/routes";
|
||||||
import {
|
import {
|
||||||
@@ -308,7 +312,9 @@ export const SecretApprovalRequest = () => {
|
|||||||
createdAt,
|
createdAt,
|
||||||
reviewers,
|
reviewers,
|
||||||
status,
|
status,
|
||||||
committerUser
|
committerUser,
|
||||||
|
hasMerged,
|
||||||
|
updatedAt
|
||||||
} = secretApproval;
|
} = secretApproval;
|
||||||
const isReviewed = reviewers.some(
|
const isReviewed = reviewers.some(
|
||||||
({ status: reviewStatus, userId }) =>
|
({ status: reviewStatus, userId }) =>
|
||||||
@@ -317,7 +323,7 @@ export const SecretApprovalRequest = () => {
|
|||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
key={reqId}
|
key={reqId}
|
||||||
className="flex flex-col border-b border-mineshaft-600 px-8 py-3 last:border-b-0 hover:bg-mineshaft-700"
|
className="flex border-b border-mineshaft-600 px-8 py-3 last:border-b-0 hover:bg-mineshaft-700"
|
||||||
role="button"
|
role="button"
|
||||||
tabIndex={0}
|
tabIndex={0}
|
||||||
onClick={() => setSelectedApprovalId(secretApproval.id)}
|
onClick={() => setSelectedApprovalId(secretApproval.id)}
|
||||||
@@ -325,29 +331,44 @@ export const SecretApprovalRequest = () => {
|
|||||||
if (evt.key === "Enter") setSelectedApprovalId(secretApproval.id);
|
if (evt.key === "Enter") setSelectedApprovalId(secretApproval.id);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<div className="mb-1 text-sm">
|
<div className="flex flex-col">
|
||||||
<FontAwesomeIcon
|
<div className="mb-1 text-sm">
|
||||||
icon={faCodeBranch}
|
<FontAwesomeIcon
|
||||||
size="sm"
|
icon={faCodeBranch}
|
||||||
className="mr-1.5 text-mineshaft-300"
|
size="sm"
|
||||||
/>
|
className="mr-1.5 text-mineshaft-300"
|
||||||
{secretApproval.isReplicated
|
/>
|
||||||
? `${commits.length} secret pending import`
|
{secretApproval.isReplicated
|
||||||
: generateCommitText(commits)}
|
? `${commits.length} secret pending import`
|
||||||
<span className="text-xs text-bunker-300"> #{secretApproval.slug}</span>
|
: generateCommitText(commits)}
|
||||||
|
<span className="text-xs text-bunker-300"> #{secretApproval.slug}</span>
|
||||||
|
</div>
|
||||||
|
<span className="text-xs leading-3 text-gray-500">
|
||||||
|
Opened {formatDistance(new Date(createdAt), new Date())} ago by{" "}
|
||||||
|
{committerUser ? (
|
||||||
|
<>
|
||||||
|
{committerUser?.firstName || ""} {committerUser?.lastName || ""} (
|
||||||
|
{committerUser?.email})
|
||||||
|
</>
|
||||||
|
) : (
|
||||||
|
<span className="text-gray-600">Deleted User</span>
|
||||||
|
)}
|
||||||
|
{!isReviewed && status === "open" && " - Review required"}
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<span className="text-xs leading-3 text-gray-500">
|
{status === "close" && (
|
||||||
Opened {formatDistance(new Date(createdAt), new Date())} ago by{" "}
|
<Tooltip content={format(updatedAt, "M/dd/yyyy h:mm a")}>
|
||||||
{committerUser ? (
|
<div className="my-auto ml-auto">
|
||||||
<>
|
<Badge
|
||||||
{committerUser?.firstName || ""} {committerUser?.lastName || ""} (
|
variant={hasMerged ? "success" : "danger"}
|
||||||
{committerUser?.email})
|
className="flex h-min items-center gap-1"
|
||||||
</>
|
>
|
||||||
) : (
|
<FontAwesomeIcon icon={hasMerged ? faCodeMerge : faXmark} />
|
||||||
<span className="text-gray-600">Deleted User</span>
|
{hasMerged ? "Merged" : "Closed"}
|
||||||
)}
|
</Badge>
|
||||||
{!isReviewed && status === "open" && " - Review required"}
|
</div>
|
||||||
</span>
|
</Tooltip>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
|
|||||||
Reference in New Issue
Block a user