mirror of
https://github.com/optim-enterprises-bv/OptimCloud-gw-ui.git
synced 2025-10-29 01:12:19 +00:00
Merge pull request #213 from stephb9959/main
[WIFI-13446] Port tables not showing all ports
This commit is contained in:
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "ucentral-client",
|
"name": "ucentral-client",
|
||||||
"version": "3.0.2(1)",
|
"version": "3.0.2(5)",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "ucentral-client",
|
"name": "ucentral-client",
|
||||||
"version": "3.0.2(1)",
|
"version": "3.0.2(5)",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@chakra-ui/anatomy": "^2.1.1",
|
"@chakra-ui/anatomy": "^2.1.1",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "ucentral-client",
|
"name": "ucentral-client",
|
||||||
"version": "3.0.2(1)",
|
"version": "3.0.2(5)",
|
||||||
"description": "",
|
"description": "",
|
||||||
"private": true,
|
"private": true,
|
||||||
"main": "index.tsx",
|
"main": "index.tsx",
|
||||||
|
|||||||
@@ -2,7 +2,8 @@ import * as React from 'react';
|
|||||||
import { ColumnDef, PaginationState, SortingColumnDef, SortingState, VisibilityState } from '@tanstack/react-table';
|
import { ColumnDef, PaginationState, SortingColumnDef, SortingState, VisibilityState } from '@tanstack/react-table';
|
||||||
import { useAuth } from 'contexts/AuthProvider';
|
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 limit = 10;
|
||||||
let index = 0;
|
let index = 0;
|
||||||
|
|
||||||
@@ -54,9 +55,10 @@ export type UseDataGridProps = {
|
|||||||
tableSettingsId: string;
|
tableSettingsId: string;
|
||||||
defaultOrder: string[];
|
defaultOrder: string[];
|
||||||
defaultSortBy?: SortingState;
|
defaultSortBy?: SortingState;
|
||||||
|
showAllRows?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const useDataGrid = ({ tableSettingsId, defaultSortBy, defaultOrder }: UseDataGridProps) => {
|
export const useDataGrid = ({ tableSettingsId, defaultSortBy, defaultOrder, showAllRows }: UseDataGridProps) => {
|
||||||
const orderSetting = `${tableSettingsId}.order`;
|
const orderSetting = `${tableSettingsId}.order`;
|
||||||
const hiddenColumnSetting = `${tableSettingsId}.hiddenColumns`;
|
const hiddenColumnSetting = `${tableSettingsId}.hiddenColumns`;
|
||||||
const pageSetting = `${tableSettingsId}.page`;
|
const pageSetting = `${tableSettingsId}.page`;
|
||||||
@@ -66,8 +68,9 @@ export const useDataGrid = ({ tableSettingsId, defaultSortBy, defaultOrder }: Us
|
|||||||
const [columnOrder, setColumnOrder] = React.useState<string[]>(
|
const [columnOrder, setColumnOrder] = React.useState<string[]>(
|
||||||
getSavedColumnOrder(defaultOrder ?? [], tableSettingsId),
|
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(
|
const setNewColumnOrder = React.useCallback(
|
||||||
(newOrder: string[]) => {
|
(newOrder: string[]) => {
|
||||||
setColumnOrder(newOrder);
|
setColumnOrder(newOrder);
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ const LinkStateTable = ({ statistics, refetch, isFetching, type, serialNumber }:
|
|||||||
'actions',
|
'actions',
|
||||||
],
|
],
|
||||||
defaultSortBy: [{ id: 'name', desc: false }],
|
defaultSortBy: [{ id: 'name', desc: false }],
|
||||||
|
showAllRows: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
const columns: DataGridColumn<Row>[] = React.useMemo(
|
const columns: DataGridColumn<Row>[] = React.useMemo(
|
||||||
@@ -48,6 +49,7 @@ const LinkStateTable = ({ statistics, refetch, isFetching, type, serialNumber }:
|
|||||||
id: 'carrier',
|
id: 'carrier',
|
||||||
header: '',
|
header: '',
|
||||||
accessorKey: '',
|
accessorKey: '',
|
||||||
|
sortingFn: 'alphanumericCaseSensitive',
|
||||||
cell: ({ cell }) => (cell.row.original.carrier ? '🟢' : '🔴'),
|
cell: ({ cell }) => (cell.row.original.carrier ? '🟢' : '🔴'),
|
||||||
meta: {
|
meta: {
|
||||||
customWidth: '35px',
|
customWidth: '35px',
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ const SwitchInterfaceTable = ({ statistics, refetch, isFetching }: Props) => {
|
|||||||
'tx_error',
|
'tx_error',
|
||||||
],
|
],
|
||||||
defaultSortBy: [{ id: 'name', desc: false }],
|
defaultSortBy: [{ id: 'name', desc: false }],
|
||||||
|
showAllRows: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
const columns: DataGridColumn<DeviceInterfaceStatistics>[] = React.useMemo(
|
const columns: DataGridColumn<DeviceInterfaceStatistics>[] = React.useMemo(
|
||||||
@@ -38,6 +39,7 @@ const SwitchInterfaceTable = ({ statistics, refetch, isFetching }: Props) => {
|
|||||||
id: 'name',
|
id: 'name',
|
||||||
header: 'Name',
|
header: 'Name',
|
||||||
accessorKey: 'name',
|
accessorKey: 'name',
|
||||||
|
sortingFn: 'alphanumericCaseSensitive',
|
||||||
meta: {
|
meta: {
|
||||||
customWidth: '35px',
|
customWidth: '35px',
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user