mirror of
				https://github.com/optim-enterprises-bv/OptimCloud-gw-ui.git
				synced 2025-10-31 02:07:45 +00:00 
			
		
		
		
	[WIFI-11742] Wifi analysis now displays bands when available
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", |   "name": "ucentral-client", | ||||||
|   "version": "2.8.0(22)", |   "version": "2.8.0(23)", | ||||||
|   "lockfileVersion": 2, |   "lockfileVersion": 2, | ||||||
|   "requires": true, |   "requires": true, | ||||||
|   "packages": { |   "packages": { | ||||||
|     "": { |     "": { | ||||||
|       "name": "ucentral-client", |       "name": "ucentral-client", | ||||||
|       "version": "2.8.0(22)", |       "version": "2.8.0(23)", | ||||||
|       "license": "ISC", |       "license": "ISC", | ||||||
|       "dependencies": { |       "dependencies": { | ||||||
|         "@chakra-ui/icons": "^2.0.11", |         "@chakra-ui/icons": "^2.0.11", | ||||||
|   | |||||||
| @@ -1,6 +1,6 @@ | |||||||
| { | { | ||||||
|   "name": "ucentral-client", |   "name": "ucentral-client", | ||||||
|   "version": "2.8.0(22)", |   "version": "2.8.0(23)", | ||||||
|   "description": "", |   "description": "", | ||||||
|   "private": true, |   "private": true, | ||||||
|   "main": "index.tsx", |   "main": "index.tsx", | ||||||
|   | |||||||
| @@ -86,6 +86,7 @@ export type DeviceStatistics = { | |||||||
|     active_ms: number; |     active_ms: number; | ||||||
|     busy_ms: number; |     busy_ms: number; | ||||||
|     channel: number; |     channel: number; | ||||||
|  |     band?: string[]; | ||||||
|     channel_width: string; |     channel_width: string; | ||||||
|     noise: number; |     noise: number; | ||||||
|     phy: string; |     phy: string; | ||||||
|   | |||||||
| @@ -47,16 +47,19 @@ const WifiAnalysisAssocationsTable = ({ data, ouis }: Props) => { | |||||||
|     [], |     [], | ||||||
|   ); |   ); | ||||||
|   const dataCell = React.useCallback((v: number) => <DataCell bytes={v} />, []); |   const dataCell = React.useCallback((v: number) => <DataCell bytes={v} />, []); | ||||||
|  |   const indexCell = React.useCallback((assoc: ParsedAssociation) => assoc.radio?.band ?? assoc.radio?.index, []); | ||||||
|  |  | ||||||
|   const columns: Column<ParsedAssociation>[] = React.useMemo( |   const columns: Column<ParsedAssociation>[] = React.useMemo( | ||||||
|     (): Column<ParsedAssociation>[] => [ |     (): Column<ParsedAssociation>[] => [ | ||||||
|       { |       { | ||||||
|         id: 'index', |         id: 'index', | ||||||
|         Header: '#', |         Header: '', | ||||||
|         Footer: '', |         Footer: '', | ||||||
|         accessor: 'radio.index', |         accessor: 'radio.index', | ||||||
|  |         Cell: ({ cell }) => indexCell(cell.row.original), | ||||||
|         customWidth: '35px', |         customWidth: '35px', | ||||||
|         alwaysShow: true, |         alwaysShow: true, | ||||||
|  |         disableSortBy: true, | ||||||
|       }, |       }, | ||||||
|       { |       { | ||||||
|         id: 'station', |         id: 'station', | ||||||
| @@ -171,7 +174,7 @@ const WifiAnalysisAssocationsTable = ({ data, ouis }: Props) => { | |||||||
|           } |           } | ||||||
|           hiddenColumns={hiddenColumns} |           hiddenColumns={hiddenColumns} | ||||||
|           data={data ?? []} |           data={data ?? []} | ||||||
|           hideEmptyListText |           sortBy={data?.[0]?.radio?.band ? [{ id: 'index', desc: true }] : undefined} | ||||||
|           // @ts-ignore |           // @ts-ignore | ||||||
|           hideControls |           hideControls | ||||||
|           showAllRows |           showAllRows | ||||||
|   | |||||||
| @@ -7,6 +7,7 @@ import { Column } from 'models/Table'; | |||||||
|  |  | ||||||
| export type ParsedRadio = { | export type ParsedRadio = { | ||||||
|   recorded: number; |   recorded: number; | ||||||
|  |   band?: string; | ||||||
|   index: number; |   index: number; | ||||||
|   channel: number; |   channel: number; | ||||||
|   channelWidth: string; |   channelWidth: string; | ||||||
| @@ -26,15 +27,19 @@ const WifiAnalysisRadioTable = ({ data }: Props) => { | |||||||
|   const { t } = useTranslation(); |   const { t } = useTranslation(); | ||||||
|   const [hiddenColumns, setHiddenColumns] = React.useState<string[]>([]); |   const [hiddenColumns, setHiddenColumns] = React.useState<string[]>([]); | ||||||
|  |  | ||||||
|  |   const indexCell = React.useCallback((radio: ParsedRadio) => radio?.band ?? radio?.index, []); | ||||||
|  |  | ||||||
|   const columns: Column<ParsedRadio>[] = React.useMemo( |   const columns: Column<ParsedRadio>[] = React.useMemo( | ||||||
|     (): Column<ParsedRadio>[] => [ |     (): Column<ParsedRadio>[] => [ | ||||||
|       { |       { | ||||||
|         id: 'index', |         id: 'index', | ||||||
|         Header: '#', |         Header: '', | ||||||
|         Footer: '', |         Footer: '', | ||||||
|         accessor: 'index', |         accessor: 'index', | ||||||
|  |         Cell: ({ cell }) => indexCell(cell.row.original), | ||||||
|         customWidth: '35px', |         customWidth: '35px', | ||||||
|         alwaysShow: true, |         alwaysShow: true, | ||||||
|  |         disableSortBy: true, | ||||||
|       }, |       }, | ||||||
|       { |       { | ||||||
|         id: 'channel', |         id: 'channel', | ||||||
| @@ -115,6 +120,7 @@ const WifiAnalysisRadioTable = ({ data }: Props) => { | |||||||
|           hiddenColumns={hiddenColumns} |           hiddenColumns={hiddenColumns} | ||||||
|           data={data ?? []} |           data={data ?? []} | ||||||
|           obj={t('controller.devices.logs')} |           obj={t('controller.devices.logs')} | ||||||
|  |           sortBy={data?.[0]?.band ? [{ id: 'index', desc: true }] : undefined} | ||||||
|           // @ts-ignore |           // @ts-ignore | ||||||
|           hideControls |           hideControls | ||||||
|           showAllRows |           showAllRows | ||||||
|   | |||||||
| @@ -24,6 +24,7 @@ const parseRadios = (t: (str: string) => string, data: { data: DeviceStatistics; | |||||||
|         radios.push({ |         radios.push({ | ||||||
|           recorded: data.recorded, |           recorded: data.recorded, | ||||||
|           index: i, |           index: i, | ||||||
|  |           band: radio.band?.[0], | ||||||
|           channel: radio.channel, |           channel: radio.channel, | ||||||
|           channelWidth: radio.channel_width, |           channelWidth: radio.channel_width, | ||||||
|           noise: radio.noise ? parseDbm(radio.noise) : '-', |           noise: radio.noise ? parseDbm(radio.noise) : '-', | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Charles
					Charles