mirror of
				https://github.com/optim-enterprises-bv/OptimCloud-gw-ui.git
				synced 2025-10-30 17:57:46 +00:00 
			
		
		
		
	[WIFI-13446] Port tables not showing all ports
Signed-off-by: Charles <charles.bourque96@gmail.com>
This commit is contained in:
		
							
								
								
									
										4
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										4
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							| @@ -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", | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| { | ||||
|   "name": "ucentral-client", | ||||
|   "version": "3.0.2(1)", | ||||
|   "version": "3.0.2(5)", | ||||
|   "description": "", | ||||
|   "private": true, | ||||
|   "main": "index.tsx", | ||||
|   | ||||
| @@ -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<string[]>( | ||||
|     getSavedColumnOrder(defaultOrder ?? [], tableSettingsId), | ||||
|   ); | ||||
|   const [pageInfo, setPageInfo] = React.useState<PaginationState>(getDefaultSettings(tableSettingsId)); | ||||
|  | ||||
|   const [pageInfo, setPageInfo] = React.useState<PaginationState>( | ||||
|     getDefaultSettings({ settings: tableSettingsId, showAllRows }), | ||||
|   ); | ||||
|   const setNewColumnOrder = React.useCallback( | ||||
|     (newOrder: string[]) => { | ||||
|       setColumnOrder(newOrder); | ||||
|   | ||||
| @@ -40,6 +40,7 @@ const LinkStateTable = ({ statistics, refetch, isFetching, type, serialNumber }: | ||||
|       'actions', | ||||
|     ], | ||||
|     defaultSortBy: [{ id: 'name', desc: false }], | ||||
|     showAllRows: true, | ||||
|   }); | ||||
|  | ||||
|   const columns: DataGridColumn<Row>[] = 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', | ||||
|   | ||||
| @@ -30,6 +30,7 @@ const SwitchInterfaceTable = ({ statistics, refetch, isFetching }: Props) => { | ||||
|       'tx_error', | ||||
|     ], | ||||
|     defaultSortBy: [{ id: 'name', desc: false }], | ||||
|     showAllRows: true, | ||||
|   }); | ||||
|  | ||||
|   const columns: DataGridColumn<DeviceInterfaceStatistics>[] = React.useMemo( | ||||
| @@ -38,6 +39,7 @@ const SwitchInterfaceTable = ({ statistics, refetch, isFetching }: Props) => { | ||||
|         id: 'name', | ||||
|         header: 'Name', | ||||
|         accessorKey: 'name', | ||||
|         sortingFn: 'alphanumericCaseSensitive', | ||||
|         meta: { | ||||
|           customWidth: '35px', | ||||
|         }, | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Charles
					Charles