mirror of
https://github.com/Telecominfraproject/wlan-cloud-owprov-ui.git
synced 2025-11-03 03:58:07 +00:00
[WIFI-12030] Fixed venue analytics dashboard table sorting
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": "wlan-cloud-owprov-ui",
|
"name": "wlan-cloud-owprov-ui",
|
||||||
"version": "2.8.0(28)",
|
"version": "2.8.0(29)",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "wlan-cloud-owprov-ui",
|
"name": "wlan-cloud-owprov-ui",
|
||||||
"version": "2.8.0(28)",
|
"version": "2.8.0(29)",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@chakra-ui/icons": "^2.0.11",
|
"@chakra-ui/icons": "^2.0.11",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "wlan-cloud-owprov-ui",
|
"name": "wlan-cloud-owprov-ui",
|
||||||
"version": "2.8.0(28)",
|
"version": "2.8.0(29)",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "index.tsx",
|
"main": "index.tsx",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -23,6 +23,14 @@ import { useGetGatewayUi } from 'hooks/Network/Endpoints';
|
|||||||
import { arrayMoveIndex } from 'utils/arrayHelpers';
|
import { arrayMoveIndex } from 'utils/arrayHelpers';
|
||||||
import { minimalSecondsToDetailed } from 'utils/dateFormatting';
|
import { minimalSecondsToDetailed } from 'utils/dateFormatting';
|
||||||
|
|
||||||
|
const parseSerial = (serial) => {
|
||||||
|
try {
|
||||||
|
const res = parseInt(serial, 16);
|
||||||
|
return res;
|
||||||
|
} catch {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
};
|
||||||
const propTypes = {
|
const propTypes = {
|
||||||
data: PropTypes.instanceOf(Object),
|
data: PropTypes.instanceOf(Object),
|
||||||
isOpen: PropTypes.bool.isRequired,
|
isOpen: PropTypes.bool.isRequired,
|
||||||
@@ -48,12 +56,12 @@ const VenueDashboardTableModal = ({ data, isOpen, onOpen, onClose, tableOptions
|
|||||||
const serialCell = useCallback(
|
const serialCell = useCallback(
|
||||||
(cell) => (
|
(cell) => (
|
||||||
<Button
|
<Button
|
||||||
onClick={() => handleOpenInGateway(cell.row.values.serialNumber)}
|
onClick={() => handleOpenInGateway(cell.row.original.serialNumber)}
|
||||||
variant="link"
|
variant="link"
|
||||||
fontFamily="monospace"
|
fontFamily="monospace"
|
||||||
fontSize="0.8rem"
|
fontSize="0.8rem"
|
||||||
>
|
>
|
||||||
{cell.row.values.serialNumber}
|
{cell.row.original.serialNumber}
|
||||||
</Button>
|
</Button>
|
||||||
),
|
),
|
||||||
[],
|
[],
|
||||||
@@ -65,10 +73,10 @@ const VenueDashboardTableModal = ({ data, isOpen, onOpen, onClose, tableOptions
|
|||||||
);
|
);
|
||||||
const healthCell = useCallback((cell) => `${cell.row.values.health}%`, []);
|
const healthCell = useCallback((cell) => `${cell.row.values.health}%`, []);
|
||||||
const statusCell = useCallback(
|
const statusCell = useCallback(
|
||||||
(cell) => (cell.row.values.connected ? t('common.connected') : t('common.disconnected')),
|
(cell) => (cell.row.original.connected ? t('common.connected') : t('common.disconnected')),
|
||||||
[],
|
[],
|
||||||
);
|
);
|
||||||
const memoryCell = useCallback((cell) => `${cell.row.values.memory}%`, []);
|
const memoryCell = useCallback((cell) => `${Math.floor(cell.row.values.memory * 100) / 100}%`, []);
|
||||||
const durationCell = useCallback(
|
const durationCell = useCallback(
|
||||||
(cell, key) => (cell.row.values[key] !== undefined ? minimalSecondsToDetailed(cell.row.values[key], t) : ''),
|
(cell, key) => (cell.row.values[key] !== undefined ? minimalSecondsToDetailed(cell.row.values[key], t) : ''),
|
||||||
[],
|
[],
|
||||||
@@ -90,7 +98,7 @@ const VenueDashboardTableModal = ({ data, isOpen, onOpen, onClose, tableOptions
|
|||||||
id: 'serialNumber',
|
id: 'serialNumber',
|
||||||
Header: t('inventory.serial_number'),
|
Header: t('inventory.serial_number'),
|
||||||
Footer: '',
|
Footer: '',
|
||||||
accessor: 'serialNumber',
|
accessor: (row) => parseSerial(row.serialNumber),
|
||||||
customWidth: 'calc(15vh)',
|
customWidth: 'calc(15vh)',
|
||||||
customMinWidth: '150px',
|
customMinWidth: '150px',
|
||||||
Cell: ({ cell }) => serialCell(cell),
|
Cell: ({ cell }) => serialCell(cell),
|
||||||
@@ -102,7 +110,7 @@ const VenueDashboardTableModal = ({ data, isOpen, onOpen, onClose, tableOptions
|
|||||||
id: 'connected',
|
id: 'connected',
|
||||||
Header: t('common.status'),
|
Header: t('common.status'),
|
||||||
Footer: '',
|
Footer: '',
|
||||||
accessor: 'connected',
|
accessor: (row) => (row.connected ? 0 : 1),
|
||||||
Cell: ({ cell }) => statusCell(cell),
|
Cell: ({ cell }) => statusCell(cell),
|
||||||
customMinWidth: '1%',
|
customMinWidth: '1%',
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user