mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-06 16:27:46 +00:00
fix: frontend requested changes
This commit is contained in:
@@ -55,7 +55,6 @@ type Props = Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, "onChange" | "val
|
|||||||
secretPath?: string;
|
secretPath?: string;
|
||||||
environment?: string;
|
environment?: string;
|
||||||
containerClassName?: string;
|
containerClassName?: string;
|
||||||
secretValueHidden?: boolean;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
type ReferenceItem = {
|
type ReferenceItem = {
|
||||||
@@ -72,7 +71,6 @@ export const InfisicalSecretInput = forwardRef<HTMLTextAreaElement, Props>(
|
|||||||
containerClassName,
|
containerClassName,
|
||||||
secretPath: propSecretPath,
|
secretPath: propSecretPath,
|
||||||
environment: propEnvironment,
|
environment: propEnvironment,
|
||||||
secretValueHidden,
|
|
||||||
...props
|
...props
|
||||||
},
|
},
|
||||||
ref
|
ref
|
||||||
@@ -278,7 +276,6 @@ export const InfisicalSecretInput = forwardRef<HTMLTextAreaElement, Props>(
|
|||||||
ref={handleRef}
|
ref={handleRef}
|
||||||
onKeyDown={handleKeyDown}
|
onKeyDown={handleKeyDown}
|
||||||
value={value}
|
value={value}
|
||||||
valueHidden={secretValueHidden}
|
|
||||||
onFocus={() => setIsFocused.on()}
|
onFocus={() => setIsFocused.on()}
|
||||||
onBlur={(evt) => {
|
onBlur={(evt) => {
|
||||||
// should not on blur when its mouse down selecting a item from suggestion
|
// should not on blur when its mouse down selecting a item from suggestion
|
||||||
|
|||||||
@@ -1,13 +1,10 @@
|
|||||||
/* eslint-disable react/no-danger */
|
/* eslint-disable react/no-danger */
|
||||||
import { forwardRef, TextareaHTMLAttributes } from "react";
|
import { forwardRef, TextareaHTMLAttributes } from "react";
|
||||||
import { faQuestionCircle } from "@fortawesome/free-solid-svg-icons";
|
|
||||||
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|
||||||
import { twMerge } from "tailwind-merge";
|
import { twMerge } from "tailwind-merge";
|
||||||
|
|
||||||
import { useToggle } from "@app/hooks";
|
import { useToggle } from "@app/hooks";
|
||||||
|
|
||||||
import { Tooltip } from "../Tooltip";
|
|
||||||
|
|
||||||
const REGEX = /(\${([a-zA-Z0-9-_.]+)})/g;
|
const REGEX = /(\${([a-zA-Z0-9-_.]+)})/g;
|
||||||
const replaceContentWithDot = (str: string) => {
|
const replaceContentWithDot = (str: string) => {
|
||||||
let finalStr = "";
|
let finalStr = "";
|
||||||
@@ -18,26 +15,7 @@ const replaceContentWithDot = (str: string) => {
|
|||||||
return finalStr;
|
return finalStr;
|
||||||
};
|
};
|
||||||
|
|
||||||
const syntaxHighlight = (
|
const syntaxHighlight = (content?: string | null, isVisible?: boolean, isImport?: boolean) => {
|
||||||
content?: string | null,
|
|
||||||
isVisible?: boolean,
|
|
||||||
isImport?: boolean,
|
|
||||||
valueHidden?: boolean
|
|
||||||
) => {
|
|
||||||
if (valueHidden && !content)
|
|
||||||
return (
|
|
||||||
<div className="flex items-center gap-2">
|
|
||||||
<span className="opacity-60">VALUE HIDDEN</span>
|
|
||||||
<div className="relative z-50">
|
|
||||||
<Tooltip
|
|
||||||
className="!relative !z-50 !break-normal !font-inter"
|
|
||||||
content="You do not have permission to read the value of this secret."
|
|
||||||
>
|
|
||||||
<FontAwesomeIcon icon={faQuestionCircle} className="text-xs" />
|
|
||||||
</Tooltip>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
if (isImport && !content) return "IMPORTED";
|
if (isImport && !content) return "IMPORTED";
|
||||||
if (content === "") return "EMPTY";
|
if (content === "") return "EMPTY";
|
||||||
if (!content) return "EMPTY";
|
if (!content) return "EMPTY";
|
||||||
@@ -106,7 +84,7 @@ export const SecretInput = forwardRef<HTMLTextAreaElement, Props>(
|
|||||||
<pre aria-hidden className="m-0">
|
<pre aria-hidden className="m-0">
|
||||||
<code className={`inline-block w-full ${commonClassName}`}>
|
<code className={`inline-block w-full ${commonClassName}`}>
|
||||||
<span style={{ whiteSpace: "break-spaces" }}>
|
<span style={{ whiteSpace: "break-spaces" }}>
|
||||||
{syntaxHighlight(value, isVisible || isSecretFocused, isImport, valueHidden)}
|
{syntaxHighlight(value, isVisible || isSecretFocused, isImport)}
|
||||||
</span>
|
</span>
|
||||||
</code>
|
</code>
|
||||||
</pre>
|
</pre>
|
||||||
|
|||||||
@@ -137,6 +137,7 @@ export const useGetImportedSecretsSingleEnv = ({
|
|||||||
env: encSecret.environment,
|
env: encSecret.environment,
|
||||||
key: encSecret.secretKey,
|
key: encSecret.secretKey,
|
||||||
value: encSecret.secretValue,
|
value: encSecret.secretValue,
|
||||||
|
secretValueHidden: encSecret.secretValueHidden,
|
||||||
tags: encSecret.tags,
|
tags: encSecret.tags,
|
||||||
comment: encSecret.secretComment,
|
comment: encSecret.secretComment,
|
||||||
createdAt: encSecret.createdAt,
|
createdAt: encSecret.createdAt,
|
||||||
|
|||||||
+29
-18
@@ -142,24 +142,35 @@ export const SecretEditRow = ({
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
<div className="flex-grow border-r border-r-mineshaft-600 pl-1 pr-2">
|
<div className="flex-grow border-r border-r-mineshaft-600 pl-1 pr-2">
|
||||||
<Controller
|
{secretValueHidden ? (
|
||||||
disabled={isImportedSecret && !defaultValue}
|
<Tooltip content="You do not have permission to read the value of this secret.">
|
||||||
control={control}
|
<div
|
||||||
name="value"
|
className="flex w-80 flex-grow items-center py-1 pl-4 pr-2"
|
||||||
render={({ field }) => (
|
tabIndex={0}
|
||||||
<InfisicalSecretInput
|
role="button"
|
||||||
{...field}
|
>
|
||||||
isReadOnly={isImportedSecret}
|
<span className="blur">********</span>
|
||||||
value={field.value as string}
|
</div>
|
||||||
key="secret-input"
|
</Tooltip>
|
||||||
isVisible={isVisible}
|
) : (
|
||||||
secretValueHidden={secretValueHidden}
|
<Controller
|
||||||
secretPath={secretPath}
|
disabled={isImportedSecret && !defaultValue}
|
||||||
environment={environment}
|
control={control}
|
||||||
isImport={isImportedSecret}
|
name="value"
|
||||||
/>
|
render={({ field }) => (
|
||||||
)}
|
<InfisicalSecretInput
|
||||||
/>
|
{...field}
|
||||||
|
isReadOnly={isImportedSecret}
|
||||||
|
value={field.value as string}
|
||||||
|
key="secret-input"
|
||||||
|
isVisible={isVisible}
|
||||||
|
secretPath={secretPath}
|
||||||
|
environment={environment}
|
||||||
|
isImport={isImportedSecret}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ import {
|
|||||||
useProjectPermission,
|
useProjectPermission,
|
||||||
useWorkspace
|
useWorkspace
|
||||||
} from "@app/context";
|
} from "@app/context";
|
||||||
|
import { ProjectPermissionSecretActions } from "@app/context/ProjectPermissionContext/types";
|
||||||
import { useDebounce, usePagination, usePopUp, useResetPageHelper } from "@app/hooks";
|
import { useDebounce, usePagination, usePopUp, useResetPageHelper } from "@app/hooks";
|
||||||
import {
|
import {
|
||||||
useGetImportedSecretsSingleEnv,
|
useGetImportedSecretsSingleEnv,
|
||||||
@@ -58,7 +59,6 @@ import {
|
|||||||
useSelectedSecrets
|
useSelectedSecrets
|
||||||
} from "./SecretMainPage.store";
|
} from "./SecretMainPage.store";
|
||||||
import { Filter, RowType } from "./SecretMainPage.types";
|
import { Filter, RowType } from "./SecretMainPage.types";
|
||||||
import { ProjectPermissionSecretActions } from "@app/context/ProjectPermissionContext/types";
|
|
||||||
|
|
||||||
const LOADER_TEXT = [
|
const LOADER_TEXT = [
|
||||||
"Retrieving your encrypted secrets...",
|
"Retrieving your encrypted secrets...",
|
||||||
|
|||||||
+15
-8
@@ -9,7 +9,8 @@ import {
|
|||||||
faPlus,
|
faPlus,
|
||||||
faShare,
|
faShare,
|
||||||
faTag,
|
faTag,
|
||||||
faTrash
|
faTrash,
|
||||||
|
faTriangleExclamation
|
||||||
} 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 { zodResolver } from "@hookform/resolvers/zod";
|
import { zodResolver } from "@hookform/resolvers/zod";
|
||||||
@@ -44,6 +45,7 @@ import {
|
|||||||
useProjectPermission,
|
useProjectPermission,
|
||||||
useWorkspace
|
useWorkspace
|
||||||
} from "@app/context";
|
} from "@app/context";
|
||||||
|
import { ProjectPermissionSecretActions } from "@app/context/ProjectPermissionContext/types";
|
||||||
import { usePopUp, useToggle } from "@app/hooks";
|
import { usePopUp, useToggle } from "@app/hooks";
|
||||||
import { useGetSecretVersion } from "@app/hooks/api";
|
import { useGetSecretVersion } from "@app/hooks/api";
|
||||||
import { useGetSecretAccessList } from "@app/hooks/api/secrets/queries";
|
import { useGetSecretAccessList } from "@app/hooks/api/secrets/queries";
|
||||||
@@ -52,8 +54,6 @@ import { ProjectType } from "@app/hooks/api/workspace/types";
|
|||||||
|
|
||||||
import { CreateReminderForm } from "./CreateReminderForm";
|
import { CreateReminderForm } from "./CreateReminderForm";
|
||||||
import { formSchema, SecretActionType, TFormSchema } from "./SecretListView.utils";
|
import { formSchema, SecretActionType, TFormSchema } from "./SecretListView.utils";
|
||||||
import { ProjectPermissionSecretActions } from "@app/context/ProjectPermissionContext/types";
|
|
||||||
import { useEffect } from "react";
|
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
isOpen?: boolean;
|
isOpen?: boolean;
|
||||||
@@ -156,8 +156,6 @@ export const SecretDetailSidebar = ({
|
|||||||
cannotEditSecret &&
|
cannotEditSecret &&
|
||||||
cannotReadSecretValue;
|
cannotReadSecretValue;
|
||||||
|
|
||||||
console.log("cannotReadSecretValue", cannotReadSecretValue);
|
|
||||||
|
|
||||||
const overrideAction = watch("overrideAction");
|
const overrideAction = watch("overrideAction");
|
||||||
const isOverridden =
|
const isOverridden =
|
||||||
overrideAction === SecretActionType.Created || overrideAction === SecretActionType.Modified;
|
overrideAction === SecretActionType.Created || overrideAction === SecretActionType.Modified;
|
||||||
@@ -280,9 +278,18 @@ export const SecretDetailSidebar = ({
|
|||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormControl
|
<FormControl
|
||||||
helperText={
|
helperText={
|
||||||
cannotReadSecretValue
|
cannotReadSecretValue ? (
|
||||||
? "The value of this secret is hidden because you don't have the read secret value permission."
|
<div className="flex space-x-2">
|
||||||
: undefined
|
<FontAwesomeIcon
|
||||||
|
icon={faTriangleExclamation}
|
||||||
|
className="mt-0.5 text-yellow-400"
|
||||||
|
/>
|
||||||
|
<span>
|
||||||
|
The value of this secret is hidden because you do not have the
|
||||||
|
read secret value permission.
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
) : undefined
|
||||||
}
|
}
|
||||||
label="Value"
|
label="Value"
|
||||||
>
|
>
|
||||||
|
|||||||
+10
-2
@@ -150,7 +150,6 @@ export const SecretItem = memo(
|
|||||||
);
|
);
|
||||||
|
|
||||||
const { secretValueHidden } = secret;
|
const { secretValueHidden } = secret;
|
||||||
console.log(`Secret Key: ${secret.key}, hidden: ${secretValueHidden}`);
|
|
||||||
|
|
||||||
const [isSecValueCopied, setIsSecValueCopied] = useToggle(false);
|
const [isSecValueCopied, setIsSecValueCopied] = useToggle(false);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -283,6 +282,16 @@ export const SecretItem = memo(
|
|||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
|
) : secretValueHidden ? (
|
||||||
|
<Tooltip content="You do not have permission to read the value of this secret.">
|
||||||
|
<div
|
||||||
|
className="flex w-80 flex-grow items-center py-1 pl-4 pr-2"
|
||||||
|
tabIndex={0}
|
||||||
|
role="button"
|
||||||
|
>
|
||||||
|
<span className="blur">********</span>
|
||||||
|
</div>
|
||||||
|
</Tooltip>
|
||||||
) : (
|
) : (
|
||||||
<Controller
|
<Controller
|
||||||
name="value"
|
name="value"
|
||||||
@@ -290,7 +299,6 @@ export const SecretItem = memo(
|
|||||||
control={control}
|
control={control}
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<InfisicalSecretInput
|
<InfisicalSecretInput
|
||||||
secretValueHidden={secretValueHidden}
|
|
||||||
isReadOnly={isReadOnly}
|
isReadOnly={isReadOnly}
|
||||||
key="secret-value"
|
key="secret-value"
|
||||||
isVisible={isVisible}
|
isVisible={isVisible}
|
||||||
|
|||||||
Reference in New Issue
Block a user