mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-11 23:29:05 +00:00
Run linter
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
|
||||
import { apiRequest } from "@app/config/request";
|
||||
import {
|
||||
AuditLog,
|
||||
Actor
|
||||
} from "./types";
|
||||
|
||||
import { EventType, UserAgentType } from "./enums";
|
||||
import {
|
||||
Actor,
|
||||
AuditLog} from "./types";
|
||||
|
||||
export const workspaceKeys = {
|
||||
getAuditLogs: (workspaceId: string, filters: {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
export * from "./auditLogs";
|
||||
export * from "./auth";
|
||||
export * from "./bots";
|
||||
export * from "./incidentContacts";
|
||||
@@ -15,7 +16,6 @@ export * from "./ssoConfig";
|
||||
export * from "./subscriptions";
|
||||
export * from "./tags";
|
||||
export * from "./trustedIps";
|
||||
export * from "./auditLogs";
|
||||
export * from "./users";
|
||||
export * from "./webhooks";
|
||||
export * from "./workspace";
|
||||
|
||||
@@ -11,6 +11,7 @@ import {
|
||||
Select,
|
||||
SelectItem
|
||||
} from "@app/components/v2";
|
||||
|
||||
import {
|
||||
useGetIntegrationAuthApps,
|
||||
useGetIntegrationAuthById
|
||||
|
||||
@@ -1,18 +1,20 @@
|
||||
import { Control, Controller, UseFormReset } from "react-hook-form";
|
||||
import {
|
||||
FormControl,
|
||||
Select,
|
||||
SelectItem,
|
||||
Button
|
||||
} from "@app/components/v2";
|
||||
import { eventToNameMap, userAgentTTypeoNameMap } from "~/hooks/api/auditLogs/constants";
|
||||
import { useWorkspace } from "@app/context";
|
||||
import { useGetAuditLogActorFilterOpts } from "@app/hooks/api";
|
||||
import { Actor } from "~/hooks/api/auditLogs/types";
|
||||
import { ActorType } from "~/hooks/api/auditLogs/enums";
|
||||
import { faFilterCircleXmark } from "@fortawesome/free-solid-svg-icons";
|
||||
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
||||
import { AuditLogFilterFormData } from "./LogsSection";
|
||||
|
||||
import {
|
||||
Button,
|
||||
FormControl,
|
||||
Select,
|
||||
SelectItem} from "@app/components/v2";
|
||||
import { useWorkspace } from "@app/context";
|
||||
import { useGetAuditLogActorFilterOpts } from "@app/hooks/api";
|
||||
|
||||
import { eventToNameMap, userAgentTTypeoNameMap } from "~/hooks/api/auditLogs/constants";
|
||||
import { ActorType } from "~/hooks/api/auditLogs/enums";
|
||||
import { Actor } from "~/hooks/api/auditLogs/types";
|
||||
|
||||
import { AuditLogFilterFormData } from "./types";
|
||||
|
||||
const eventTypes = Object.entries(eventToNameMap).map(([value, label]) => ({ label, value }));
|
||||
const userAgentTypes = Object.entries(userAgentTTypeoNameMap).map(([value, label]) => ({ label, value }));
|
||||
@@ -43,7 +45,14 @@ export const LogsFilter = ({
|
||||
{actor.metadata.name}
|
||||
</SelectItem>
|
||||
);
|
||||
default:
|
||||
return (
|
||||
<SelectItem value="actor-none" key="actor-none">
|
||||
N/A
|
||||
</SelectItem>
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return (
|
||||
|
||||
@@ -1,19 +1,11 @@
|
||||
import { useForm } from "react-hook-form";
|
||||
import { LogsFilter } from "./LogsFilter";
|
||||
import { LogsTable } from "./LogsTable";
|
||||
import { yupResolver } from "@hookform/resolvers/yup";
|
||||
import * as yup from "yup";
|
||||
|
||||
import { EventType, UserAgentType } from "~/hooks/api/auditLogs/enums";
|
||||
|
||||
const schema = yup.object({
|
||||
eventType: yup.string()
|
||||
.oneOf(Object.values(EventType), 'Invalid event type'),
|
||||
actor: yup.string(),
|
||||
userAgentType: yup.string()
|
||||
.oneOf(Object.values(UserAgentType), 'Invalid user agent type'),
|
||||
}).required();
|
||||
|
||||
export type AuditLogFilterFormData = yup.InferType<typeof schema>;
|
||||
import { LogsFilter } from "./LogsFilter";
|
||||
import { LogsTable } from "./LogsTable";
|
||||
import { AuditLogFilterFormData,auditLogFilterFormSchema } from "./types";
|
||||
|
||||
export const LogsSection = () => {
|
||||
const {
|
||||
@@ -21,7 +13,7 @@ export const LogsSection = () => {
|
||||
reset,
|
||||
watch,
|
||||
} = useForm<AuditLogFilterFormData>({
|
||||
resolver: yupResolver(schema)
|
||||
resolver: yupResolver(auditLogFilterFormSchema)
|
||||
});
|
||||
|
||||
const eventType = watch("eventType") as EventType | undefined;
|
||||
@@ -46,4 +38,4 @@ export const LogsSection = () => {
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
import { faFile } from "@fortawesome/free-solid-svg-icons";
|
||||
|
||||
import {
|
||||
EmptyState,
|
||||
Table,
|
||||
@@ -12,9 +13,11 @@ import {
|
||||
} from "@app/components/v2";
|
||||
import { useWorkspace } from "@app/context";
|
||||
import { useGetAuditLogs } from "@app/hooks/api";
|
||||
import { LogsTableRow } from "./LogsTableRow";
|
||||
|
||||
import { EventType, UserAgentType } from "~/hooks/api/auditLogs/enums";
|
||||
|
||||
import { LogsTableRow } from "./LogsTableRow";
|
||||
|
||||
type Props = {
|
||||
eventType: EventType | undefined;
|
||||
userAgentType: UserAgentType | undefined;
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
import { AuditLog, Actor, Event } from "~/hooks/api/auditLogs/types";
|
||||
import { ActorType, EventType } from "~/hooks/api/auditLogs/enums";
|
||||
import { eventToNameMap, userAgentTTypeoNameMap } from "~/hooks/api/auditLogs/constants";
|
||||
import {
|
||||
Td,
|
||||
Tr
|
||||
} from "@app/components/v2";
|
||||
|
||||
import { eventToNameMap, userAgentTTypeoNameMap } from "~/hooks/api/auditLogs/constants";
|
||||
import { ActorType, EventType } from "~/hooks/api/auditLogs/enums";
|
||||
import { Actor, AuditLog, Event } from "~/hooks/api/auditLogs/types";
|
||||
|
||||
type Props = {
|
||||
auditLog: AuditLog
|
||||
}
|
||||
@@ -29,6 +30,10 @@ export const LogsTableRow = ({
|
||||
<p>Service token</p>
|
||||
</Td>
|
||||
);
|
||||
default:
|
||||
return (
|
||||
<Td />
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,16 +89,16 @@ export const LogsTableRow = ({
|
||||
const formatDate = (dateToFormat: string) => {
|
||||
const date = new Date(dateToFormat);
|
||||
const year = date.getFullYear();
|
||||
const month = String(date.getMonth() + 1).padStart(2, '0');
|
||||
const day = String(date.getDate()).padStart(2, '0');
|
||||
const month = String(date.getMonth() + 1).padStart(2, "0");
|
||||
const day = String(date.getDate()).padStart(2, "0");
|
||||
|
||||
let hours = date.getHours();
|
||||
const minutes = String(date.getMinutes()).padStart(2, '0');
|
||||
const minutes = String(date.getMinutes()).padStart(2, "0");
|
||||
|
||||
// convert from 24h to 12h format
|
||||
const period = hours >= 12 ? 'PM' : 'AM';
|
||||
hours = hours % 12;
|
||||
hours = hours ? hours : 12; // the hour '0' should be '12'
|
||||
const period = hours >= 12 ? "PM" : "AM";
|
||||
hours %= 12;
|
||||
hours = hours || 12; // the hour '0' should be '12'
|
||||
|
||||
const formattedDate = `${day}-${month}-${year} at ${hours}:${minutes} ${period}`;
|
||||
return formattedDate;
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
import * as yup from "yup";
|
||||
|
||||
import { EventType, UserAgentType } from "~/hooks/api/auditLogs/enums";
|
||||
|
||||
export const auditLogFilterFormSchema = yup.object({
|
||||
eventType: yup.string()
|
||||
.oneOf(Object.values(EventType), "Invalid event type"),
|
||||
actor: yup.string(),
|
||||
userAgentType: yup.string()
|
||||
.oneOf(Object.values(UserAgentType), "Invalid user agent type"),
|
||||
}).required();
|
||||
|
||||
export type AuditLogFilterFormData = yup.InferType<typeof auditLogFilterFormSchema>;
|
||||
Reference in New Issue
Block a user