diff --git a/frontend/src/components/v2/DatePicker/DatePicker.tsx b/frontend/src/components/v2/DatePicker/DatePicker.tsx index 291a22206..528e25ca8 100644 --- a/frontend/src/components/v2/DatePicker/DatePicker.tsx +++ b/frontend/src/components/v2/DatePicker/DatePicker.tsx @@ -14,6 +14,7 @@ export type DatePickerProps = Omit & { onChange: (date?: Date) => void; popUpProps: PopoverProps; popUpContentProps: PopoverContentProps; + dateFormat?: "PPP" | "PP" | "P"; // extend as needed }; // Doc: https://react-day-picker.js.org/ @@ -22,6 +23,7 @@ export const DatePicker = ({ onChange, popUpProps, popUpContentProps, + dateFormat = "PPP", ...props }: DatePickerProps) => { const [timeValue, setTimeValue] = useState(value ? format(value, "HH:mm") : "00:00"); @@ -53,7 +55,7 @@ export const DatePicker = ({ diff --git a/frontend/src/components/v2/FilterableSelect/FilterableSelect.tsx b/frontend/src/components/v2/FilterableSelect/FilterableSelect.tsx index 7a386d04e..450b58aef 100644 --- a/frontend/src/components/v2/FilterableSelect/FilterableSelect.tsx +++ b/frontend/src/components/v2/FilterableSelect/FilterableSelect.tsx @@ -53,7 +53,7 @@ export const FilterableSelect = ({ indicatorSeparator: () => "bg-bunker-400", dropdownIndicator: () => "text-bunker-200 p-1", menu: () => - "mt-2 border text-sm text-mineshaft-200 bg-mineshaft-900 border-mineshaft-600 rounded-md", + "mt-2 border text-sm text-mineshaft-200 thin-scrollbar bg-mineshaft-900 border-mineshaft-600 rounded-md", groupHeading: () => "ml-3 mt-2 mb-1 text-mineshaft-400 text-sm", option: ({ isFocused, isSelected }) => twMerge( diff --git a/frontend/src/views/Org/AuditLogsPage/components/LogsFilter.tsx b/frontend/src/views/Org/AuditLogsPage/components/LogsFilter.tsx index 2447acbeb..3ac1cf8a3 100644 --- a/frontend/src/views/Org/AuditLogsPage/components/LogsFilter.tsx +++ b/frontend/src/views/Org/AuditLogsPage/components/LogsFilter.tsx @@ -12,6 +12,7 @@ import { DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger, + FilterableSelect, FormControl, Select, SelectItem @@ -64,7 +65,7 @@ export const LogsFilter = ({ useEffect(() => { if (workspacesInOrg.length) { - setValue("projectId", workspacesInOrg[0].id); + setValue("project", workspacesInOrg[0]); } }, [workspaces]); @@ -111,11 +112,34 @@ export const LogsFilter = ({ return (
-
+ {isOrgAuditLogs && workspacesInOrg.length > 0 && ( + ( + + ({ name, id }))} + getOptionValue={(option) => option.id} + getOptionLabel={(option) => option.name} + /> + + )} + /> + )} +
-
+
{selectedEventTypes?.length === 1 ? eventTypes.find((eventType) => eventType.value === selectedEventTypes[0]) ?.label @@ -235,37 +259,6 @@ export const LogsFilter = ({ )} /> - - {isOrgAuditLogs && workspacesInOrg.length > 0 && ( - ( - - - - )} - /> - )} +
-
); }; diff --git a/frontend/src/views/Org/AuditLogsPage/components/LogsSection.tsx b/frontend/src/views/Org/AuditLogsPage/components/LogsSection.tsx index 968841f3b..f121ddbb8 100644 --- a/frontend/src/views/Org/AuditLogsPage/components/LogsSection.tsx +++ b/frontend/src/views/Org/AuditLogsPage/components/LogsSection.tsx @@ -47,7 +47,7 @@ export const LogsSection = ({ const { control, reset, watch, setValue } = useForm({ resolver: yupResolver(auditLogFilterFormSchema), defaultValues: { - projectId: undefined, + project: null, actor: presets?.actorId, eventType: presets?.eventType || [], page: 1, @@ -66,7 +66,7 @@ export const LogsSection = ({ const eventType = watch("eventType") as EventType[] | undefined; const userAgentType = watch("userAgentType") as UserAgentType | undefined; const actor = watch("actor"); - const projectId = watch("projectId"); + const projectId = watch("project")?.id; const startDate = watch("startDate"); const endDate = watch("endDate"); diff --git a/frontend/src/views/Org/AuditLogsPage/components/types.tsx b/frontend/src/views/Org/AuditLogsPage/components/types.tsx index 12afd0779..49cbb74fe 100644 --- a/frontend/src/views/Org/AuditLogsPage/components/types.tsx +++ b/frontend/src/views/Org/AuditLogsPage/components/types.tsx @@ -5,7 +5,7 @@ import { EventType, UserAgentType } from "@app/hooks/api/auditLogs/enums"; export const auditLogFilterFormSchema = yup .object({ eventMetadata: yup.object({}).optional(), - projectId: yup.string().optional(), + project: yup.object({ id: yup.string().required(), name: yup.string().required() }).nullable(), eventType: yup.array(yup.string().oneOf(Object.values(EventType), "Invalid event type")), actor: yup.string(), userAgentType: yup.string().oneOf(Object.values(UserAgentType), "Invalid user agent type"),