From dcbde4b5b11f7f8b28ba16b94f3451a47ca4a63c Mon Sep 17 00:00:00 2001 From: Daryl Lim <5508348+daryllimyt@users.noreply.github.com> Date: Mon, 29 Apr 2024 00:27:27 +0100 Subject: [PATCH] chore(ui): Fix lint issues --- frontend/src/app/settings/layout.tsx | 2 +- .../app/workflows/[workflowId]/cases/page.tsx | 78 +------------------ frontend/src/components/cases/columns.tsx | 2 +- .../src/components/console/control-panel.tsx | 2 +- .../src/components/console/event-feed.tsx | 2 +- frontend/src/components/nav/dyn-nav.tsx | 3 +- frontend/src/components/nav/workflows-nav.tsx | 4 +- .../src/components/new-credential-dialog.tsx | 2 +- frontend/src/components/table/table.tsx | 1 + .../workspace/canvas/action-node.tsx | 15 +--- .../workspace/canvas/integration-node.tsx | 4 +- .../workspace/catalog/action-catalog.tsx | 2 +- .../workspace/panel/action/form.tsx | 4 +- .../src/components/workspace/panel/common.tsx | 6 +- .../workspace/panel/integration/form.tsx | 2 +- .../workspace/panel/workflow/controls.tsx | 6 +- .../workspace/panel/workflow/form.tsx | 8 +- .../workspace/panel/workflow/runs.tsx | 16 +--- frontend/src/lib/hooks.ts | 2 +- frontend/src/lib/utils.ts | 2 +- frontend/src/providers/case-panel.tsx | 2 +- frontend/src/providers/workflow.tsx | 2 +- 22 files changed, 33 insertions(+), 134 deletions(-) diff --git a/frontend/src/app/settings/layout.tsx b/frontend/src/app/settings/layout.tsx index 19d045f3..798663af 100644 --- a/frontend/src/app/settings/layout.tsx +++ b/frontend/src/app/settings/layout.tsx @@ -33,7 +33,7 @@ export default async function SettingsLayout({ return (
-
+

Settings

diff --git a/frontend/src/app/workflows/[workflowId]/cases/page.tsx b/frontend/src/app/workflows/[workflowId]/cases/page.tsx index 4b997a8c..68ba5f1b 100644 --- a/frontend/src/app/workflows/[workflowId]/cases/page.tsx +++ b/frontend/src/app/workflows/[workflowId]/cases/page.tsx @@ -1,12 +1,6 @@ -"use client" +import CasesProvider from "@/providers/cases" -import { useEffect, useState } from "react" -import CasesProvider, { useCasesContext } from "@/providers/cases" - -import { getDistributionData } from "@/lib/utils" -import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card" import CaseTable from "@/components/cases/table" -import EventDistributionPlot, { PlotDataType } from "@/components/charts" import { AlertNotification } from "@/components/notifications" export default function CasesPage() { @@ -26,73 +20,3 @@ export default function CasesPage() { ) } - -function CasesStatsBanner() { - // X axis - the category - // Y axis - the number of elements - const { cases } = useCasesContext() - const [statusDistData, setStatusDistData] = useState([]) - const [priorityDistData, setPriorityDistData] = useState([]) - const [maliceDistData, setMaliceDistData] = useState([]) - useEffect(() => { - const statuisDistro = getDistributionData(cases, "status") - const priorityDistro = getDistributionData(cases, "priority") - const maliceDistro = getDistributionData(cases, "malice") - setStatusDistData( - Object.entries(statuisDistro).map(([key, value]) => ({ - x: key, - y: value, - })) - ) - setPriorityDistData( - Object.entries(priorityDistro).map(([key, value]) => ({ - x: key, - y: value, - })) - ) - setMaliceDistData( - Object.entries(maliceDistro).map(([key, value]) => ({ - x: key, - y: value, - })) - ) - }, [cases]) - return ( - <> -

-
- - - - Status Distribution - - - - - - - - - - Priority Distribution - - - - - - - - - - Malice Distribution - - - - - - -
-
- - ) -} diff --git a/frontend/src/components/cases/columns.tsx b/frontend/src/components/cases/columns.tsx index c9328e67..0f190d39 100644 --- a/frontend/src/components/cases/columns.tsx +++ b/frontend/src/components/cases/columns.tsx @@ -194,7 +194,7 @@ export const columns: ColumnDef[] = [
{caseContextFields.length > 0 - ? caseContextFields.map(({ key, value }, idx) => ( + ? caseContextFields.map(({ value }, idx) => ( {value} )) : "No context tags"} diff --git a/frontend/src/components/console/control-panel.tsx b/frontend/src/components/console/control-panel.tsx index 11a9519f..c2eb1cb3 100644 --- a/frontend/src/components/console/control-panel.tsx +++ b/frontend/src/components/console/control-panel.tsx @@ -26,7 +26,7 @@ import { SelectValue, } from "@/components/ui/select" import { ConfirmationDialog } from "@/components/confirmation-dialog" -import { WorkflowControlsForm } from "@/components/console/console" +import { type WorkflowControlsForm } from "@/components/console/console" import { tileIconMapping } from "@/components/workspace/canvas/action-node" import { DELETE_BUTTON_STYLE } from "@/styles/tailwind" diff --git a/frontend/src/components/console/event-feed.tsx b/frontend/src/components/console/event-feed.tsx index 5f462df9..7141d113 100644 --- a/frontend/src/components/console/event-feed.tsx +++ b/frontend/src/components/console/event-feed.tsx @@ -20,7 +20,7 @@ import { TooltipTrigger, } from "@/components/ui/tooltip" import { toast } from "@/components/ui/use-toast" -import { WorkflowControlsForm } from "@/components/console/console" +import { type WorkflowControlsForm } from "@/components/console/console" import { supportedInputTypes } from "@/components/console/control-panel" import { EventFeedItem } from "@/components/console/event-feed-item" diff --git a/frontend/src/components/nav/dyn-nav.tsx b/frontend/src/components/nav/dyn-nav.tsx index e258cea6..d0a22134 100644 --- a/frontend/src/components/nav/dyn-nav.tsx +++ b/frontend/src/components/nav/dyn-nav.tsx @@ -8,8 +8,7 @@ import { useParams, usePathname } from "next/navigation" import { cn } from "@/lib/utils" import WorkflowsNav from "@/components/nav/workflows-nav" -interface NavbarProps extends React.HTMLAttributes {} -export default function DynamicNavbar(props: NavbarProps) { +export default function DynamicNavbar() { const pathname = usePathname() const params = useParams() const DynNav = getNavBar(pathname, params) diff --git a/frontend/src/components/nav/workflows-nav.tsx b/frontend/src/components/nav/workflows-nav.tsx index eb3d307e..23dbee6d 100644 --- a/frontend/src/components/nav/workflows-nav.tsx +++ b/frontend/src/components/nav/workflows-nav.tsx @@ -11,9 +11,7 @@ import { Switch } from "@/components/ui/switch" import { Tabs, TabsList, TabsTrigger } from "@/components/ui/tabs" import WorkflowSwitcher from "@/components/nav/workflow-switcher" -interface NavbarProps extends React.HTMLAttributes {} - -export default function WorkflowsNavbar(props: NavbarProps) { +export default function WorkflowsNavbar() { const { workflowId, isLoading, isOnline, setIsOnline } = useWorkflowMetadata() if (isLoading) { diff --git a/frontend/src/components/new-credential-dialog.tsx b/frontend/src/components/new-credential-dialog.tsx index 58efacae..5925a515 100644 --- a/frontend/src/components/new-credential-dialog.tsx +++ b/frontend/src/components/new-credential-dialog.tsx @@ -163,7 +163,7 @@ export function NewCredentialsDialog({ key={inputKey} control={control} name={typedKey} - render={({ field }) => ( + render={() => ( Keys
diff --git a/frontend/src/components/table/table.tsx b/frontend/src/components/table/table.tsx index 7a6f2737..fa117149 100644 --- a/frontend/src/components/table/table.tsx +++ b/frontend/src/components/table/table.tsx @@ -35,6 +35,7 @@ import { DataTablePagination, DataTableToolbar } from "@/components/table" import { DataTableToolbarProps } from "./toolbar" declare module "@tanstack/react-table" { + // @ts-ignore interface TableMeta { isProcessing: boolean } diff --git a/frontend/src/components/workspace/canvas/action-node.tsx b/frontend/src/components/workspace/canvas/action-node.tsx index 7cc80d8d..e22afd33 100644 --- a/frontend/src/components/workspace/canvas/action-node.tsx +++ b/frontend/src/components/workspace/canvas/action-node.tsx @@ -27,7 +27,7 @@ import { } from "lucide-react" import { Handle, NodeProps, Position, useNodeId, type Node } from "reactflow" -import { ActionType, IntegrationType, NodeType } from "@/types/schemas" +import { type ActionType } from "@/types/schemas" import { cn, copyToClipboard, slugify } from "@/lib/utils" import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar" import { Button } from "@/components/ui/button" @@ -224,19 +224,8 @@ export default React.memo(function ActionNode({
- +
- {/*
- - {status} -
*/}
- +