mirror of
https://github.com/Infisical/infisical.git
synced 2025-07-02 16:55:02 +00:00
Compare commits
3 Commits
secret-syn
...
overview-u
Author | SHA1 | Date | |
---|---|---|---|
e8d19eb823 | |||
5d30215ea7 | |||
86c145301e |
@ -1,5 +1,6 @@
|
|||||||
import { ReactNode } from "react";
|
import { ReactNode } from "react";
|
||||||
import * as TooltipPrimitive from "@radix-ui/react-tooltip";
|
import * as TooltipPrimitive from "@radix-ui/react-tooltip";
|
||||||
|
import { TooltipProps as RootProps } from "@radix-ui/react-tooltip";
|
||||||
import { twMerge } from "tailwind-merge";
|
import { twMerge } from "tailwind-merge";
|
||||||
|
|
||||||
export type TooltipProps = Omit<TooltipPrimitive.TooltipContentProps, "open" | "content"> & {
|
export type TooltipProps = Omit<TooltipPrimitive.TooltipContentProps, "open" | "content"> & {
|
||||||
@ -14,6 +15,7 @@ export type TooltipProps = Omit<TooltipPrimitive.TooltipContentProps, "open" | "
|
|||||||
isDisabled?: boolean;
|
isDisabled?: boolean;
|
||||||
center?: boolean;
|
center?: boolean;
|
||||||
size?: "sm" | "md";
|
size?: "sm" | "md";
|
||||||
|
rootProps?: RootProps;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const Tooltip = ({
|
export const Tooltip = ({
|
||||||
@ -28,12 +30,14 @@ export const Tooltip = ({
|
|||||||
isDisabled,
|
isDisabled,
|
||||||
position = "top",
|
position = "top",
|
||||||
size = "md",
|
size = "md",
|
||||||
|
rootProps,
|
||||||
...props
|
...props
|
||||||
}: TooltipProps) =>
|
}: TooltipProps) =>
|
||||||
// just render children if tooltip content is empty
|
// just render children if tooltip content is empty
|
||||||
content ? (
|
content ? (
|
||||||
<TooltipPrimitive.Root
|
<TooltipPrimitive.Root
|
||||||
delayDuration={50}
|
delayDuration={50}
|
||||||
|
{...rootProps}
|
||||||
open={isOpen}
|
open={isOpen}
|
||||||
defaultOpen={defaultOpen}
|
defaultOpen={defaultOpen}
|
||||||
onOpenChange={onOpenChange}
|
onOpenChange={onOpenChange}
|
||||||
|
@ -6,6 +6,9 @@ import { faCheckCircle } from "@fortawesome/free-regular-svg-icons";
|
|||||||
import {
|
import {
|
||||||
faAngleDown,
|
faAngleDown,
|
||||||
faArrowDown,
|
faArrowDown,
|
||||||
|
faArrowLeft,
|
||||||
|
faArrowRight,
|
||||||
|
faArrowRightToBracket,
|
||||||
faArrowUp,
|
faArrowUp,
|
||||||
faFileImport,
|
faFileImport,
|
||||||
faFingerprint,
|
faFingerprint,
|
||||||
@ -69,7 +72,7 @@ import {
|
|||||||
PreferenceKey,
|
PreferenceKey,
|
||||||
setUserTablePreference
|
setUserTablePreference
|
||||||
} from "@app/helpers/userTablePreferences";
|
} from "@app/helpers/userTablePreferences";
|
||||||
import { useDebounce, usePagination, usePopUp, useResetPageHelper } from "@app/hooks";
|
import { useDebounce, usePagination, usePopUp, useResetPageHelper, useToggle } from "@app/hooks";
|
||||||
import {
|
import {
|
||||||
useCreateFolder,
|
useCreateFolder,
|
||||||
useCreateSecretV3,
|
useCreateSecretV3,
|
||||||
@ -164,6 +167,18 @@ export const OverviewPage = () => {
|
|||||||
const [debouncedSearchFilter, setDebouncedSearchFilter] = useDebounce(searchFilter);
|
const [debouncedSearchFilter, setDebouncedSearchFilter] = useDebounce(searchFilter);
|
||||||
const secretPath = (routerSearch?.secretPath as string) || "/";
|
const secretPath = (routerSearch?.secretPath as string) || "/";
|
||||||
const { subscription } = useSubscription();
|
const { subscription } = useSubscription();
|
||||||
|
const [collapseEnvironments, setCollapseEnvironments] = useToggle(
|
||||||
|
Boolean(localStorage.getItem("overview-collapse-environments"))
|
||||||
|
);
|
||||||
|
|
||||||
|
const handleToggleNarrowHeader = () => {
|
||||||
|
setCollapseEnvironments.toggle();
|
||||||
|
if (collapseEnvironments) {
|
||||||
|
localStorage.removeItem("overview-collapse-environments");
|
||||||
|
} else {
|
||||||
|
localStorage.setItem("overview-collapse-environments", "true");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const [filter, setFilter] = useState<Filter>(DEFAULT_FILTER_STATE);
|
const [filter, setFilter] = useState<Filter>(DEFAULT_FILTER_STATE);
|
||||||
const [filterHistory, setFilterHistory] = useState<
|
const [filterHistory, setFilterHistory] = useState<
|
||||||
@ -1173,10 +1188,25 @@ export const OverviewPage = () => {
|
|||||||
className="thin-scrollbar rounded-b-none"
|
className="thin-scrollbar rounded-b-none"
|
||||||
>
|
>
|
||||||
<Table>
|
<Table>
|
||||||
<THead>
|
<THead className={collapseEnvironments ? "h-24" : ""}>
|
||||||
<Tr className="sticky top-0 z-20 border-0">
|
<Tr
|
||||||
<Th className="sticky left-0 z-20 min-w-[20rem] border-b-0 p-0">
|
className={twMerge("sticky top-0 z-20 border-0", collapseEnvironments && "h-24")}
|
||||||
<div className="flex items-center border-b border-r border-mineshaft-600 pb-3 pl-3 pr-5 pt-3.5">
|
>
|
||||||
|
<Th
|
||||||
|
className={twMerge(
|
||||||
|
"sticky left-0 z-20 min-w-[20rem] border-b-0 p-0",
|
||||||
|
collapseEnvironments && "h-24"
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
className={twMerge(
|
||||||
|
"flex h-full border-b border-mineshaft-600 pb-3 pl-3 pr-5",
|
||||||
|
!collapseEnvironments && "border-r pt-3.5"
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
className={twMerge("flex items-center", collapseEnvironments && "mt-auto")}
|
||||||
|
>
|
||||||
<Tooltip
|
<Tooltip
|
||||||
className="max-w-[20rem] whitespace-nowrap capitalize"
|
className="max-w-[20rem] whitespace-nowrap capitalize"
|
||||||
content={
|
content={
|
||||||
@ -1215,6 +1245,25 @@ export const OverviewPage = () => {
|
|||||||
/>
|
/>
|
||||||
</IconButton>
|
</IconButton>
|
||||||
</div>
|
</div>
|
||||||
|
<Tooltip
|
||||||
|
content={
|
||||||
|
collapseEnvironments ? "Expand Environments" : "Collapse Environments"
|
||||||
|
}
|
||||||
|
className="capitalize"
|
||||||
|
>
|
||||||
|
<IconButton
|
||||||
|
ariaLabel="Toggle Environment View"
|
||||||
|
variant="plain"
|
||||||
|
colorSchema="secondary"
|
||||||
|
className="ml-auto mt-auto h-min p-1"
|
||||||
|
onClick={handleToggleNarrowHeader}
|
||||||
|
>
|
||||||
|
<FontAwesomeIcon
|
||||||
|
icon={collapseEnvironments ? faArrowLeft : faArrowRight}
|
||||||
|
/>
|
||||||
|
</IconButton>
|
||||||
|
</Tooltip>
|
||||||
|
</div>
|
||||||
</Th>
|
</Th>
|
||||||
{visibleEnvs?.map(({ name, slug }, index) => {
|
{visibleEnvs?.map(({ name, slug }, index) => {
|
||||||
const envSecKeyCount = getEnvSecretKeyCount(slug);
|
const envSecKeyCount = getEnvSecretKeyCount(slug);
|
||||||
@ -1223,18 +1272,65 @@ export const OverviewPage = () => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Th
|
<Th
|
||||||
className="min-table-row min-w-[11rem] border-b-0 p-0 text-center"
|
className={twMerge(
|
||||||
|
"min-table-row border-b-0 p-0 text-xs",
|
||||||
|
collapseEnvironments && index === visibleEnvs.length - 1 && "mr-8",
|
||||||
|
collapseEnvironments ? "h-24 w-[1rem]" : "min-w-[11rem] text-center"
|
||||||
|
)}
|
||||||
key={`secret-overview-${name}-${index + 1}`}
|
key={`secret-overview-${name}-${index + 1}`}
|
||||||
>
|
>
|
||||||
<div className="flex items-center justify-center border-b border-mineshaft-600 px-5 pb-[0.83rem] pt-3.5">
|
<Tooltip
|
||||||
|
content={
|
||||||
|
collapseEnvironments ? (
|
||||||
|
<p className="whitespace-break-spaces">{name}</p>
|
||||||
|
) : (
|
||||||
|
""
|
||||||
|
)
|
||||||
|
}
|
||||||
|
side="bottom"
|
||||||
|
sideOffset={-1}
|
||||||
|
align="end"
|
||||||
|
className="max-w-xl text-xs normal-case"
|
||||||
|
rootProps={{
|
||||||
|
disableHoverableContent: true
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
className={twMerge(
|
||||||
|
"border-b border-mineshaft-600",
|
||||||
|
collapseEnvironments
|
||||||
|
? "relative h-24 w-[2.9rem]"
|
||||||
|
: "flex items-center justify-center px-5 pb-[0.82rem] pt-3.5",
|
||||||
|
collapseEnvironments &&
|
||||||
|
index === visibleEnvs.length - 1 &&
|
||||||
|
"overflow-clip"
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
className={twMerge(
|
||||||
|
"border-mineshaft-600",
|
||||||
|
collapseEnvironments
|
||||||
|
? "ml-[0.85rem] h-24 -skew-x-[16rad] transform border-l text-xs"
|
||||||
|
: "flex items-center justify-center"
|
||||||
|
)}
|
||||||
|
/>
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
className="text-sm font-medium duration-100 hover:text-mineshaft-100"
|
className={twMerge(
|
||||||
|
"duration-100 hover:text-mineshaft-100",
|
||||||
|
collapseEnvironments &&
|
||||||
|
(index === visibleEnvs.length - 1
|
||||||
|
? "bottom-[1.75rem] w-14"
|
||||||
|
: "bottom-10 w-20"),
|
||||||
|
collapseEnvironments
|
||||||
|
? "absolute -rotate-[72.25deg] text-left !text-[12px] font-normal"
|
||||||
|
: "flex items-center text-center text-sm font-medium"
|
||||||
|
)}
|
||||||
onClick={() => handleExploreEnvClick(slug)}
|
onClick={() => handleExploreEnvClick(slug)}
|
||||||
>
|
>
|
||||||
{name}
|
<p className="truncate font-medium">{name}</p>
|
||||||
</button>
|
</button>
|
||||||
{missingKeyCount > 0 && (
|
{!collapseEnvironments && missingKeyCount > 0 && (
|
||||||
<Tooltip
|
<Tooltip
|
||||||
className="max-w-none lowercase"
|
className="max-w-none lowercase"
|
||||||
content={`${missingKeyCount} secrets missing\n compared to other environments`}
|
content={`${missingKeyCount} secrets missing\n compared to other environments`}
|
||||||
@ -1245,6 +1341,7 @@ export const OverviewPage = () => {
|
|||||||
</Tooltip>
|
</Tooltip>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
</Tooltip>
|
||||||
</Th>
|
</Th>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
@ -1409,16 +1506,40 @@ export const OverviewPage = () => {
|
|||||||
/>
|
/>
|
||||||
</Td>
|
</Td>
|
||||||
{visibleEnvs?.map(({ name, slug }) => (
|
{visibleEnvs?.map(({ name, slug }) => (
|
||||||
<Td key={`explore-${name}-btn`} className="border-0 border-mineshaft-600 p-0">
|
<Td
|
||||||
<div className="flex w-full items-center justify-center border-r border-t border-mineshaft-600 px-5 py-2">
|
key={`explore-${name}-btn`}
|
||||||
<Button
|
className="border-0 border-r border-mineshaft-600 p-0"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
className={twMerge(
|
||||||
|
"flex w-full items-center justify-center border-t border-mineshaft-600 py-2"
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
{collapseEnvironments ? (
|
||||||
|
<Tooltip className="normal-case" content="Explore Environment">
|
||||||
|
<IconButton
|
||||||
|
ariaLabel="Explore Environment"
|
||||||
size="xs"
|
size="xs"
|
||||||
variant="outline_bg"
|
variant="outline_bg"
|
||||||
isFullWidth
|
className="mx-auto h-[1.76rem] rounded"
|
||||||
|
onClick={() => handleExploreEnvClick(slug)}
|
||||||
|
>
|
||||||
|
<FontAwesomeIcon icon={faArrowRightToBracket} />
|
||||||
|
</IconButton>
|
||||||
|
</Tooltip>
|
||||||
|
) : (
|
||||||
|
<Button
|
||||||
|
leftIcon={
|
||||||
|
<FontAwesomeIcon className="mr-1" icon={faArrowRightToBracket} />
|
||||||
|
}
|
||||||
|
variant="outline_bg"
|
||||||
|
size="xs"
|
||||||
|
className="mx-2 w-full"
|
||||||
onClick={() => handleExploreEnvClick(slug)}
|
onClick={() => handleExploreEnvClick(slug)}
|
||||||
>
|
>
|
||||||
Explore
|
Explore
|
||||||
</Button>
|
</Button>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</Td>
|
</Td>
|
||||||
))}
|
))}
|
||||||
|
@ -36,7 +36,7 @@ export const SecretOverviewDynamicSecretRow = ({
|
|||||||
isPresent ? "text-green-600" : "text-red-600"
|
isPresent ? "text-green-600" : "text-red-600"
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
<div className="flex justify-center">
|
<div className="mx-auto flex w-[0.03rem] justify-center">
|
||||||
<FontAwesomeIcon
|
<FontAwesomeIcon
|
||||||
// eslint-disable-next-line no-nested-ternary
|
// eslint-disable-next-line no-nested-ternary
|
||||||
icon={isPresent ? faCheck : faXmark}
|
icon={isPresent ? faCheck : faXmark}
|
||||||
|
@ -70,7 +70,7 @@ export const SecretOverviewFolderRow = ({
|
|||||||
isPresent ? "text-green-600" : "text-red-600"
|
isPresent ? "text-green-600" : "text-red-600"
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
<div className="flex justify-center">
|
<div className="mx-auto flex w-[0.03rem] justify-center">
|
||||||
<FontAwesomeIcon
|
<FontAwesomeIcon
|
||||||
// eslint-disable-next-line no-nested-ternary
|
// eslint-disable-next-line no-nested-ternary
|
||||||
icon={isPresent ? faCheck : faXmark}
|
icon={isPresent ? faCheck : faXmark}
|
||||||
|
@ -94,7 +94,7 @@ export const SecretOverviewSecretRotationRow = ({
|
|||||||
isPresent ? "text-green-600" : "text-red-600"
|
isPresent ? "text-green-600" : "text-red-600"
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
<div className="flex justify-center">
|
<div className="mx-auto flex w-[0.03rem] justify-center">
|
||||||
<FontAwesomeIcon
|
<FontAwesomeIcon
|
||||||
// eslint-disable-next-line no-nested-ternary
|
// eslint-disable-next-line no-nested-ternary
|
||||||
icon={isPresent ? faCheck : faXmark}
|
icon={isPresent ? faCheck : faXmark}
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import { subject } from "@casl/ability";
|
import { subject } from "@casl/ability";
|
||||||
import { faCircle } from "@fortawesome/free-regular-svg-icons";
|
|
||||||
import {
|
import {
|
||||||
faAngleDown,
|
faAngleDown,
|
||||||
faCheck,
|
faCheck,
|
||||||
|
faCircle,
|
||||||
faCodeBranch,
|
faCodeBranch,
|
||||||
faEye,
|
faEye,
|
||||||
faEyeSlash,
|
faEyeSlash,
|
||||||
@ -145,14 +145,14 @@ export const SecretOverviewTableRow = ({
|
|||||||
<Td
|
<Td
|
||||||
key={`sec-overview-${slug}-${i + 1}-value`}
|
key={`sec-overview-${slug}-${i + 1}-value`}
|
||||||
className={twMerge(
|
className={twMerge(
|
||||||
"px-0 py-0 group-hover:bg-mineshaft-700",
|
"border-r border-mineshaft-600 px-0 py-3 group-hover:bg-mineshaft-700",
|
||||||
isFormExpanded && "border-t-2 border-mineshaft-500",
|
isFormExpanded && "border-t-2 border-mineshaft-500",
|
||||||
(isSecretPresent && !isSecretEmpty) || isSecretImported ? "text-green-600" : "",
|
(isSecretPresent && !isSecretEmpty) || isSecretImported ? "text-green-600" : "",
|
||||||
isSecretPresent && isSecretEmpty && !isSecretImported ? "text-yellow" : "",
|
isSecretPresent && isSecretEmpty && !isSecretImported ? "text-yellow" : "",
|
||||||
!isSecretPresent && !isSecretEmpty && !isSecretImported ? "text-red-600" : ""
|
!isSecretPresent && !isSecretEmpty && !isSecretImported ? "text-red-600" : ""
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
<div className="h-full w-full border-r border-mineshaft-600 px-5 py-[0.85rem]">
|
<div className="mx-auto flex w-[0.03rem] justify-center">
|
||||||
<div className="flex justify-center">
|
<div className="flex justify-center">
|
||||||
{!isSecretEmpty && (
|
{!isSecretEmpty && (
|
||||||
<Tooltip
|
<Tooltip
|
||||||
|
Reference in New Issue
Block a user