diff --git a/frontend/src/components/features/connections/filter/ConnectionAttributesFilter.tsx b/frontend/src/components/features/connections/filter/ConnectionAttributesFilter.tsx index 5e899c56..7d768f13 100644 --- a/frontend/src/components/features/connections/filter/ConnectionAttributesFilter.tsx +++ b/frontend/src/components/features/connections/filter/ConnectionAttributesFilter.tsx @@ -16,7 +16,7 @@ export default function ConnectionAttributesFilter({ column, columnFilterValues, sortedUniqueValues, -}: ConnectionAttributesFilterProps) { +}: Readonly>) { const [open, setOpen] = useState(false); console.log(sortedUniqueValues); const [attributes, setAttributes] = useState([]); diff --git a/frontend/src/components/features/connections/filter/ConnectionFilters.tsx b/frontend/src/components/features/connections/filter/ConnectionFilters.tsx index 9c1976f0..f8e28633 100644 --- a/frontend/src/components/features/connections/filter/ConnectionFilters.tsx +++ b/frontend/src/components/features/connections/filter/ConnectionFilters.tsx @@ -11,7 +11,7 @@ interface ConnectionFiltersProps { export default function ConnectionFilters({ className, table, -}: ConnectionFiltersProps) { +}: Readonly) { // Define columns that are filterable const filterableColumnIds = [ "serviceName", diff --git a/frontend/src/components/features/connections/table/ConnectionStatusBadge.tsx b/frontend/src/components/features/connections/table/ConnectionStatusBadge.tsx index f17f81db..71863c8b 100644 --- a/frontend/src/components/features/connections/table/ConnectionStatusBadge.tsx +++ b/frontend/src/components/features/connections/table/ConnectionStatusBadge.tsx @@ -7,7 +7,7 @@ interface ConnectionStatusBadgeProps { export default function ConnectionStatusBadge({ status = "DISCONNECTED", -}: ConnectionStatusBadgeProps) { +}: Readonly) { let variant: "default" | "secondary" | "destructive"; let additionalClasses = ""; diff --git a/frontend/src/components/features/connections/table/ConnectionTable.tsx b/frontend/src/components/features/connections/table/ConnectionTable.tsx index d191c96f..c955b8dc 100644 --- a/frontend/src/components/features/connections/table/ConnectionTable.tsx +++ b/frontend/src/components/features/connections/table/ConnectionTable.tsx @@ -15,7 +15,6 @@ import { } from "@tanstack/react-table"; import { Dispatch, SetStateAction, useState } from "react"; import { Table } from "@/components/ui/shadcn/table"; -import React from "react"; import { Connection } from "@/types/Connection"; import ConnectionTableHeader from "./ConnectionTableHeader"; import ConnectionTableBody from "./ConnectionTableBody"; @@ -47,7 +46,7 @@ export default function ConnectionTable({ pageSize: 10, }); const [sorting, setSorting] = useState([]); - const [columnFilters, setColumnFilters] = React.useState([ + const [columnFilters, setColumnFilters] = useState([ { id: "connectionStatus", value: ["CONNECTED"] }, ]); diff --git a/frontend/src/components/features/connections/table/ConnectionTableBody.tsx b/frontend/src/components/features/connections/table/ConnectionTableBody.tsx index 71b69584..771d5b75 100644 --- a/frontend/src/components/features/connections/table/ConnectionTableBody.tsx +++ b/frontend/src/components/features/connections/table/ConnectionTableBody.tsx @@ -6,11 +6,13 @@ import React from "react"; import ConnectionDetails from "./details/ConnectionDetails"; import { ConnectionsTableColumns } from "./ConnectionsTableColumns"; +interface ConnectionTableBodyProps { + table: Table; +} + export default function ConnectionTableBody({ table, -}: { - table: Table; -}) { +}: Readonly) { const isExpanded = (row: Row) => { return row.getIsExpanded(); }; diff --git a/frontend/src/components/features/connections/table/ConnectionTableHeader.tsx b/frontend/src/components/features/connections/table/ConnectionTableHeader.tsx index 035dd2b5..9ec5264a 100644 --- a/frontend/src/components/features/connections/table/ConnectionTableHeader.tsx +++ b/frontend/src/components/features/connections/table/ConnectionTableHeader.tsx @@ -2,11 +2,13 @@ import { TableHead, TableHeader, TableRow } from "@/components/ui/shadcn/table"; import { Connection } from "@/types/Connection"; import { flexRender, Table } from "@tanstack/react-table"; +interface ConnectionTableHeaderProps { + table: Table; +} + export default function ConnectionTableHeader({ table, -}: { - table: Table; -}) { +}: Readonly) { return ( {table.getHeaderGroups().map((headerGroup) => ( diff --git a/frontend/src/components/ui/filter/ComboFilter.tsx b/frontend/src/components/ui/filter/ComboFilter.tsx index 65938466..f581c63b 100644 --- a/frontend/src/components/ui/filter/ComboFilter.tsx +++ b/frontend/src/components/ui/filter/ComboFilter.tsx @@ -25,7 +25,7 @@ export default function ComboFilter({ columnFilterValues, sortedUniqueValues, withSearch = false, -}: SearchFilterProps) { +}: Readonly>) { const [open, setOpen] = useState(false); const handleOnItemSelect = (value: string) => { @@ -62,13 +62,7 @@ export default function ComboFilter({ aria-expanded={open} className="w-[200px] justify-between" > - {!columnFilterValues - ? "All" - : columnFilterValues.length == 1 && columnFilterValues[0] != "" - ? columnFilterValues[0] - : columnFilterValues.length == 1 && columnFilterValues[0] == "" - ? "None" - : "Multiple"} + {getTriggerText(columnFilterValues)} @@ -98,3 +92,16 @@ export default function ComboFilter({ ); } + +function getTriggerText(columnFilterValues: string[] | undefined) { + if (!columnFilterValues) { + return "All"; + } + if (columnFilterValues.length === 1 && columnFilterValues[0] === "") { + return "None"; + } + if (columnFilterValues.length === 1) { + return columnFilterValues[0]; + } + return "Multiple"; +} diff --git a/frontend/src/components/ui/filter/Filter.tsx b/frontend/src/components/ui/filter/Filter.tsx index 8880ade8..50b0b9ae 100644 --- a/frontend/src/components/ui/filter/Filter.tsx +++ b/frontend/src/components/ui/filter/Filter.tsx @@ -7,7 +7,9 @@ interface FilterProps { column: Column; } -export default function Filter({ column }: FilterProps) { +export default function Filter({ + column, +}: Readonly>) { const { filterVariant } = column.columnDef.meta ?? {}; const columnFilterValue = column.getFilterValue() as @@ -21,7 +23,7 @@ export default function Filter({ column }: FilterProps) { return []; } else { const values = Array.from(column.getFacetedUniqueValues().keys()) - .sort() + .sort((a: string, b: string) => a.localeCompare(b)) .slice(0, 5000); return values as string[]; } diff --git a/frontend/src/components/ui/table-pagination.tsx b/frontend/src/components/ui/table-pagination.tsx index 8ac46c97..00e7d4f1 100644 --- a/frontend/src/components/ui/table-pagination.tsx +++ b/frontend/src/components/ui/table-pagination.tsx @@ -1,7 +1,13 @@ import { Table } from "@tanstack/react-table"; import { Button } from "@/components/ui/shadcn/button"; -export default function TablePagination({ table }: { table: Table }) { +interface TablePaginationProps { + table: Table; +} + +export default function TablePagination({ + table, +}: Readonly>) { return (