mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-07 04:27:29 +00:00
update and use secret path examples where applicable across app
This commit is contained in:
@@ -79,7 +79,7 @@ export const Tr = ({
|
|||||||
}: TrProps): JSX.Element => (
|
}: TrProps): JSX.Element => (
|
||||||
<tr
|
<tr
|
||||||
className={twMerge(
|
className={twMerge(
|
||||||
"cursor-default border-b last:border-b-0 border-solid border-mineshaft-600",
|
"cursor-default border-b border-solid border-mineshaft-600 last:border-b-0",
|
||||||
isHoverable && "hover:bg-mineshaft-600",
|
isHoverable && "hover:bg-mineshaft-600",
|
||||||
isSelectable && "cursor-pointer",
|
isSelectable && "cursor-pointer",
|
||||||
className
|
className
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import { yupResolver } from "@hookform/resolvers/yup";
|
|||||||
import { twMerge } from "tailwind-merge";
|
import { twMerge } from "tailwind-merge";
|
||||||
import * as yup from "yup";
|
import * as yup from "yup";
|
||||||
|
|
||||||
|
import SecretPathExamples from "@app/components/basic/popups/SecretPathExamples";
|
||||||
import { useNotificationContext } from "@app/components/context/Notifications/NotificationProvider";
|
import { useNotificationContext } from "@app/components/context/Notifications/NotificationProvider";
|
||||||
import { ProjectPermissionCan } from "@app/components/permissions";
|
import { ProjectPermissionCan } from "@app/components/permissions";
|
||||||
// TODO:(akhilmhdh) convert all the util functions like this into a lib folder grouped by functionality
|
// TODO:(akhilmhdh) convert all the util functions like this into a lib folder grouped by functionality
|
||||||
@@ -222,7 +223,7 @@ export const SecretDropzone = ({
|
|||||||
onDragOver={handleDrag}
|
onDragOver={handleDrag}
|
||||||
onDrop={handleDrop}
|
onDrop={handleDrop}
|
||||||
className={twMerge(
|
className={twMerge(
|
||||||
"relative mx-0.5 mb-4 mt-4 flex cursor-pointer items-center justify-center rounded-md bg-mineshaft-900 py-4 text-sm px-2 text-mineshaft-200 opacity-60 outline-dashed outline-2 outline-chicago-600 duration-200 hover:opacity-100",
|
"relative mx-0.5 mb-4 mt-4 flex cursor-pointer items-center justify-center rounded-md bg-mineshaft-900 py-4 px-2 text-sm text-mineshaft-200 opacity-60 outline-dashed outline-2 outline-chicago-600 duration-200 hover:opacity-100",
|
||||||
isDragActive && "opacity-100",
|
isDragActive && "opacity-100",
|
||||||
!isSmaller && "w-full max-w-3xl flex-col space-y-4 py-20",
|
!isSmaller && "w-full max-w-3xl flex-col space-y-4 py-20",
|
||||||
isLoading && "bg-bunker-800"
|
isLoading && "bg-bunker-800"
|
||||||
@@ -234,7 +235,7 @@ export const SecretDropzone = ({
|
|||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<form onSubmit={handleSubmit(handleFormSubmit)}>
|
<form onSubmit={handleSubmit(handleFormSubmit)}>
|
||||||
<div className="flex items-center justify-cente flex-col space-y-2">
|
<div className="justify-cente flex flex-col items-center space-y-2">
|
||||||
<div>
|
<div>
|
||||||
<FontAwesomeIcon icon={faUpload} size={isSmaller ? "2x" : "5x"} />
|
<FontAwesomeIcon icon={faUpload} size={isSmaller ? "2x" : "5x"} />
|
||||||
</div>
|
</div>
|
||||||
@@ -324,7 +325,12 @@ export const SecretDropzone = ({
|
|||||||
</FormControl>
|
</FormControl>
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
<FormControl label="Secret Path" className="flex-grow" isRequired>
|
<FormControl
|
||||||
|
label="Secret Path"
|
||||||
|
className="flex-grow"
|
||||||
|
isRequired
|
||||||
|
icon={<SecretPathExamples />}
|
||||||
|
>
|
||||||
<Input
|
<Input
|
||||||
{...register("secretPath")}
|
{...register("secretPath")}
|
||||||
placeholder="Provide a path, default is /"
|
placeholder="Provide a path, default is /"
|
||||||
@@ -334,7 +340,7 @@ export const SecretDropzone = ({
|
|||||||
<div className="border-t border-mineshaft-600 pt-4">
|
<div className="border-t border-mineshaft-600 pt-4">
|
||||||
<div className="mb-4 flex items-center justify-between">
|
<div className="mb-4 flex items-center justify-between">
|
||||||
<div>Secrets</div>
|
<div>Secrets</div>
|
||||||
<div className="w-1/2 flex items-center space-x-2">
|
<div className="flex w-1/2 items-center space-x-2">
|
||||||
<Input
|
<Input
|
||||||
placeholder="Search for secret"
|
placeholder="Search for secret"
|
||||||
value={searchFilter}
|
value={searchFilter}
|
||||||
@@ -367,7 +373,7 @@ export const SecretDropzone = ({
|
|||||||
{!isSecretsLoading && !secrets?.secrets?.length && (
|
{!isSecretsLoading && !secrets?.secrets?.length && (
|
||||||
<EmptyState title="No secrets found" icon={faKey} />
|
<EmptyState title="No secrets found" icon={faKey} />
|
||||||
)}
|
)}
|
||||||
<div className="grid grid-cols-2 gap-4 max-h-64 overflow-auto thin-scrollbar ">
|
<div className="thin-scrollbar grid max-h-64 grid-cols-2 gap-4 overflow-auto ">
|
||||||
{isSecretsLoading &&
|
{isSecretsLoading &&
|
||||||
Array.apply(0, Array(2)).map((_x, i) => (
|
Array.apply(0, Array(2)).map((_x, i) => (
|
||||||
<Skeleton
|
<Skeleton
|
||||||
|
|||||||
+15
-5
@@ -5,6 +5,7 @@ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|||||||
import { motion } from "framer-motion";
|
import { motion } from "framer-motion";
|
||||||
import { twMerge } from "tailwind-merge";
|
import { twMerge } from "tailwind-merge";
|
||||||
|
|
||||||
|
import SecretPathExamples from "@app/components/basic/popups/SecretPathExamples";
|
||||||
import {
|
import {
|
||||||
Checkbox,
|
Checkbox,
|
||||||
FormControl,
|
FormControl,
|
||||||
@@ -51,6 +52,8 @@ export const MultiEnvProjectPermission = ({
|
|||||||
}: Props) => {
|
}: Props) => {
|
||||||
const { currentWorkspace } = useWorkspace();
|
const { currentWorkspace } = useWorkspace();
|
||||||
|
|
||||||
|
console.log({ currentWorkspace });
|
||||||
|
|
||||||
const environments = currentWorkspace?.environments || [];
|
const environments = currentWorkspace?.environments || [];
|
||||||
const customRule = useWatch({
|
const customRule = useWatch({
|
||||||
control,
|
control,
|
||||||
@@ -98,7 +101,7 @@ export const MultiEnvProjectPermission = ({
|
|||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className={twMerge(
|
className={twMerge(
|
||||||
"px-10 py-6 bg-mineshaft-800 rounded-md",
|
"rounded-md bg-mineshaft-800 px-10 py-6",
|
||||||
(selectedPermissionCategory !== Permission.NoAccess || isCustom) &&
|
(selectedPermissionCategory !== Permission.NoAccess || isCustom) &&
|
||||||
"border-l-2 border-primary-600"
|
"border-l-2 border-primary-600"
|
||||||
)}
|
)}
|
||||||
@@ -107,8 +110,8 @@ export const MultiEnvProjectPermission = ({
|
|||||||
<div>
|
<div>
|
||||||
<FontAwesomeIcon icon={icon} className="text-4xl" />
|
<FontAwesomeIcon icon={icon} className="text-4xl" />
|
||||||
</div>
|
</div>
|
||||||
<div className="flex-grow flex flex-col">
|
<div className="flex flex-grow flex-col">
|
||||||
<div className="font-medium mb-1 text-lg">{title}</div>
|
<div className="mb-1 text-lg font-medium">{title}</div>
|
||||||
<div className="text-xs font-light">{subtitle}</div>
|
<div className="text-xs font-light">{subtitle}</div>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
@@ -130,12 +133,19 @@ export const MultiEnvProjectPermission = ({
|
|||||||
animate={{ height: isCustom ? "auto" : 0 }}
|
animate={{ height: isCustom ? "auto" : 0 }}
|
||||||
className="overflow-hidden"
|
className="overflow-hidden"
|
||||||
>
|
>
|
||||||
<TableContainer className="border-mineshaft-500 mt-6">
|
<TableContainer className="mt-6 border-mineshaft-500">
|
||||||
<Table>
|
<Table>
|
||||||
<THead>
|
<THead>
|
||||||
<Tr>
|
<Tr>
|
||||||
<Th />
|
<Th />
|
||||||
<Th className="min-w-[8rem]">Secret Path</Th>
|
<Th className="min-w-[8rem]">
|
||||||
|
<div className="flex items-center gap-2">
|
||||||
|
Secret Path
|
||||||
|
<span className="text-xs normal-case">
|
||||||
|
<SecretPathExamples />
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</Th>
|
||||||
<Th className="text-center">View</Th>
|
<Th className="text-center">View</Th>
|
||||||
<Th className="text-center">Create</Th>
|
<Th className="text-center">Create</Th>
|
||||||
<Th className="text-center">Modify</Th>
|
<Th className="text-center">Modify</Th>
|
||||||
|
|||||||
+4
-4
@@ -180,7 +180,7 @@ export const ProjectRoleModifySection = ({ role, onGoBack }: Props) => {
|
|||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<form onSubmit={handleSubmit(handleFormSubmit)}>
|
<form onSubmit={handleSubmit(handleFormSubmit)}>
|
||||||
<div className="flex justify-between mb-2 items-center">
|
<div className="mb-2 flex items-center justify-between">
|
||||||
<h1 className="text-xl font-semibold text-mineshaft-100">
|
<h1 className="text-xl font-semibold text-mineshaft-100">
|
||||||
{isNewRole ? "New" : "Edit"} Role
|
{isNewRole ? "New" : "Edit"} Role
|
||||||
</h1>
|
</h1>
|
||||||
@@ -222,11 +222,11 @@ export const ProjectRoleModifySection = ({ role, onGoBack }: Props) => {
|
|||||||
>
|
>
|
||||||
<Input {...register("description")} isReadOnly={isNonEditable} />
|
<Input {...register("description")} isReadOnly={isNonEditable} />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
<div className="flex justify-between items-center pt-6 border-t border-t-mineshaft-800">
|
<div className="flex items-center justify-between border-t border-t-mineshaft-800 pt-6">
|
||||||
<div>
|
<div>
|
||||||
<h2 className="text-xl font-medium">Add Permission</h2>
|
<h2 className="text-xl font-medium">Add Permission</h2>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex-1 max-w-md">
|
<div className="max-w-md flex-1">
|
||||||
<Input
|
<Input
|
||||||
value={searchPermission}
|
value={searchPermission}
|
||||||
onChange={(e) => setSearchPermission(e.target.value)}
|
onChange={(e) => setSearchPermission(e.target.value)}
|
||||||
@@ -274,7 +274,7 @@ export const ProjectRoleModifySection = ({ role, onGoBack }: Props) => {
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex items-center space-x-4 mt-12">
|
<div className="mt-12 flex items-center space-x-4">
|
||||||
<Button
|
<Button
|
||||||
type="submit"
|
type="submit"
|
||||||
isDisabled={isSubmitting || isNonEditable || !isDirty}
|
isDisabled={isSubmitting || isNonEditable || !isDirty}
|
||||||
|
|||||||
+4
-40
@@ -1,10 +1,9 @@
|
|||||||
import { useEffect, useState } from "react";
|
import { useEffect } from "react";
|
||||||
import { Controller, useForm } from "react-hook-form";
|
import { Controller, useForm } from "react-hook-form";
|
||||||
import { faInfo } from "@fortawesome/free-solid-svg-icons";
|
|
||||||
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|
||||||
import { yupResolver } from "@hookform/resolvers/yup";
|
import { yupResolver } from "@hookform/resolvers/yup";
|
||||||
import * as yup from "yup";
|
import * as yup from "yup";
|
||||||
|
|
||||||
|
import SecretPathExamples from "@app/components/basic/popups/SecretPathExamples";
|
||||||
import {
|
import {
|
||||||
Button,
|
Button,
|
||||||
FormControl,
|
FormControl,
|
||||||
@@ -13,8 +12,7 @@ import {
|
|||||||
ModalClose,
|
ModalClose,
|
||||||
ModalContent,
|
ModalContent,
|
||||||
Select,
|
Select,
|
||||||
SelectItem,
|
SelectItem
|
||||||
Tooltip
|
|
||||||
} from "@app/components/v2";
|
} from "@app/components/v2";
|
||||||
|
|
||||||
const formSchema = yup.object({
|
const formSchema = yup.object({
|
||||||
@@ -48,7 +46,6 @@ export const AddWebhookForm = ({
|
|||||||
} = useForm<TFormSchema>({
|
} = useForm<TFormSchema>({
|
||||||
resolver: yupResolver(formSchema)
|
resolver: yupResolver(formSchema)
|
||||||
});
|
});
|
||||||
const [showTip, setShowTip] = useState<boolean>(false);
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!isOpen) {
|
if (!isOpen) {
|
||||||
@@ -89,40 +86,7 @@ export const AddWebhookForm = ({
|
|||||||
/>
|
/>
|
||||||
<FormControl
|
<FormControl
|
||||||
label="Secret Path"
|
label="Secret Path"
|
||||||
icon={
|
icon={<SecretPathExamples />}
|
||||||
<Tooltip
|
|
||||||
isOpen={showTip}
|
|
||||||
onOpenChange={setShowTip}
|
|
||||||
content={
|
|
||||||
<div>
|
|
||||||
<h4 className="mb-2">Here are some examples of glob patterns:</h4>
|
|
||||||
<div className="ol-listStyleType">
|
|
||||||
<li>
|
|
||||||
<code className="text-primary">/</code> - Matches all files and
|
|
||||||
directories in the current directory
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<code className="text-primary">**/*</code> - Matches all files and
|
|
||||||
directories in the current directory and its subdirectories
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<code className="text-primary">{"/{dir1,dir2}"}</code> - Matches all files
|
|
||||||
and directories in dir1 and dir2
|
|
||||||
</li>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
position="right"
|
|
||||||
className="text-xs"
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
className="flex h-3.5 w-3.5 items-center justify-center rounded-full border border-[1px] border-mineshaft-300"
|
|
||||||
onMouseEnter={() => setShowTip(true)}
|
|
||||||
>
|
|
||||||
<FontAwesomeIcon icon={faInfo} className="h-2 w-2" />
|
|
||||||
</div>
|
|
||||||
</Tooltip>
|
|
||||||
}
|
|
||||||
isRequired
|
isRequired
|
||||||
isError={Boolean(errors?.secretPath)}
|
isError={Boolean(errors?.secretPath)}
|
||||||
errorText={errors?.secretPath?.message}
|
errorText={errors?.secretPath?.message}
|
||||||
|
|||||||
Reference in New Issue
Block a user