diff --git a/package-lock.json b/package-lock.json index 3432735..3d9028b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "ucentral-client", - "version": "2.10.0(40)", + "version": "2.10.0(41)", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "ucentral-client", - "version": "2.10.0(40)", + "version": "2.10.0(41)", "license": "ISC", "dependencies": { "@chakra-ui/icons": "^2.0.18", diff --git a/package.json b/package.json index 1f9ea96..29fa54d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ucentral-client", - "version": "2.10.0(40)", + "version": "2.10.0(41)", "description": "", "private": true, "main": "index.tsx", diff --git a/src/hooks/Network/Devices.ts b/src/hooks/Network/Devices.ts index 3ebac10..7efbd21 100644 --- a/src/hooks/Network/Devices.ts +++ b/src/hooks/Network/Devices.ts @@ -44,6 +44,7 @@ export type DeviceWithStatus = { associations_6G: number; compatible: string; connected: boolean; + connectReason?: string; certificateExpiryDate?: number; createdTimestamp: number; devicePassword: string; @@ -82,6 +83,18 @@ export type DeviceWithStatus = { verifiedCertificate: string; }; +export const getSingleDeviceWithStatus = (serialNumber: string) => + axiosGw + .get(`devices?deviceWithStatus=true&select=${serialNumber}`) + .then((response) => { + const deviceWithStatus: DeviceWithStatus | undefined = response.data.devicesWithStatus[0]; + if (deviceWithStatus === undefined) { + return undefined; + } + return deviceWithStatus; + }) + .catch(() => undefined); + const getDevices = (limit: number, offset: number) => axiosGw .get(`devices?deviceWithStatus=true&limit=${limit}&offset=${offset}`) @@ -136,6 +149,7 @@ export type DeviceStatus = { associations_2G: number; associations_5G: number; connected: boolean; + connectReason?: string; certificateExpiryDate: number; connectionCompletionTime: number; firmware: string; diff --git a/src/pages/Device/Summary.tsx b/src/pages/Device/Summary.tsx index fe2bc09..e5adaba 100644 --- a/src/pages/Device/Summary.tsx +++ b/src/pages/Device/Summary.tsx @@ -171,6 +171,14 @@ const DeviceSummary = ({ serialNumber }: Props) => { )} + + Connect Reason: + + + {getStatus.data?.connectReason && getStatus.data?.connectReason.length > 0 + ? getStatus.data?.connectReason + : '-'} + diff --git a/src/pages/Devices/ListCard/index.tsx b/src/pages/Devices/ListCard/index.tsx index 3f225c6..018a2c2 100644 --- a/src/pages/Devices/ListCard/index.tsx +++ b/src/pages/Devices/ListCard/index.tsx @@ -104,6 +104,7 @@ const DeviceListCard = () => { '2G', '5G', '6G', + 'connectReason', 'certificateExpiryDate', 'actions', ], @@ -648,6 +649,19 @@ const DeviceListCard = () => { }, }, }, + { + id: 'connectReason', + header: 'Connect Reason', + footer: '', + accessorKey: 'connectReason', + cell: (v) => (v.cell.row.original.connectReason ? v.cell.row.original.connectReason : '-'), + enableSorting: false, + meta: { + headerOptions: { + tooltip: 'Reason supplied by the device for the last connection', + }, + }, + }, { id: 'certificateExpiryDate', header: 'Exp', @@ -689,7 +703,7 @@ const DeviceListCard = () => { }, [getAges, getDevices.data, getDevices.dataUpdatedAt]); return ( - <> + controller={tableController} header={{ @@ -723,7 +737,7 @@ const DeviceListCard = () => { {scriptModal.modal} - + ); };