mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-07 18:27:36 +00:00
Fixing UI, UX, and bugs in the dashboard
This commit is contained in:
@@ -33,6 +33,7 @@ const buttonVariants = cva(
|
|||||||
solid: '',
|
solid: '',
|
||||||
outline: ['bg-transparent', 'border-2', 'border-solid'],
|
outline: ['bg-transparent', 'border-2', 'border-solid'],
|
||||||
plain: '',
|
plain: '',
|
||||||
|
selected: '',
|
||||||
// a constant color not in use on hover or click goes colorSchema color
|
// a constant color not in use on hover or click goes colorSchema color
|
||||||
star: 'text-bunker-200 bg-mineshaft-500'
|
star: 'text-bunker-200 bg-mineshaft-500'
|
||||||
},
|
},
|
||||||
@@ -61,6 +62,16 @@ const buttonVariants = cva(
|
|||||||
variant: 'star',
|
variant: 'star',
|
||||||
className: 'hover:bg-primary hover:text-black'
|
className: 'hover:bg-primary hover:text-black'
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
colorSchema: 'primary',
|
||||||
|
variant: 'selected',
|
||||||
|
className: 'bg-primary/10 border border-primary/50 text-bunker-200'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
colorSchema: 'secondary',
|
||||||
|
variant: 'star',
|
||||||
|
className: 'bg-mineshaft-700 border border-mineshaft-600 hover:bg-mineshaft hover:text-white'
|
||||||
|
},
|
||||||
{
|
{
|
||||||
colorSchema: 'danger',
|
colorSchema: 'danger',
|
||||||
variant: 'star',
|
variant: 'star',
|
||||||
|
|||||||
@@ -189,11 +189,9 @@ export const DashboardPage = () => {
|
|||||||
handleSubmit,
|
handleSubmit,
|
||||||
getValues,
|
getValues,
|
||||||
setValue,
|
setValue,
|
||||||
formState: { isDirty, isSubmitting, dirtyFields },
|
formState: { isSubmitting, dirtyFields },
|
||||||
reset
|
reset
|
||||||
} = method;
|
} = method;
|
||||||
console.log(122, method)
|
|
||||||
console.log(123, isDirty, Object.keys(dirtyFields))
|
|
||||||
const formSecrets = useWatch({ control, name: 'secrets' });
|
const formSecrets = useWatch({ control, name: 'secrets' });
|
||||||
const { fields, prepend, append, remove, update } = useFieldArray({ control, name: 'secrets' });
|
const { fields, prepend, append, remove, update } = useFieldArray({ control, name: 'secrets' });
|
||||||
|
|
||||||
@@ -201,7 +199,6 @@ export const DashboardPage = () => {
|
|||||||
const isReadOnly = selectedEnv?.isWriteDenied;
|
const isReadOnly = selectedEnv?.isWriteDenied;
|
||||||
const isAddOnly = selectedEnv?.isReadDenied && !selectedEnv?.isWriteDenied;
|
const isAddOnly = selectedEnv?.isReadDenied && !selectedEnv?.isWriteDenied;
|
||||||
const canDoRollback = !isReadOnly && !isAddOnly;
|
const canDoRollback = !isReadOnly && !isAddOnly;
|
||||||
console.log(123, !isRollbackMode, !isAddOnly, !isDirty)
|
|
||||||
const isSubmitDisabled =
|
const isSubmitDisabled =
|
||||||
isReadOnly ||
|
isReadOnly ||
|
||||||
// on add only mode the formstate becomes dirty due to secrets missing some items
|
// on add only mode the formstate becomes dirty due to secrets missing some items
|
||||||
@@ -415,7 +412,7 @@ export const DashboardPage = () => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="container mx-auto w-full px-6 text-mineshaft-50 dark:[color-scheme:dark]">
|
<div className="container mx-auto max-w-full px-6 text-mineshaft-50 dark:[color-scheme:dark]">
|
||||||
<FormProvider {...method}>
|
<FormProvider {...method}>
|
||||||
<form autoComplete="off">
|
<form autoComplete="off">
|
||||||
{/* breadcrumb row */}
|
{/* breadcrumb row */}
|
||||||
@@ -529,7 +526,7 @@ export const DashboardPage = () => {
|
|||||||
</IconButton>
|
</IconButton>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
</div>
|
</div>
|
||||||
<Button
|
{!isReadOnly && !isRollbackMode && <Button
|
||||||
leftIcon={<FontAwesomeIcon icon={faPlus} />}
|
leftIcon={<FontAwesomeIcon icon={faPlus} />}
|
||||||
onClick={() => prepend(DEFAULT_SECRET_VALUE, { shouldFocus: false })}
|
onClick={() => prepend(DEFAULT_SECRET_VALUE, { shouldFocus: false })}
|
||||||
isDisabled={isReadOnly || isRollbackMode}
|
isDisabled={isReadOnly || isRollbackMode}
|
||||||
@@ -537,7 +534,7 @@ export const DashboardPage = () => {
|
|||||||
className="h-10"
|
className="h-10"
|
||||||
>
|
>
|
||||||
Add Secret
|
Add Secret
|
||||||
</Button>
|
</Button>}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className={`${isSecretEmpty ? "flex flex-col items-center justify-center" : ""} mt-4 h-[calc(100vh-270px)] overflow-y-scroll overflow-x-hidden no-scrollbar no-scrollbar::-webkit-scrollbar`}>
|
<div className={`${isSecretEmpty ? "flex flex-col items-center justify-center" : ""} mt-4 h-[calc(100vh-270px)] overflow-y-scroll overflow-x-hidden no-scrollbar no-scrollbar::-webkit-scrollbar`}>
|
||||||
|
|||||||
@@ -46,9 +46,14 @@ export const PitDrawer = ({
|
|||||||
key={_id}
|
key={_id}
|
||||||
className="py-3 px-4 text-sm"
|
className="py-3 px-4 text-sm"
|
||||||
isFullWidth
|
isFullWidth
|
||||||
|
colorSchema={
|
||||||
|
(i === 0 && index === 0 && snapshotId === null) || snapshotId === _id
|
||||||
|
? 'primary'
|
||||||
|
: 'secondary'
|
||||||
|
}
|
||||||
variant={
|
variant={
|
||||||
(i === 0 && index === 0 && snapshotId === null) || snapshotId === _id
|
(i === 0 && index === 0 && snapshotId === null) || snapshotId === _id
|
||||||
? 'solid'
|
? 'selected'
|
||||||
: 'star'
|
: 'star'
|
||||||
}
|
}
|
||||||
onClick={() => onSelectSnapshot(_id)}
|
onClick={() => onSelectSnapshot(_id)}
|
||||||
@@ -65,6 +70,7 @@ export const PitDrawer = ({
|
|||||||
<Button
|
<Button
|
||||||
className="mt-8 py-3 px-4 text-sm"
|
className="mt-8 py-3 px-4 text-sm"
|
||||||
isFullWidth
|
isFullWidth
|
||||||
|
variant="star"
|
||||||
isLoading={isFetchingNextPage}
|
isLoading={isFetchingNextPage}
|
||||||
isDisabled={isFetchingNextPage || !hasNextPage}
|
isDisabled={isFetchingNextPage || !hasNextPage}
|
||||||
onClick={fetchNextPage}
|
onClick={fetchNextPage}
|
||||||
|
|||||||
+14
-43
@@ -1,8 +1,6 @@
|
|||||||
import { Controller } from 'react-hook-form';
|
import { Controller } from 'react-hook-form';
|
||||||
import { faArrowDown, faArrowUp, faCodeBranch, faInfoCircle } from '@fortawesome/free-solid-svg-icons';
|
import { faArrowDown, faArrowUp } from '@fortawesome/free-solid-svg-icons';
|
||||||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
||||||
import { HoverCard, HoverCardContent, HoverCardTrigger } from '@radix-ui/react-hover-card';
|
|
||||||
import { twMerge } from 'tailwind-merge';
|
|
||||||
|
|
||||||
import { IconButton } from '@app/components/v2';
|
import { IconButton } from '@app/components/v2';
|
||||||
|
|
||||||
@@ -23,47 +21,20 @@ export const SecretTableHeader = ({
|
|||||||
<Controller
|
<Controller
|
||||||
defaultValue=""
|
defaultValue=""
|
||||||
name="na"
|
name="na"
|
||||||
render={({ fieldState: { error } }) => (
|
render={() => (
|
||||||
<HoverCard openDelay={0} open={error?.message ? undefined : false}>
|
<td className='flex items-center'>
|
||||||
<HoverCardTrigger asChild>
|
<div className="min-w-[220px] lg:min-w-[240px] xl:min-w-[280px] relative flex items-center justify-start pl-2.5 w-full">
|
||||||
<td className='flex items-center'>
|
<div className="inline-flex items-end text-md font-medium">
|
||||||
<div className="min-w-[220px] lg:min-w-[240px] xl:min-w-[280px] relative flex items-center justify-start pl-2.5 w-full">
|
Key
|
||||||
<div className="inline-flex items-end text-md font-medium">
|
<IconButton variant="plain" className="ml-2" ariaLabel="sort" onClick={onSort}>
|
||||||
Key
|
<FontAwesomeIcon icon={sortDir === 'asc' ? faArrowDown : faArrowUp} />
|
||||||
<IconButton variant="plain" className="ml-2" ariaLabel="sort" onClick={onSort}>
|
</IconButton>
|
||||||
<FontAwesomeIcon icon={sortDir === 'asc' ? faArrowDown : faArrowUp} />
|
|
||||||
</IconButton>
|
|
||||||
</div>
|
|
||||||
<div className="w-max flex flex-row items-center justify-end">
|
|
||||||
<div className="w-5 overflow-hidden group-hover:w-5 mt-1"/>
|
|
||||||
{!true && (
|
|
||||||
<IconButton
|
|
||||||
variant="plain"
|
|
||||||
className={twMerge(
|
|
||||||
'w-0 overflow-hidden p-0 group-hover:w-6 group-hover:ml-1',
|
|
||||||
true && 'w-6 text-primary ml-1'
|
|
||||||
)}
|
|
||||||
size="md"
|
|
||||||
ariaLabel="info"
|
|
||||||
>
|
|
||||||
<div className="flex items-center space-x-1">
|
|
||||||
<FontAwesomeIcon icon={faCodeBranch} className="text-base" />
|
|
||||||
</div>
|
|
||||||
</IconButton>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
</HoverCardTrigger>
|
|
||||||
<HoverCardContent className="w-auto py-2 pt-2">
|
|
||||||
<div className="flex items-center space-x-2">
|
|
||||||
<div>
|
|
||||||
<FontAwesomeIcon icon={faInfoCircle} className="text-red" />
|
|
||||||
</div>
|
|
||||||
<div className="text-sm">{error?.message}</div>
|
|
||||||
</div>
|
</div>
|
||||||
</HoverCardContent>
|
<div className="w-max flex flex-row items-center justify-end">
|
||||||
</HoverCard>
|
<div className="w-5 overflow-hidden group-hover:w-5 mt-1"/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
<th className="flex flex-row w-full"><div className="text-sm font-medium">Value</div></th>
|
<th className="flex flex-row w-full"><div className="text-sm font-medium">Value</div></th>
|
||||||
|
|||||||
Reference in New Issue
Block a user