diff --git a/package-lock.json b/package-lock.json index 883aaa5..1276de7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "ucentral-client", - "version": "3.0.2(1)", + "version": "3.0.2(5)", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "ucentral-client", - "version": "3.0.2(1)", + "version": "3.0.2(5)", "license": "ISC", "dependencies": { "@chakra-ui/anatomy": "^2.1.1", diff --git a/package.json b/package.json index f64ceb8..5efc034 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ucentral-client", - "version": "3.0.2(1)", + "version": "3.0.2(5)", "description": "", "private": true, "main": "index.tsx", diff --git a/src/components/DataTables/DataGrid/useDataGrid.ts b/src/components/DataTables/DataGrid/useDataGrid.ts index a1de276..96e620b 100644 --- a/src/components/DataTables/DataGrid/useDataGrid.ts +++ b/src/components/DataTables/DataGrid/useDataGrid.ts @@ -2,7 +2,8 @@ import * as React from 'react'; import { ColumnDef, PaginationState, SortingColumnDef, SortingState, VisibilityState } from '@tanstack/react-table'; import { useAuth } from 'contexts/AuthProvider'; -const getDefaultSettings = (settings?: string) => { +const getDefaultSettings = ({ settings, showAllRows }: { settings?: string; showAllRows?: boolean }) => { + if (showAllRows) return { pageSize: 1000, pageIndex: 0 }; let limit = 10; let index = 0; @@ -54,9 +55,10 @@ export type UseDataGridProps = { tableSettingsId: string; defaultOrder: string[]; defaultSortBy?: SortingState; + showAllRows?: boolean; }; -export const useDataGrid = ({ tableSettingsId, defaultSortBy, defaultOrder }: UseDataGridProps) => { +export const useDataGrid = ({ tableSettingsId, defaultSortBy, defaultOrder, showAllRows }: UseDataGridProps) => { const orderSetting = `${tableSettingsId}.order`; const hiddenColumnSetting = `${tableSettingsId}.hiddenColumns`; const pageSetting = `${tableSettingsId}.page`; @@ -66,8 +68,9 @@ export const useDataGrid = ({ tableSettingsId, defaultSortBy, defaultOrder }: Us const [columnOrder, setColumnOrder] = React.useState( getSavedColumnOrder(defaultOrder ?? [], tableSettingsId), ); - const [pageInfo, setPageInfo] = React.useState(getDefaultSettings(tableSettingsId)); - + const [pageInfo, setPageInfo] = React.useState( + getDefaultSettings({ settings: tableSettingsId, showAllRows }), + ); const setNewColumnOrder = React.useCallback( (newOrder: string[]) => { setColumnOrder(newOrder); diff --git a/src/pages/Device/SwitchPortExamination/LinkStateTable.tsx b/src/pages/Device/SwitchPortExamination/LinkStateTable.tsx index 03928f2..e332307 100644 --- a/src/pages/Device/SwitchPortExamination/LinkStateTable.tsx +++ b/src/pages/Device/SwitchPortExamination/LinkStateTable.tsx @@ -40,6 +40,7 @@ const LinkStateTable = ({ statistics, refetch, isFetching, type, serialNumber }: 'actions', ], defaultSortBy: [{ id: 'name', desc: false }], + showAllRows: true, }); const columns: DataGridColumn[] = React.useMemo( @@ -48,6 +49,7 @@ const LinkStateTable = ({ statistics, refetch, isFetching, type, serialNumber }: id: 'carrier', header: '', accessorKey: '', + sortingFn: 'alphanumericCaseSensitive', cell: ({ cell }) => (cell.row.original.carrier ? '🟢' : '🔴'), meta: { customWidth: '35px', diff --git a/src/pages/Device/SwitchPortExamination/SwitchInterfaceTable.tsx b/src/pages/Device/SwitchPortExamination/SwitchInterfaceTable.tsx index d3e29e7..f457093 100644 --- a/src/pages/Device/SwitchPortExamination/SwitchInterfaceTable.tsx +++ b/src/pages/Device/SwitchPortExamination/SwitchInterfaceTable.tsx @@ -30,6 +30,7 @@ const SwitchInterfaceTable = ({ statistics, refetch, isFetching }: Props) => { 'tx_error', ], defaultSortBy: [{ id: 'name', desc: false }], + showAllRows: true, }); const columns: DataGridColumn[] = React.useMemo( @@ -38,6 +39,7 @@ const SwitchInterfaceTable = ({ statistics, refetch, isFetching }: Props) => { id: 'name', header: 'Name', accessorKey: 'name', + sortingFn: 'alphanumericCaseSensitive', meta: { customWidth: '35px', },