From fb0e788e3b8d0e1d8434dc1bf2598b55cc78cf15 Mon Sep 17 00:00:00 2001 From: Mohamed Khelif Date: Wed, 10 Jan 2024 13:35:24 -0500 Subject: [PATCH] CR changes --- src/components/Table/BaseTable.tsx | 41 ++++++++++-------------------- src/gql/generated/types.ts | 3 +++ 2 files changed, 17 insertions(+), 27 deletions(-) diff --git a/src/components/Table/BaseTable.tsx b/src/components/Table/BaseTable.tsx index d1f42f8964..74a84a1d47 100644 --- a/src/components/Table/BaseTable.tsx +++ b/src/components/Table/BaseTable.tsx @@ -13,7 +13,6 @@ import { TableBody, type TableProps, TableHead, - LGTableDataType, VirtualItem, LeafyGreenTableRow, } from "@leafygreen-ui/table"; @@ -49,13 +48,13 @@ declare module "@tanstack/table-core" { } type SpruceTableProps = { + className?: string; "data-cy-row"?: string; "data-cy-table"?: string; emptyComponent?: React.ReactNode; loading?: boolean; /** estimated number of rows the table will have */ loadingRows?: number; - className?: string; }; export const BaseTable = forwardRef( @@ -74,6 +73,8 @@ export const BaseTable = forwardRef( ) => { const { virtualRows } = table; const { rows } = table.getRowModel(); + const hasVirtualRows = virtualRows && virtualRows.length > 0; + return ( <> )} - + {hasVirtualRows + ? virtualRows.map((vr) => { + const row = rows[vr.index]; + return ( + + ); + }) + : rows.map((row) => ( + + ))} {!loading && @@ -154,34 +164,11 @@ export const BaseTable = forwardRef( } ); -const RenderRows = ({ - rows, - virtualRows, -}: { - virtualRows?: VirtualItem[]; - rows: LeafyGreenTableRow>[]; -}) => { - const hasVirtualRows = virtualRows && virtualRows.length > 0; - return ( - <> - {!hasVirtualRows && - rows.map((row) => ( - - ))} - {hasVirtualRows && - virtualRows.map((vr) => { - const row = rows[vr.index]; - return ; - })} - - ); -}; - const RenderableRow = ({ row, virtualRow, }: { - row: LeafyGreenTableRow>; + row: LeafyGreenTableRow; virtualRow: VirtualItem; }) => ( ; arch: Arch; authorizedKeysFile: Scalars["String"]["output"]; @@ -429,6 +430,8 @@ export type DistroInfo = { }; export type DistroInput = { + /** TODO: require adminOnly field upon completion of DEVPROD-3533 */ + adminOnly?: InputMaybe; aliases: Array; arch: Arch; authorizedKeysFile: Scalars["String"]["input"];