mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-08 11:27:47 +00:00
fix styling issues with secret rows
This commit is contained in:
@@ -26,7 +26,8 @@ const replaceContentWithDot = (str: string) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const syntaxHighlight = (orgContent?: string | null, isVisible?: boolean) => {
|
const syntaxHighlight = (orgContent?: string | null, isVisible?: boolean) => {
|
||||||
if (!orgContent) return "";
|
if (orgContent === "") return "EMPTY";
|
||||||
|
if (!orgContent) return "missing";
|
||||||
if (!isVisible) return replaceContentWithDot(orgContent);
|
if (!isVisible) return replaceContentWithDot(orgContent);
|
||||||
const content = stripSpanTags(orgContent);
|
const content = stripSpanTags(orgContent);
|
||||||
const newContent = content.replace(
|
const newContent = content.replace(
|
||||||
@@ -69,7 +70,7 @@ export const SecretInput = ({
|
|||||||
dangerouslySetInnerHTML={{
|
dangerouslySetInnerHTML={{
|
||||||
__html: syntaxHighlight(value, isVisible || isSecretFocused)
|
__html: syntaxHighlight(value, isVisible || isSecretFocused)
|
||||||
}}
|
}}
|
||||||
className="absolute top-0 left-0 z-0 h-full w-full text-ellipsis whitespace-pre-line break-all"
|
className={`absolute top-0 left-0 z-0 h-full w-full text-ellipsis whitespace-pre-line break-all ${!value && value !== "" && "text-red-600 italic"}`}
|
||||||
/>
|
/>
|
||||||
<ContentEditable
|
<ContentEditable
|
||||||
className="relative z-10 h-full w-full text-ellipsis whitespace-pre-line break-all text-transparent caret-white outline-none"
|
className="relative z-10 h-full w-full text-ellipsis whitespace-pre-line break-all text-transparent caret-white outline-none"
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ export const Tooltip = ({
|
|||||||
...props
|
...props
|
||||||
}: TooltipProps) => (
|
}: TooltipProps) => (
|
||||||
<TooltipPrimitive.Root
|
<TooltipPrimitive.Root
|
||||||
delayDuration={150}
|
delayDuration={50}
|
||||||
open={isOpen}
|
open={isOpen}
|
||||||
defaultOpen={defaultOpen}
|
defaultOpen={defaultOpen}
|
||||||
onOpenChange={onOpenChange}
|
onOpenChange={onOpenChange}
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ export const FolderSection = memo(
|
|||||||
className="group flex cursor-default flex-row items-center hover:bg-mineshaft-700"
|
className="group flex cursor-default flex-row items-center hover:bg-mineshaft-700"
|
||||||
>
|
>
|
||||||
<td className="ml-0.5 flex h-10 w-10 items-center justify-center border-none px-4">
|
<td className="ml-0.5 flex h-10 w-10 items-center justify-center border-none px-4">
|
||||||
<FontAwesomeIcon icon={faFolder} className="text-primary-700" />
|
<FontAwesomeIcon icon={faFolder} className="text-yellow-700" />
|
||||||
</td>
|
</td>
|
||||||
<td
|
<td
|
||||||
colSpan={2}
|
colSpan={2}
|
||||||
|
|||||||
+2
-2
@@ -26,7 +26,7 @@ export const EnvFolderIcon = ({ env, secretPath }: { env: string; secretPath: st
|
|||||||
<div style={{ minWidth: "96px" }}>{env || "-"}</div>
|
<div style={{ minWidth: "96px" }}>{env || "-"}</div>
|
||||||
{secretPath && (
|
{secretPath && (
|
||||||
<div className="inline-flex items-center space-x-2 border-l border-mineshaft-600 pl-2">
|
<div className="inline-flex items-center space-x-2 border-l border-mineshaft-600 pl-2">
|
||||||
<FontAwesomeIcon icon={faFolder} size="lg" className="text-primary-700" />
|
<FontAwesomeIcon icon={faFolder} className="text-green-700 text-md" />
|
||||||
<span>{secretPath}</span>
|
<span>{secretPath}</span>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
@@ -66,7 +66,7 @@ export const SecretImportItem = ({
|
|||||||
onClick={() => setIsExpanded.toggle()}
|
onClick={() => setIsExpanded.toggle()}
|
||||||
>
|
>
|
||||||
<td className="ml-0.5 flex h-10 w-10 items-center justify-center border-none px-4">
|
<td className="ml-0.5 flex h-10 w-10 items-center justify-center border-none px-4">
|
||||||
<FontAwesomeIcon icon={faFileImport} className="text-primary-700" />
|
<FontAwesomeIcon icon={faFileImport} className="text-green-700" />
|
||||||
</td>
|
</td>
|
||||||
<td
|
<td
|
||||||
colSpan={2}
|
colSpan={2}
|
||||||
|
|||||||
@@ -261,7 +261,7 @@ export const SecretOverviewPage = () => {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="thin-scrollbar mt-4 max-h-[calc(100vh-250px)] overflow-y-auto" ref={parentTableRef}>
|
<div className="thin-scrollbar mt-4 max-h-[calc(100vh-250px)] overflow-y-auto" ref={parentTableRef}>
|
||||||
<TableContainer>
|
<TableContainer className="sticky top-0">
|
||||||
<Table>
|
<Table>
|
||||||
<THead className="sticky top-0">
|
<THead className="sticky top-0">
|
||||||
<Tr>
|
<Tr>
|
||||||
|
|||||||
+1
-1
@@ -33,7 +33,7 @@ export const FolderBreadCrumbs = ({ secretPath = "/", onResetSearch }: Props) =>
|
|||||||
role="button"
|
role="button"
|
||||||
tabIndex={0}
|
tabIndex={0}
|
||||||
>
|
>
|
||||||
<FontAwesomeIcon icon={faFolderOpen} className="text-primary" />
|
<FontAwesomeIcon icon={faFolderOpen} className="text-primary-700" />
|
||||||
</div>
|
</div>
|
||||||
{(secretPath || "")
|
{(secretPath || "")
|
||||||
.split("/")
|
.split("/")
|
||||||
|
|||||||
+1
-1
@@ -63,7 +63,7 @@ export const SecretEditRow = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleFormSubmit = async ({ value }: { value?: string | null }) => {
|
const handleFormSubmit = async ({ value }: { value?: string | null }) => {
|
||||||
if (value && secretName) {
|
if ((value || value === "") && secretName) {
|
||||||
if (isCreatable) {
|
if (isCreatable) {
|
||||||
await onSecretCreate(environment, secretName, value);
|
await onSecretCreate(environment, secretName, value);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
+23
-16
@@ -1,9 +1,9 @@
|
|||||||
import { faCircle } from "@fortawesome/free-regular-svg-icons";
|
import { faCircle } from "@fortawesome/free-regular-svg-icons";
|
||||||
import { faCheck, faEye, faEyeSlash, faKey, faXmark } from "@fortawesome/free-solid-svg-icons";
|
import { faAngleDown, faCheck, faEye, faEyeSlash, faKey, faXmark } from "@fortawesome/free-solid-svg-icons";
|
||||||
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
||||||
import { twMerge } from "tailwind-merge";
|
import { twMerge } from "tailwind-merge";
|
||||||
|
|
||||||
import { Button, TableContainer, Td, Tr } from "@app/components/v2";
|
import { Button, TableContainer, Td, Tooltip, Tr } from "@app/components/v2";
|
||||||
import { useToggle } from "@app/hooks";
|
import { useToggle } from "@app/hooks";
|
||||||
import { DecryptedSecret } from "@app/hooks/api/secrets/types";
|
import { DecryptedSecret } from "@app/hooks/api/secrets/types";
|
||||||
|
|
||||||
@@ -35,12 +35,14 @@ export const SecretOverviewTableRow = ({
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Tr isHoverable isSelectable onClick={() => setIsFormExpanded.toggle()} className="group">
|
<Tr isHoverable isSelectable onClick={() => setIsFormExpanded.toggle()} className="group">
|
||||||
<Td className="sticky left-0 z-10 border-x border-mineshaft-700 bg-mineshaft-800 bg-clip-padding py-2.5 group-hover:bg-mineshaft-700">
|
<Td className={`sticky left-0 py-0 px-0 z-10 bg-mineshaft-800 bg-clip-padding group-hover:bg-mineshaft-700 ${isFormExpanded && "border-t-2 border-mineshaft-500"}`}>
|
||||||
<div className="flex items-center space-x-5">
|
<div className="w-full h-full border-x border-mineshaft-700 py-2.5 px-5">
|
||||||
<div className="text-blue-300/70">
|
<div className="flex items-center space-x-5">
|
||||||
<FontAwesomeIcon icon={faKey} />
|
<div className="text-blue-300/70">
|
||||||
|
<FontAwesomeIcon icon={isFormExpanded ? faAngleDown : faKey} />
|
||||||
|
</div>
|
||||||
|
<div>{secretKey}</div>
|
||||||
</div>
|
</div>
|
||||||
<div>{secretKey}</div>
|
|
||||||
</div>
|
</div>
|
||||||
</Td>
|
</Td>
|
||||||
{environments.map(({ slug }, i) => {
|
{environments.map(({ slug }, i) => {
|
||||||
@@ -51,15 +53,20 @@ export const SecretOverviewTableRow = ({
|
|||||||
<Td
|
<Td
|
||||||
key={`sec-overview-${slug}-${i + 1}-value`}
|
key={`sec-overview-${slug}-${i + 1}-value`}
|
||||||
className={twMerge(
|
className={twMerge(
|
||||||
"border-x border-mineshaft-600 py-3 group-hover:bg-mineshaft-700",
|
"py-0 px-0 group-hover:bg-mineshaft-700",
|
||||||
|
isFormExpanded && "border-t-2 border-mineshaft-500",
|
||||||
isSecretPresent && !isSecretEmpty ? "text-green-600" : "",
|
isSecretPresent && !isSecretEmpty ? "text-green-600" : "",
|
||||||
isSecretPresent && isSecretEmpty ? "text-yellow" : "",
|
isSecretPresent && isSecretEmpty ? "text-yellow" : "",
|
||||||
!isSecretPresent && !isSecretEmpty ? "text-red-600" : ""
|
!isSecretPresent && !isSecretEmpty ? "text-red-600" : ""
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
<div className="flex justify-center">
|
<div className="w-full h-full py-[0.85rem] px-5 border-r border-mineshaft-600">
|
||||||
{!isSecretEmpty && <FontAwesomeIcon icon={!isSecretPresent ? faCheck : faXmark} />}
|
<div className="flex justify-center">
|
||||||
{isSecretEmpty && <FontAwesomeIcon icon={faCircle} />}
|
{!isSecretEmpty && <FontAwesomeIcon icon={isSecretPresent ? faCheck : faXmark} />}
|
||||||
|
{isSecretEmpty && <Tooltip content="Empty value">
|
||||||
|
<FontAwesomeIcon icon={faCircle} />
|
||||||
|
</Tooltip>}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</Td>
|
</Td>
|
||||||
);
|
);
|
||||||
@@ -67,14 +74,14 @@ export const SecretOverviewTableRow = ({
|
|||||||
</Tr>
|
</Tr>
|
||||||
{isFormExpanded && (
|
{isFormExpanded && (
|
||||||
<Tr>
|
<Tr>
|
||||||
<Td colSpan={totalCols}>
|
<Td colSpan={totalCols} className={`px-0 py-0 ${isFormExpanded && "border-b-2 border-mineshaft-500"}`}>
|
||||||
<div
|
<div
|
||||||
className="rounded-md bg-bunker-700 p-2"
|
className="rounded-md bg-bunker-600 p-2"
|
||||||
style={{
|
style={{
|
||||||
width: `calc(${expandableColWidth}px - 2rem)`,
|
width: `calc(${expandableColWidth}px - 2rem)`,
|
||||||
position: "sticky",
|
// position: "sticky",
|
||||||
left: "1.25rem",
|
// left: "1.25rem",
|
||||||
right: "1.25rem"
|
// right: "1.25rem"
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<TableContainer>
|
<TableContainer>
|
||||||
|
|||||||
Reference in New Issue
Block a user