Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

improvement(ui): align embedded audit log cards with v3 (#8222)

Andrew Huang26574e91bfa1
diff --git a/frontend/src/components/v3/generic/Table/Table.stories.tsx b/frontend/src/components/v3/generic/Table/Table.stories.tsx
index ec2e464cc5..85ca88b3a9 100644
--- a/frontend/src/components/v3/generic/Table/Table.stories.tsx
+++ b/frontend/src/components/v3/generic/Table/Table.stories.tsx
@@ -11,6 +11,7 @@ import {
import {
Badge,
+ Button,
Checkbox,
DropdownMenu,
DropdownMenuContent,
@@ -23,6 +24,7 @@ import {
import { cn } from "../../utils";
import {
Table,
+ TableAttachedFooter,
TableBody,
TableCaption,
TableCell,
@@ -266,6 +268,64 @@ export const WithFooter: Story = {
)
};
+function AttachedFooterRender() {
+ const [hasMore, setHasMore] = useState(true);
+ const [isLoading, setIsLoading] = useState(false);
+
+ return (
+ <div>
+ <Table hasAttachedFooter>
+ <TableHeader>
+ <TableRow>
+ <TableHead>Event</TableHead>
+ <TableHead>Timestamp</TableHead>
+ </TableRow>
+ </TableHeader>
+ <TableBody>
+ <TableRow>
+ <TableCell>Secret read</TableCell>
+ <TableCell>Today</TableCell>
+ </TableRow>
+ </TableBody>
+ </Table>
+ <TableAttachedFooter>
+ {hasMore ? (
+ <Button
+ variant="ghost"
+ size="lg"
+ isFullWidth
+ isPending={isLoading}
+ onClick={() => {
+ setIsLoading(true);
+ window.setTimeout(() => {
+ setIsLoading(false);
+ setHasMore(false);
+ }, 1000);
+ }}
+ >
+ Load More
+ </Button>
+ ) : (
+ <span className="text-xs text-muted">End of logs</span>
+ )}
+ </TableAttachedFooter>
+ </div>
+ );
+}
+
+export const WithAttachedFooter: Story = {
+ name: "Example: With Attached Footer",
+ parameters: {
+ docs: {
+ description: {
+ story:
+ "Use `TableAttachedFooter` as a sibling after `Table` for a full-width load-more action or a completion message. Set `hasAttachedFooter` on `Table` to join their borders; unlike `TableFooter`, this action stays outside the table's horizontal scroll area."
+ }
+ }
+ },
+ render: () => <AttachedFooterRender />
+};
+
export const WithSelection: Story = {
name: "Example: With Selection",
parameters: {
diff --git a/frontend/src/components/v3/generic/Table/Table.tsx b/frontend/src/components/v3/generic/Table/Table.tsx
index fa779adbbd..f2b43e970d 100644
--- a/frontend/src/components/v3/generic/Table/Table.tsx
+++ b/frontend/src/components/v3/generic/Table/Table.tsx
@@ -4,14 +4,15 @@ import { cn } from "@app/components/v3/utils";
const Table = React.forwardRef<
HTMLDivElement,
- React.ComponentProps<"table"> & { containerClassName?: string }
->(({ className, containerClassName, ...props }, ref) => {
+ React.ComponentProps<"table"> & { containerClassName?: string; hasAttachedFooter?: boolean }
+>(({ className, containerClassName, hasAttachedFooter = false, ...props }, ref) => {
return (
<div
ref={ref}
data-slot="table-container"
className={cn(
"relative thin-scrollbar w-full min-w-0 overflow-x-auto rounded-md border border-border bg-container",
+ hasAttachedFooter && "rounded-b-none",
containerClassName
)}
>
@@ -26,6 +27,19 @@ const Table = React.forwardRef<
Table.displayName = "Table";
+function TableAttachedFooter({ className, ...props }: React.ComponentProps<"div">) {
+ return (
+ <div
+ data-slot="table-attached-footer"
+ className={cn(
+ "flex min-h-10 items-center justify-center overflow-hidden rounded-b-md border border-t-0 border-border bg-container",
+ className
+ )}
+ {...props}
+ />
+ );
+}
+
function TableHeader({
className,
sticky = false,
@@ -199,6 +213,7 @@ function TableCaption({ className, ...props }: React.ComponentProps<"caption">)
export {
Table,
+ TableAttachedFooter,
TableBody,
TableCaption,
TableCell,
diff --git a/frontend/src/pages/cert-manager/PkiSyncDetailsByIDPage/components/PkiSyncAuditLogsSection.tsx b/frontend/src/pages/cert-manager/PkiSyncDetailsByIDPage/components/PkiSyncAuditLogsSection.tsx
index f03ea1a58b..0f6d2cd561 100644
--- a/frontend/src/pages/cert-manager/PkiSyncDetailsByIDPage/components/PkiSyncAuditLogsSection.tsx
+++ b/frontend/src/pages/cert-manager/PkiSyncDetailsByIDPage/components/PkiSyncAuditLogsSection.tsx
@@ -1,7 +1,18 @@
import { Link } from "@tanstack/react-router";
import { FingerprintIcon } from "lucide-react";
-import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@app/components/v3";
+import {
+ Card,
+ CardContent,
+ CardDescription,
+ CardHeader,
+ CardTitle,
+ Empty,
+ EmptyDescription,
+ EmptyHeader,
+ EmptyMedia,
+ EmptyTitle
+} from "@app/components/v3";
import { useOrganization, useProject, useSubscription } from "@app/context";
import { EventType } from "@app/hooks/api/auditLogs/enums";
import { TPkiSync } from "@app/hooks/api/pkiSyncs";
@@ -25,8 +36,8 @@ export const PkiSyncAuditLogsSection = ({ pkiSync }: Props) => {
const auditLogsRetentionDays = subscription?.auditLogsRetentionDays ?? 30;
return (
- <Card className="max-h-full">
- <CardHeader className="border-b">
+ <Card className="max-h-full min-w-0">
+ <CardHeader>
<CardTitle>Sync Logs</CardTitle>
{subscription.auditLogs && (
<CardDescription>
@@ -49,35 +60,35 @@ export const PkiSyncAuditLogsSection = ({ pkiSync }: Props) => {
}}
/>
) : (
- <div className="flex h-full items-center justify-center rounded-lg bg-surface-raised text-sm text-foreground-secondary">
- <div className="flex flex-col items-center gap-4 py-20">
- <FingerprintIcon className="size-8" />
- <p>
- Please{" "}
+ <Empty className="border">
+ <EmptyHeader>
+ <EmptyMedia variant="icon">
+ <FingerprintIcon />
+ </EmptyMedia>
+ <EmptyTitle>Audit logs require an upgrade</EmptyTitle>
+ <EmptyDescription>
{subscription && subscription.slug !== null ? (
<Link
to="/organizations/$orgId/billing"
params={{ orgId: currentOrg.id }}
target="_blank"
rel="noopener noreferrer"
- className="cursor-pointer underline transition-all hover:text-foreground-inverse"
>
- upgrade your subscription
+ Upgrade your subscription
</Link>
) : (
<a
href="https://infisical.com/scheduledemo"
target="_blank"
rel="noopener noreferrer"
- className="cursor-pointer underline transition-all hover:text-foreground-inverse"
>
- upgrade your subscription
+ Upgrade your subscription
</a>
)}{" "}
to view sync logs.
- </p>
- </div>
- </div>
+ </EmptyDescription>
+ </EmptyHeader>
+ </Empty>
)}
</CardContent>
</Card>
diff --git a/frontend/src/pages/organization/AuditLogsPage/components/LogFilterItem.tsx b/frontend/src/pages/organization/AuditLogsPage/components/LogFilterItem.tsx
index 1e996432c9..ba7db55372 100644
--- a/frontend/src/pages/organization/AuditLogsPage/components/LogFilterItem.tsx
+++ b/frontend/src/pages/organization/AuditLogsPage/components/LogFilterItem.tsx
@@ -1,28 +1,20 @@
import { Info } from "lucide-react";
import { twMerge } from "tailwind-merge";
-import { Button, Tooltip, TooltipContent, TooltipTrigger } from "@app/components/v3";
+import { Tooltip, TooltipContent, TooltipTrigger } from "@app/components/v3";
type Props = {
hoverTooltip?: string;
className?: string;
label: string;
- onClear: () => void;
children: React.ReactNode;
tooltipText?: string;
};
-export const LogFilterItem = ({
- label,
- onClear,
- hoverTooltip,
- children,
- className,
- tooltipText
-}: Props) => {
+export const LogFilterItem = ({ label, hoverTooltip, children, className, tooltipText }: Props) => {
return (
- <div className={twMerge("flex flex-col justify-between", className)}>
- <div className="flex items-center pr-1">
+ <div className={twMerge("flex min-w-0 flex-col gap-1", className)}>
+ <div className="flex items-center gap-1">
<p className="text-xs text-muted">{label}</p>
{tooltipText && (
<Tooltip>
@@ -32,14 +24,6 @@ export const LogFilterItem = ({
<TooltipContent className="max-w-sm">{tooltipText}</TooltipContent>
</Tooltip>
)}
- <Button
- onClick={() => onClear()}
- variant="ghost"
- size="xs"
- className="ml-auto h-auto px-1.5 py-0.5 text-xs font-normal text-muted hover:text-foreground"
- >
- Clear
- </Button>
</div>
{hoverTooltip ? (
<Tooltip>
diff --git a/frontend/src/pages/organization/AuditLogsPage/components/LogsFilter.tsx b/frontend/src/pages/organization/AuditLogsPage/components/LogsFilter.tsx
index 3a1f0cd1c8..c801612d85 100644
--- a/frontend/src/pages/organization/AuditLogsPage/components/LogsFilter.tsx
+++ b/frontend/src/pages/organization/AuditLogsPage/components/LogsFilter.tsx
@@ -1,22 +1,23 @@
/* eslint-disable no-nested-ternary */
import { useMemo } from "react";
import { Controller, useForm } from "react-hook-form";
-import { MultiValue, SingleValue } from "react-select";
import { zodResolver } from "@hookform/resolvers/zod";
import { ListFilter } from "lucide-react";
-import { AnimatePresence, motion } from "motion/react";
import { twMerge } from "tailwind-merge";
import {
Badge,
Button,
- DropdownMenu,
- DropdownMenuContent,
- DropdownMenuTrigger,
+ ButtonBadge,
+ Combobox,
Field,
FieldError,
- FilterableSelect,
- Input
+ IconButton,
+ Input,
+ Popover,
+ PopoverContent,
+ PopoverTrigger,
+ Separator
} from "@app/components/v3";
import { useOrganization } from "@app/context";
import { isOrgScopedProduct } from "@app/helpers/project";
@@ -79,20 +80,25 @@ export const LogsFilter = ({ presets, setFilter, filter, project }: Props) => {
const workspacesInOrg = workspaces.filter((ws) => ws.orgId === currentOrg?.id);
- const { control, watch, resetField, setValue, handleSubmit, formState } =
- useForm<TAuditLogFilterFormData>({
- resolver: zodResolver(auditLogFilterFormSchema),
- defaultValues: {
- project: null,
- environment: undefined,
- secretKey: "",
- secretPath: "",
- actor: presets?.actorId,
- eventType: filter?.eventType || [],
- userAgentType: undefined
- },
- values: filter
- });
+ const { control, watch, setValue, handleSubmit, formState } = useForm<TAuditLogFilterFormData>({
+ resolver: zodResolver(auditLogFilterFormSchema),
+ defaultValues: {
+ project: null,
+ environment: null,
+ secretKey: "",
+ secretPath: "",
+ actor: presets?.actorId,
+ eventType: filter?.eventType || [],
+ userAgentType: null
+ },
+ values: {
+ ...filter,
+ environment: filter.environment ?? null,
+ userAgentType: filter.userAgentType ?? null,
+ secretPath: filter.secretPath ?? "",
+ secretKey: filter.secretKey ?? ""
+ }
+ });
const selectedEventTypes = watch("eventType") as EventType[] | undefined;
const selectedProject = project ?? watch("project");
@@ -120,107 +126,136 @@ export const LogsFilter = ({ presets, setFilter, filter, project }: Props) => {
const activeFilterCount = getActiveFilterCount(filter);
return (
- <DropdownMenu>
- <DropdownMenuTrigger asChild>
- <Button variant="outline" className="relative">
+ <Popover>
+ <PopoverTrigger asChild>
+ <IconButton
+ variant="outline"
+ size="sm"
+ className="relative"
+ aria-label={`Filter audit logs, ${activeFilterCount} active ${activeFilterCount === 1 ? "filter" : "filters"}`}
+ >
<ListFilter />
{activeFilterCount > 0 && (
- <Badge className="absolute -top-2 -right-2" variant="info">
+ <ButtonBadge variant="info" isSquare>
{activeFilterCount}
- </Badge>
+ </ButtonBadge>
)}
- </Button>
- </DropdownMenuTrigger>
- <DropdownMenuContent align="end" className="overflow-x-visible overflow-y-visible py-2">
- <form onSubmit={handleSubmit(setFilter)}>
- <div className="flex max-w-96 min-w-96 flex-col font-inter">
- <div className="mb-3 flex items-center border-b border-b-border px-3 pb-2">
- <div className="flex w-full items-center justify-between">
- <div className="flex items-center gap-2">
- <span>Filters</span>
- <Badge isSquare variant="info">
- {activeFilterCount}
- </Badge>
- </div>
- <Button
- onClick={() => {
- setFilter({
- eventType: presets?.eventType || [],
- actor: presets?.actorId,
- userAgentType: undefined,
- project: null,
- secretPath: undefined,
- secretKey: undefined
- });
- }}
- variant="ghost"
- className="h-auto px-1.5 py-0.5 font-normal text-muted hover:text-foreground"
- size="xs"
- >
- Clear filters
- </Button>
- </div>
+ </IconButton>
+ </PopoverTrigger>
+ <PopoverContent
+ align="end"
+ aria-label="Audit log filters"
+ className="max-h-(--radix-popover-content-available-height) w-96 max-w-[calc(100vw-1rem)] overflow-y-auto"
+ >
+ <form onSubmit={handleSubmit(setFilter)} className="space-y-4">
+ <div className="flex items-center justify-between">
+ <div className="flex items-center gap-2">
+ <span className="text-sm font-medium">Filters</span>
+ <Badge isSquare variant="info">
+ {activeFilterCount}
+ </Badge>
</div>
+ <Button
+ onClick={() => {
+ setFilter({
+ eventType: presets?.eventType || [],
+ actor: presets?.actorId,
+ userAgentType: null,
+ project: null,
+ secretPath: undefined,
+ secretKey: undefined
+ });
+ }}
+ variant="ghost"
+ size="xs"
+ >
+ Clear Filters
+ </Button>
+ </div>
- <div className="px-3">
- <LogFilterItem
- label="Events"
- onClear={() => {
- setValue("eventType", [], { shouldDirty: true });
- }}
- >
- <Controller
- control={control}
- name="eventType"
- render={({ field }) => (
- <Field>
- <FilterableSelect
- value={filteredEventTypes.filter((eventType) =>
- field.value.includes(eventType.value as EventType)
- )}
- isMulti
- isClearable
- onChange={(options) =>
- field.onChange(
- (options as MultiValue<(typeof filteredEventTypes)[number]>).map(
- (option) => option.value
- )
- )
- }
- placeholder="All events"
- options={filteredEventTypes}
- getOptionValue={(option) => option.value}
- getOptionLabel={(option) => option.label}
- />
- </Field>
- )}
- />
- </LogFilterItem>
- <LogFilterItem
- label="Source"
- onClear={() => {
- setValue("userAgentType", undefined, { shouldDirty: true });
- }}
- >
+ <div className="grid grid-cols-1 gap-3 sm:grid-cols-2">
+ <LogFilterItem label="Events" className="sm:col-span-2">
+ <Controller
+ control={control}
+ name="eventType"
+ render={({ field }) => (
+ <Field>
+ <Combobox
+ aria-label="Events"
+ clearAriaLabel="Clear events"
+ value={filteredEventTypes.filter((eventType) =>
+ field.value.includes(eventType.value as EventType)
+ )}
+ multiple
+ isSelectAll
+ isClearable
+ onValueChange={(options) =>
+ field.onChange(options.map((option) => option.value))
+ }
+ placeholder="All events"
+ options={filteredEventTypes}
+ getOptionValue={(option) => option.value}
+ getOptionLabel={(option) => option.label}
+ />
+ </Field>
+ )}
+ />
+ </LogFilterItem>
+ <LogFilterItem label="Source">
+ <Controller
+ control={control}
+ name="userAgentType"
+ render={({ field: { onChange, value }, fieldState: { error } }) => (
+ <Field>
+ <Combobox
+ aria-label="Source"
+ clearAriaLabel="Clear source"
+ value={
+ userAgentTypes.find(
+ (userAgentType) => value === (userAgentType.value as UserAgentType)
+ ) ?? null
+ }
+ isClearable
+ onValueChange={(option) => onChange(option?.value ?? null)}
+ placeholder="All sources"
+ options={userAgentTypes}
+ getOptionValue={(option) => option.value}
+ getOptionLabel={(option) => option.label}
+ isError={Boolean(error)}
+ />
+ <FieldError errors={[error]} />
+ </Field>
+ )}
+ />
+ </LogFilterItem>
+ {!project && (
+ <LogFilterItem label="Project">
<Controller
control={control}
- name="userAgentType"
+ name="project"
render={({ field: { onChange, value }, fieldState: { error } }) => (
<Field>
- <FilterableSelect
- value={
- userAgentTypes.find(
- (userAgentType) => value === (userAgentType.value as UserAgentType)
- ) ?? null
- }
+ <Combobox
+ aria-label="Project"
+ clearAriaLabel="Clear project"
+ value={value ?? null}
isClearable
- onChange={(option) =>
- onChange((option as SingleValue<(typeof userAgentTypes)[number]>)?.value)
- }
- placeholder="All sources"
- options={userAgentTypes}
- getOptionValue={(option) => option.value}
- getOptionLabel={(option) => option.label}
+ onValueChange={(e) => {
+ if (e === null) {
+ setValue("secretPath", "");
+ setValue("secretKey", "");
+ }
+ setValue("environment", null, { shouldDirty: true });
+ onChange(e);
+ }}
+ placeholder="All projects"
+ options={workspacesInOrg.map(({ name, id, type }) => ({
+ name,
+ id,
+ type
+ }))}
+ getOptionValue={(option) => option.id}
+ getOptionLabel={(option) => option.name}
isError={Boolean(error)}
/>
<FieldError errors={[error]} />
@@ -228,39 +263,40 @@ export const LogsFilter = ({ presets, setFilter, filter, project }: Props) => {
)}
/>
</LogFilterItem>
- {!project && (
+ )}
+ {showSecretsSection && (
+ <div className="grid grid-cols-1 gap-3 sm:col-span-2 sm:grid-cols-2">
+ <div className="flex items-center gap-3 sm:col-span-2">
+ <p className="text-xs text-muted">Secrets</p>
+ <Separator className="flex-1" />
+ </div>
<LogFilterItem
- label="Project"
- onClear={() => {
- setValue("project", null, { shouldDirty: true });
- setValue("environment", undefined, { shouldDirty: true });
- setValue("secretPath", "", { shouldDirty: true });
- setValue("secretKey", "", { shouldDirty: true });
- }}
+ label="Environment"
+ hoverTooltip={
+ !selectedProject
+ ? "Select a project before filtering by environment."
+ : undefined
+ }
+ className={twMerge("sm:col-span-2", !selectedProject && "opacity-50")}
>
<Controller
control={control}
- name="project"
+ name="environment"
render={({ field: { onChange, value }, fieldState: { error } }) => (
<Field>
- <FilterableSelect
- value={value}
+ <Combobox
+ aria-label="Environment"
+ clearAriaLabel="Clear environment"
+ value={value ?? null}
isClearable
- onChange={(e) => {
- if (e === null) {
- setValue("secretPath", "");
- setValue("secretKey", "");
- }
- resetField("environment");
- onChange(e);
- }}
- placeholder="All projects"
- options={workspacesInOrg.map(({ name, id, type }) => ({
+ isDisabled={!selectedProject}
+ onValueChange={onChange}
+ placeholder="All environments"
+ options={availableEnvironments.map(({ name, slug }) => ({
name,
- id,
- type
+ slug
}))}
- getOptionValue={(option) => option.id}
+ getOptionValue={(option) => option.slug}
getOptionLabel={(option) => option.name}
isError={Boolean(error)}
/>
@@ -269,135 +305,71 @@ export const LogsFilter = ({ presets, setFilter, filter, project }: Props) => {
)}
/>
</LogFilterItem>
- )}
- <AnimatePresence initial={false}>
- {showSecretsSection && (
- <motion.div
- initial={{ opacity: 0, height: 0 }}
- animate={{ opacity: 1, height: "auto" }}
- exit={{ opacity: 0, height: 0 }}
- transition={{ duration: 0.3 }}
- >
- <div className="mt-2 mb-3">
- <p className="text-xs text-muted">Secrets</p>
- <div className="h-px w-full rounded-full bg-border" />
- </div>
- <LogFilterItem
- label="Environment"
- hoverTooltip={
- !selectedProject
- ? "Select a project before filtering by environment."
- : undefined
- }
- className={twMerge(!selectedProject && "opacity-50")}
- onClear={() => {
- setValue("environment", undefined, { shouldDirty: true });
- }}
- >
- <Controller
- control={control}
- name="environment"
- render={({ field: { onChange, value }, fieldState: { error } }) => (
- <Field>
- <FilterableSelect
- value={value}
- menuPlacement="top"
- key={value?.name || "filter-environment"}
- isClearable
- isDisabled={!selectedProject}
- onChange={(e) => onChange(e)}
- placeholder="All environments"
- options={availableEnvironments.map(({ name, slug }) => ({
- name,
- slug
- }))}
- getOptionValue={(option) => option.slug}
- getOptionLabel={(option) => option.name}
- isError={Boolean(error)}
- />
- <FieldError errors={[error]} />
- </Field>
- )}
- />
- </LogFilterItem>
- <LogFilterItem
- label="Secret Path"
- tooltipText="Enter the exact secret path (wildcards like * are not supported)"
- hoverTooltip={
- !selectedProject
- ? "Select a project before filtering by secret path."
- : undefined
- }
- className={twMerge(!selectedProject && "opacity-50")}
- onClear={() => {
- setValue("secretPath", "", { shouldDirty: true });
- }}
- >
- <Controller
- control={control}
- name="secretPath"
- render={({ field: { onChange, value, ...field } }) => (
- <Field>
- <Input
- placeholder="Enter secret path"
- disabled={!selectedProject}
- {...field}
- value={value}
- onChange={(e) => onChange(e.target.value)}
- />
- </Field>
- )}
- />
- </LogFilterItem>
+ <LogFilterItem
+ label="Secret Path"
+ tooltipText="Enter the exact secret path (wildcards like * are not supported)"
+ hoverTooltip={
+ !selectedProject
+ ? "Select a project before filtering by secret path."
+ : undefined
+ }
+ className={twMerge(!selectedProject && "opacity-50")}
+ >
+ <Controller
+ control={control}
+ name="secretPath"
+ render={({ field: { onChange, value, ...field } }) => (
+ <Field>
+ <Input
+ placeholder="Enter secret path"
+ disabled={!selectedProject}
+ {...field}
+ value={value}
+ onChange={(e) => onChange(e.target.value)}
+ />
+ </Field>
+ )}
+ />
+ </LogFilterItem>
- <LogFilterItem
- hoverTooltip={
- !selectedProject
- ? "Select a project before filtering by secret key."
- : undefined
- }
- tooltipText="Enter the exact secret key name (wildcards like * are not supported)"
- className={twMerge(!selectedProject && "opacity-50")}
- label="Secret Key"
- onClear={() => {
- setValue("secretKey", "", { shouldDirty: true });
- }}
- >
- <Controller
- control={control}
- name="secretKey"
- render={({ field: { onChange, value, ...field } }) => (
- <Field>
- <Input
- disabled={!selectedProject}
- {...field}
- placeholder="Enter secret key"
- value={value}
- onChange={(e) =>
- setValue("secretKey", e.target.value, { shouldDirty: true })
- }
- />
- </Field>
- )}
- />
- </LogFilterItem>
- </motion.div>
- )}
- </AnimatePresence>
- </div>
- <div className="mt-2 px-3">
- <Button
- size="xs"
- type="submit"
- variant={scopeVariant}
- isDisabled={!formState.isDirty}
- >
- Apply
- </Button>
- </div>
+ <LogFilterItem
+ hoverTooltip={
+ !selectedProject
+ ? "Select a project before filtering by secret key."
+ : undefined
+ }
+ tooltipText="Enter the exact secret key name (wildcards like * are not supported)"
+ className={twMerge(!selectedProject && "opacity-50")}
+ label="Secret Key"
+ >
+ <Controller
+ control={control}
+ name="secretKey"
+ render={({ field: { onChange, value, ...field } }) => (
+ <Field>
+ <Input
+ disabled={!selectedProject}
+ {...field}
+ placeholder="Enter secret key"
+ value={value}
+ onChange={(e) =>
+ setValue("secretKey", e.target.value, { shouldDirty: true })
+ }
+ />
+ </Field>
+ )}
+ />
+ </LogFilterItem>
+ </div>
+ )}
+ </div>
+ <div className="flex justify-end">
+ <Button size="sm" type="submit" variant={scopeVariant} isDisabled={!formState.isDirty}>
+ Apply
+ </Button>
</div>
</form>
- </DropdownMenuContent>
- </DropdownMenu>
+ </PopoverContent>
+ </Popover>
);
};
diff --git a/frontend/src/pages/organization/AuditLogsPage/components/LogsSection.tsx b/frontend/src/pages/organization/AuditLogsPage/components/LogsSection.tsx
index acbc4b2e53..bea36bfacd 100644
--- a/frontend/src/pages/organization/AuditLogsPage/components/LogsSection.tsx
+++ b/frontend/src/pages/organization/AuditLogsPage/components/LogsSection.tsx
@@ -202,7 +202,7 @@ const LogsSectionComponent = ({
actorType: searchDerived.actorType || presets?.actorType,
eventType:
searchDerived.eventType.length > 0 ? searchDerived.eventType : logFilter?.eventType,
- userAgentType: searchDerived.userAgentType || logFilter?.userAgentType,
+ userAgentType: searchDerived.userAgentType || logFilter?.userAgentType || undefined,
environment: searchDerived.environment || logFilter?.environment?.slug,
secretPath: searchDerived.secretPath,
secretKey: searchDerived.secretKey,
@@ -225,7 +225,7 @@ const LogsSectionComponent = ({
);
return (
- <div className="space-y-2">
+ <div className="space-y-4">
{showClickHouseWarning && (
<Alert variant="warning">
<AlertDescription>
@@ -254,8 +254,8 @@ const LogsSectionComponent = ({
</AlertDescription>
</Alert>
)}
- <div className="flex flex-wrap items-center gap-2 lg:justify-end">
- {showFilters && (
+ {showFilters && (
+ <div className="flex flex-wrap items-center justify-between gap-2">
<ButtonGroup>
<DateRangeQuickPresets
value={activePreset}
@@ -275,11 +275,11 @@ const LogsSectionComponent = ({
accent={dateRangeAccent}
/>
</ButtonGroup>
- )}
- {showFilters && (
- <LogsFilter presets={presets} setFilter={setLogFilter} filter={logFilter} />
- )}
- </div>
+ <div className="ml-auto">
+ <LogsFilter presets={presets} setFilter={setLogFilter} filter={logFilter} />
+ </div>
+ </div>
+ )}
<LogsTable
refetchInterval={refetchInterval}
filter={{
@@ -290,7 +290,7 @@ const LogsSectionComponent = ({
actorType: presets?.actorType,
limit: 15,
eventType: logFilter?.eventType,
- userAgentType: logFilter?.userAgentType,
+ userAgentType: logFilter?.userAgentType ?? undefined,
startDate: dateRange.startDate,
endDate: dateRange.endDate,
environment: logFilter?.environment?.slug,
diff --git a/frontend/src/pages/organization/AuditLogsPage/components/LogsTable.tsx b/frontend/src/pages/organization/AuditLogsPage/components/LogsTable.tsx
index 43cc75e373..804e15680a 100644
--- a/frontend/src/pages/organization/AuditLogsPage/components/LogsTable.tsx
+++ b/frontend/src/pages/organization/AuditLogsPage/components/LogsTable.tsx
@@ -9,6 +9,7 @@ import {
EmptyTitle,
Skeleton,
Table,
+ TableAttachedFooter,
TableBody,
TableCell,
TableHead,
@@ -16,7 +17,7 @@ import {
TableRow
} from "@app/components/v3";
import { Timezone } from "@app/helpers/datetime";
-import { usePopUp, useScopeVariant } from "@app/hooks";
+import { usePopUp } from "@app/hooks";
import { useFetchServerStatus, useGetAuditLogs } from "@app/hooks/api";
import { TGetAuditLogsFilter } from "@app/hooks/api/auditLogs/types";
@@ -33,7 +34,6 @@ const AUDIT_LOG_LIMIT = 30;
export const LogsTable = ({ filter, refetchInterval, timezone }: Props) => {
const { data: status } = useFetchServerStatus();
- const scopeVariant = useScopeVariant();
const { popUp, handlePopUpOpen, handlePopUpToggle } = usePopUp(["logDetails"] as const);
// Determine the project ID for filtering
@@ -54,7 +54,6 @@ export const LogsTable = ({ filter, refetchInterval, timezone }: Props) => {
);
const isEmpty = !isPending && !data?.pages?.[0].length;
- const totalLoaded = data?.pages?.reduce((sum, page) => sum + page.length, 0) ?? 0;
if (isEmpty) {
return (
@@ -75,7 +74,7 @@ export const LogsTable = ({ filter, refetchInterval, timezone }: Props) => {
return (
<div>
- <Table>
+ <Table hasAttachedFooter={!isPending}>
<TableHeader>
<TableRow>
<TableHead className="w-16">
@@ -124,16 +123,21 @@ export const LogsTable = ({ filter, refetchInterval, timezone }: Props) => {
</TableBody>
</Table>
{!isPending && (
- <Button
- className="mt-4"
- isFullWidth
- variant={scopeVariant}
- isPending={isFetchingNextPage}
- isDisabled={isFetchingNextPage || !hasNextPage}
- onClick={() => fetchNextPage()}
- >
- {hasNextPage ? `Load More (${totalLoaded} loaded)` : `End of logs (${totalLoaded} total)`}
- </Button>
+ <TableAttachedFooter>
+ {hasNextPage ? (
+ <Button
+ size="lg"
+ variant="ghost"
+ isFullWidth
+ isPending={isFetchingNextPage}
+ onClick={() => fetchNextPage()}
+ >
+ Load More
+ </Button>
+ ) : (
+ <span className="text-xs text-muted">End of logs</span>
+ )}
+ </TableAttachedFooter>
)}
<AuditLogDetailsSheet
isOpen={popUp.logDetails.isOpen}
diff --git a/frontend/src/pages/organization/AuditLogsPage/components/types.tsx b/frontend/src/pages/organization/AuditLogsPage/components/types.tsx
index ee51b0eaf5..af54e03ea3 100644
--- a/frontend/src/pages/organization/AuditLogsPage/components/types.tsx
+++ b/frontend/src/pages/organization/AuditLogsPage/components/types.tsx
@@ -18,7 +18,7 @@ export const auditLogFilterFormSchema = z.object({
environment: z.object({ name: z.string(), slug: z.string() }).optional().nullable(),
eventType: z.nativeEnum(EventType).array(),
actor: z.string().optional(),
- userAgentType: z.nativeEnum(UserAgentType).optional(),
+ userAgentType: z.nativeEnum(UserAgentType).nullish(),
secretPath: z.string().optional(),
secretKey: z.string().optional(),
page: z.coerce.number().optional(),
diff --git a/frontend/src/pages/organization/UserDetailsByIDPage/components/UserProjectsSection/UserAuditLogsSection.tsx b/frontend/src/pages/organization/UserDetailsByIDPage/components/UserProjectsSection/UserAuditLogsSection.tsx
index b0d7fc3ea0..90789b03c1 100644
--- a/frontend/src/pages/organization/UserDetailsByIDPage/components/UserProjectsSection/UserAuditLogsSection.tsx
+++ b/frontend/src/pages/organization/UserDetailsByIDPage/components/UserProjectsSection/UserAuditLogsSection.tsx
@@ -1,3 +1,4 @@
+import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@app/components/v3";
import { OrgPermissionMemberActions, OrgPermissionSubjects, useSubscription } from "@app/context";
import { withPermission } from "@app/hoc";
import { OrgUser } from "@app/hooks/api/types";
@@ -11,19 +12,23 @@ export const UserAuditLogsSection = withPermission(
({ orgMembership }: Props) => {
const { subscription } = useSubscription();
- // eslint-disable-next-line no-nested-ternary
return (
subscription?.auditLogs && (
- <div className="w-full rounded-lg border border-border-control bg-surface-base p-4">
- <div className="mb-4 flex items-center justify-between border-b border-border-emphasis pb-4">
- <p className="text-lg font-medium text-foreground-cool">Audit Logs</p>
- </div>
- <LogsSection
- presets={{
- actorId: orgMembership.user.id
- }}
- />
- </div>
+ <Card className="min-w-0">
+ <CardHeader>
+ <CardTitle>Audit Logs</CardTitle>
+ <CardDescription>
+ Review this user&apos;s activity across the organization.
+ </CardDescription>
+ </CardHeader>
+ <CardContent>
+ <LogsSection
+ presets={{
+ actorId: orgMembership.user.id
+ }}
+ />
+ </CardContent>
+ </Card>
)
);
},
diff --git a/frontend/src/pages/secret-manager/IntegrationsDetailsByIDPage/components/IntegrationAuditLogsSection.tsx b/frontend/src/pages/secret-manager/IntegrationsDetailsByIDPage/components/IntegrationAuditLogsSection.tsx
index 629df17ae2..3216da7b0d 100644
--- a/frontend/src/pages/secret-manager/IntegrationsDetailsByIDPage/components/IntegrationAuditLogsSection.tsx
+++ b/frontend/src/pages/secret-manager/IntegrationsDetailsByIDPage/components/IntegrationAuditLogsSection.tsx
@@ -1,6 +1,18 @@
import { Link } from "@tanstack/react-router";
+import { FingerprintIcon } from "lucide-react";
-import { EmptyState } from "@app/components/v2";
+import {
+ Card,
+ CardContent,
+ CardDescription,
+ CardHeader,
+ CardTitle,
+ Empty,
+ EmptyDescription,
+ EmptyHeader,
+ EmptyMedia,
+ EmptyTitle
+} from "@app/components/v3";
import { useOrganization, useProject, useSubscription } from "@app/context";
import { EventType } from "@app/hooks/api/auditLogs/enums";
import { TIntegrationWithEnv } from "@app/hooks/api/integrations/types";
@@ -20,72 +32,62 @@ export const IntegrationAuditLogsSection = ({ integration }: Props) => {
const auditLogsRetentionDays = subscription?.auditLogsRetentionDays ?? 30;
- // eslint-disable-next-line no-nested-ternary
- return subscription?.auditLogs ? (
- <div className="h-full w-full min-w-204 rounded-lg border border-border-control bg-surface-base p-4">
- <div className="mb-4 flex items-center justify-between border-b border-border-emphasis pb-4">
- <p className="text-lg font-medium text-foreground-cool">Integration Logs</p>
- <p className="text-xs text-muted-cool">
- Displaying audit logs from the last {Math.min(auditLogsRetentionDays, 60)} days
- </p>
- </div>
- <LogsSection
- refetchInterval={15_000}
- showFilters={false}
- project={currentProject}
- presets={{
- eventMetadata: { integrationId: integration.id },
- startDate: new Date(
- new Date().setDate(new Date().getDate() - Math.min(auditLogsRetentionDays, 60))
- ),
- eventType: INTEGRATION_EVENTS
- }}
- />
- </div>
- ) : (
- <div className="h-full w-full min-w-204 rounded-lg border border-border-control bg-surface-base p-4 opacity-60">
- <div className="mb-4 flex items-center justify-between border-b border-border-emphasis pb-4">
- <p className="text-lg font-medium text-foreground-cool">Integration Logs</p>
- </div>
- <EmptyState
- className="rounded-lg"
- title={
- <div>
- <p>
- Please{" "}
- {subscription && subscription.slug !== null ? (
- <Link
- to="/organizations/$orgId/billing"
- params={{ orgId: currentOrg.id }}
- target="_blank"
- rel="noopener noreferrer"
- >
- <a
- className="cursor-pointer font-medium text-project transition-all hover:text-project"
+ return (
+ <Card className="min-w-0">
+ <CardHeader>
+ <CardTitle>Integration Logs</CardTitle>
+ {subscription?.auditLogs && (
+ <CardDescription>
+ Displaying audit logs from the last {Math.min(auditLogsRetentionDays, 60)} days
+ </CardDescription>
+ )}
+ </CardHeader>
+ <CardContent>
+ {subscription?.auditLogs ? (
+ <LogsSection
+ refetchInterval={15_000}
+ showFilters={false}
+ project={currentProject}
+ presets={{
+ eventMetadata: { integrationId: integration.id },
+ startDate: new Date(
+ new Date().setDate(new Date().getDate() - Math.min(auditLogsRetentionDays, 60))
+ ),
+ eventType: INTEGRATION_EVENTS
+ }}
+ />
+ ) : (
+ <Empty className="border">
+ <EmptyHeader>
+ <EmptyMedia variant="icon">
+ <FingerprintIcon />
+ </EmptyMedia>
+ <EmptyTitle>Audit logs require an upgrade</EmptyTitle>
+ <EmptyDescription>
+ {subscription && subscription.slug !== null ? (
+ <Link
+ to="/organizations/$orgId/billing"
+ params={{ orgId: currentOrg.id }}
target="_blank"
+ rel="noopener noreferrer"
>
- upgrade your subscription
- </a>
- </Link>
- ) : (
- <a
- href="https://infisical.com/scheduledemo"
- target="_blank"
- rel="noopener noreferrer"
- >
+ Upgrade your subscription
+ </Link>
+ ) : (
<a
- className="cursor-pointer font-medium text-project transition-all hover:text-project"
+ href="https://infisical.com/scheduledemo"
target="_blank"
+ rel="noopener noreferrer"
>
- upgrade your subscription
+ Upgrade your subscription
</a>
- </a>
- )}{" "}
- to view integration logs
- </p>
- </div>
- }
- />
- </div>
+ )}{" "}
+ to view integration logs.
+ </EmptyDescription>
+ </EmptyHeader>
+ </Empty>
+ )}
+ </CardContent>
+ </Card>
);
};
diff --git a/frontend/src/pages/secret-manager/SecretSyncDetailsByIDPage/components/SecretSyncAuditLogsSection.tsx b/frontend/src/pages/secret-manager/SecretSyncDetailsByIDPage/components/SecretSyncAuditLogsSection.tsx
index 0937b6957d..a1b94f8574 100644
--- a/frontend/src/pages/secret-manager/SecretSyncDetailsByIDPage/components/SecretSyncAuditLogsSection.tsx
+++ b/frontend/src/pages/secret-manager/SecretSyncDetailsByIDPage/components/SecretSyncAuditLogsSection.tsx
@@ -10,7 +10,12 @@ import {
CardContent,
CardDescription,
CardHeader,
- CardTitle
+ CardTitle,
+ Empty,
+ EmptyDescription,
+ EmptyHeader,
+ EmptyMedia,
+ EmptyTitle
} from "@app/components/v3";
import { useOrganization, useProject, useSubscription } from "@app/context";
import { ProjectPermissionSecretSyncActions } from "@app/context/ProjectPermissionContext/types";
@@ -55,8 +60,8 @@ export const SecretSyncAuditLogsSection = ({ secretSync }: Props) => {
};
return (
- <Card className="max-h-full">
- <CardHeader className="border-b">
+ <Card className="max-h-full min-w-0">
+ <CardHeader>
<CardTitle>Sync Logs</CardTitle>
{subscription.auditLogs && (
<CardDescription>
@@ -97,11 +102,13 @@ export const SecretSyncAuditLogsSection = ({ secretSync }: Props) => {
}}
/>
) : (
- <div className="flex h-full items-center justify-center rounded-lg bg-surface-raised text-sm text-foreground-secondary">
- <div className="flex flex-col items-center gap-4 py-20">
- <FingerprintIcon className="size-8" />
- <p>
- Please{" "}
+ <Empty className="border">
+ <EmptyHeader>
+ <EmptyMedia variant="icon">
+ <FingerprintIcon />
+ </EmptyMedia>
+ <EmptyTitle>Audit logs require an upgrade</EmptyTitle>
+ <EmptyDescription>
{subscription && subscription.slug !== null ? (
<Link
to="/organizations/$orgId/billing"
@@ -109,12 +116,7 @@ export const SecretSyncAuditLogsSection = ({ secretSync }: Props) => {
target="_blank"
rel="noopener noreferrer"
>
- <a
- className="cursor-pointer underline transition-all hover:text-foreground-inverse"
- target="_blank"
- >
- upgrade your subscription
- </a>
+ Upgrade your subscription
</Link>
) : (
<a
@@ -122,18 +124,13 @@ export const SecretSyncAuditLogsSection = ({ secretSync }: Props) => {
target="_blank"
rel="noopener noreferrer"
>
- <a
- className="cursor-pointer underline transition-all hover:text-foreground-inverse"
- target="_blank"
- >
- upgrade your subscription
- </a>
+ Upgrade your subscription
</a>
)}{" "}
to view sync logs.
- </p>
- </div>
- </div>
+ </EmptyDescription>
+ </EmptyHeader>
+ </Empty>
)}
</CardContent>
</Card>