mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-09-22 13:39:35 +00:00
misc: add copy to clipboard
This commit is contained in:
@@ -4,7 +4,9 @@ import {
|
|||||||
faArrowUp,
|
faArrowUp,
|
||||||
faArrowUpRightFromSquare,
|
faArrowUpRightFromSquare,
|
||||||
faCancel,
|
faCancel,
|
||||||
|
faCheck,
|
||||||
faCheckCircle,
|
faCheckCircle,
|
||||||
|
faCopy,
|
||||||
faEdit,
|
faEdit,
|
||||||
faEllipsis,
|
faEllipsis,
|
||||||
faInfoCircle,
|
faInfoCircle,
|
||||||
@@ -50,7 +52,7 @@ import {
|
|||||||
useProjectPermission,
|
useProjectPermission,
|
||||||
useWorkspace
|
useWorkspace
|
||||||
} from "@app/context";
|
} from "@app/context";
|
||||||
import { usePagination, usePopUp, useResetPageHelper } from "@app/hooks";
|
import { usePagination, usePopUp, useResetPageHelper, useTimedReset } from "@app/hooks";
|
||||||
import { useGetCmeksByProjectId, useUpdateCmek } from "@app/hooks/api/cmeks";
|
import { useGetCmeksByProjectId, useUpdateCmek } from "@app/hooks/api/cmeks";
|
||||||
import { CmekOrderBy, TCmek } from "@app/hooks/api/cmeks/types";
|
import { CmekOrderBy, TCmek } from "@app/hooks/api/cmeks/types";
|
||||||
import { OrderByDirection } from "@app/hooks/api/generic/types";
|
import { OrderByDirection } from "@app/hooks/api/generic/types";
|
||||||
@@ -113,6 +115,11 @@ export const CmekTable = () => {
|
|||||||
setPage
|
setPage
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const [, isCopyingCiphertext, setCopyCipherText] = useTimedReset<string>({
|
||||||
|
initialState: "",
|
||||||
|
delay: 1000
|
||||||
|
});
|
||||||
|
|
||||||
const { popUp, handlePopUpOpen, handlePopUpToggle } = usePopUp([
|
const { popUp, handlePopUpOpen, handlePopUpToggle } = usePopUp([
|
||||||
"upsertKey",
|
"upsertKey",
|
||||||
"deleteKey",
|
"deleteKey",
|
||||||
@@ -251,7 +258,13 @@ export const CmekTable = () => {
|
|||||||
const { variant, label } = getStatusBadgeProps(isDisabled);
|
const { variant, label } = getStatusBadgeProps(isDisabled);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Tr className="group h-10 hover:bg-mineshaft-700" key={`st-v3-${id}`}>
|
<Tr
|
||||||
|
className="group h-10 hover:bg-mineshaft-700"
|
||||||
|
key={`st-v3-${id}`}
|
||||||
|
onMouseLeave={() => {
|
||||||
|
setCopyCipherText("");
|
||||||
|
}}
|
||||||
|
>
|
||||||
<Td>
|
<Td>
|
||||||
<div className="flex items-center gap-2 ">
|
<div className="flex items-center gap-2 ">
|
||||||
{name}
|
{name}
|
||||||
@@ -265,7 +278,22 @@ export const CmekTable = () => {
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</Td>
|
</Td>
|
||||||
<Td>{id}</Td>
|
<Td>
|
||||||
|
<div>
|
||||||
|
<span> {id}</span>
|
||||||
|
<IconButton
|
||||||
|
ariaLabel="copy icon"
|
||||||
|
colorSchema="secondary"
|
||||||
|
className="group/copy duration:0 invisible relative ml-3 group-hover:visible"
|
||||||
|
onClick={() => {
|
||||||
|
navigator.clipboard.writeText(id);
|
||||||
|
setCopyCipherText("Copied");
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<FontAwesomeIcon icon={isCopyingCiphertext ? faCheck : faCopy} />
|
||||||
|
</IconButton>
|
||||||
|
</div>
|
||||||
|
</Td>
|
||||||
<Td className="uppercase">{encryptionAlgorithm}</Td>
|
<Td className="uppercase">{encryptionAlgorithm}</Td>
|
||||||
<Td>
|
<Td>
|
||||||
<Badge variant={variant}>{label}</Badge>
|
<Badge variant={variant}>{label}</Badge>
|
||||||
|
|||||||
Reference in New Issue
Block a user