Merge pull request #144 from stephb9959/dev

2.5.36
This commit is contained in:
Charles
2022-02-03 20:45:02 +01:00
committed by GitHub
10 changed files with 123 additions and 59 deletions

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{
"name": "ucentral-client",
"version": "2.5.33",
"version": "2.5.36",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "ucentral-client",
"version": "2.5.33",
"version": "2.5.36",
"dependencies": {
"@coreui/coreui": "^3.4.0",
"@coreui/icons": "^2.0.1",

View File

@@ -1,6 +1,6 @@
{
"name": "ucentral-client",
"version": "2.5.33",
"version": "2.5.36",
"dependencies": {
"@coreui/coreui": "^3.4.0",
"@coreui/icons": "^2.0.1",

View File

@@ -206,6 +206,7 @@
"vendors": "Anbieter",
"view_more": "Mehr anzeigen",
"visibility": "Sichtweite",
"waiting_for_update": "Warten auf Aktualisierung",
"yes": "Ja"
},
"configuration": {
@@ -804,7 +805,9 @@
"associations": "Verbände",
"mode": "Modus",
"network_diagram": "Netzwerkdiagramm",
"override_dfs": "DFS überschreiben",
"radios": "Radios",
"scan_warning": "Ihr 5G-Funkgerät befindet sich auf einem Radarkanal, Sie müssen „Override DFS“ aktivieren, um das Scannen aller 5G-Kanäle zu ermöglichen",
"title": "WLAN-Analyse",
"vendor": "Verkäufer"
}

View File

@@ -206,6 +206,7 @@
"vendors": "Vendors",
"view_more": "View more",
"visibility": "Visibility",
"waiting_for_update": "Waiting for Update",
"yes": "Yes"
},
"configuration": {
@@ -804,7 +805,9 @@
"associations": "Associations",
"mode": "Mode",
"network_diagram": "Network Diagram",
"override_dfs": "Override DFS",
"radios": "Radios",
"scan_warning": "Your 5G radio is on a radar channel, you must enable “Override DFS” to allow scanning of all 5G channels",
"title": "Wi-Fi Analysis",
"vendor": "Vendor"
}

View File

@@ -206,6 +206,7 @@
"vendors": "Vendedores",
"view_more": "Ver más",
"visibility": "Visibilidad",
"waiting_for_update": "Esperando actualización",
"yes": "Sí"
},
"configuration": {
@@ -804,7 +805,9 @@
"associations": "Asociaciones",
"mode": "Modo",
"network_diagram": "Diagrama de Red",
"override_dfs": "Anular DFS",
"radios": "Radios",
"scan_warning": "Su radio 5G está en un canal de radar, debe habilitar \"Anular DFS\" para permitir el escaneo de todos los canales 5G",
"title": "Análisis de Wi-Fi",
"vendor": "Vendedor"
}

View File

@@ -206,6 +206,7 @@
"vendors": "Vendeurs",
"view_more": "Afficher plus",
"visibility": "Visibilité",
"waiting_for_update": "En attente de mise à jour",
"yes": "Oui"
},
"configuration": {
@@ -804,7 +805,9 @@
"associations": "Les associations",
"mode": "Mode",
"network_diagram": "Diagramme de réseau",
"override_dfs": "Remplacer DFS",
"radios": "Radios",
"scan_warning": "Votre radio 5G est sur un canal radar, vous devez activer \"Override DFS\" pour permettre le balayage de tous les canaux 5G",
"title": "Analyse Wi-Fi",
"vendor": "vendeur"
}

View File

@@ -206,6 +206,7 @@
"vendors": "Vendedores",
"view_more": "Veja mais",
"visibility": "visibilidade",
"waiting_for_update": "Aguardando atualização",
"yes": "sim"
},
"configuration": {
@@ -804,7 +805,9 @@
"associations": "Associações",
"mode": "Modo",
"network_diagram": "Diagrama de rede",
"override_dfs": "Substituir DFS",
"radios": "Rádios",
"scan_warning": "Seu rádio 5G está em um canal de radar, você deve habilitar “Override DFS” para permitir a varredura de todos os canais 5G",
"title": "Análise de Wi-Fi",
"vendor": "fornecedor"
}

View File

@@ -114,8 +114,11 @@ const StatisticsChartList = ({ setOptions, section, setStart, setEnd, time }) =>
}
// Looping through all the data
let prevTx = 0;
let prevRx = 0;
for (const log of sortedData) {
// Looping through the interfaces of the log
const version = log.data.version ?? 0;
for (const inter of log.data.interfaces) {
if (inter.ssids?.length > 0) {
let totalTx = 0;
@@ -123,12 +126,19 @@ const StatisticsChartList = ({ setOptions, section, setStart, setEnd, time }) =>
for (const ssid of inter.ssids) {
if (ssid.associations) {
for (const assoc of ssid.associations) {
if (assoc.deltas) {
totalTx += assoc.deltas?.tx_bytes ?? 0;
totalRx += assoc.deltas?.rx_bytes ?? 0;
if (version === 0) {
if (assoc.deltas) {
totalTx += assoc.deltas?.tx_bytes ?? 0;
totalRx += assoc.deltas?.rx_bytes ?? 0;
} else {
totalTx += assoc.tx_bytes ?? 0;
totalRx += assoc.rx_bytes ?? 0;
}
} else {
totalTx += assoc.tx_bytes ?? 0;
totalRx += assoc.rx_bytes ?? 0;
totalTx += assoc.tx_bytes - prevTx ?? 0;
totalRx += assoc.rx_bytes - prevRx ?? 0;
prevTx = assoc.tx_bytes;
prevRx = assoc.rx_bytes;
}
}
}
@@ -146,6 +156,16 @@ const StatisticsChartList = ({ setOptions, section, setStart, setEnd, time }) =>
}
}
for (let y = 0; y < interfaceList.length; y += 1) {
for (let z = 0; z < interfaceList[y].length; z += 1) {
const newArray = interfaceList[y][z].data;
if (newArray.length > 0) newArray.shift();
interfaceList[y][z].data = newArray;
}
}
const newCategories = categories;
if (newCategories.length > 0) newCategories.shift();
const interfaceOptions = {
chart: {
id: 'chart',
@@ -160,7 +180,7 @@ const StatisticsChartList = ({ setOptions, section, setStart, setEnd, time }) =>
fontSize: '15px',
},
},
categories,
categories: newCategories,
tickAmount: areSameDay ? 15 : 10,
},
yaxis: {

View File

@@ -1,4 +1,5 @@
import {
CAlert,
CButton,
CModal,
CModalHeader,
@@ -29,14 +30,15 @@ const WifiScanModal = ({ show, toggleModal }) => {
const { deviceSerialNumber } = useDevice();
const [hadSuccess, setHadSuccess] = useState(false);
const [hadFailure, setHadFailure] = useState(false);
const [errorCode, setErrorCode] = useState(0);
const [waiting, setWaiting] = useState(false);
const [choseVerbose, setVerbose] = useState(true);
const [dfs, setDfs] = useState(true);
const [activeScan, setActiveScan] = useState(false);
const [hideOptions, setHideOptions] = useState(false);
const [channelList, setChannelList] = useState([]);
const toggleVerbose = () => {
setVerbose(!choseVerbose);
const toggleDfs = () => {
setDfs(!dfs);
};
const toggleActiveScan = () => {
@@ -48,9 +50,10 @@ const WifiScanModal = ({ show, toggleModal }) => {
setHadFailure(false);
setWaiting(false);
setChannelList([]);
setVerbose(true);
setDfs(true);
setActiveScan(false);
setHideOptions(false);
setErrorCode(0);
}, [show]);
const parseThroughList = (scanList) => {
@@ -91,7 +94,7 @@ const WifiScanModal = ({ show, toggleModal }) => {
const parameters = {
serialNumber: deviceSerialNumber,
verbose: choseVerbose,
override_dfs: dfs,
activeScan,
};
const headers = {
@@ -110,6 +113,7 @@ const WifiScanModal = ({ show, toggleModal }) => {
if (scanList) {
setChannelList(parseThroughList(scanList));
setErrorCode(response.data.errorCode ?? 0);
setHideOptions(true);
setHadSuccess(true);
} else {
@@ -142,14 +146,14 @@ const WifiScanModal = ({ show, toggleModal }) => {
<h6>{t('scan.directions')}</h6>
<CRow className="mt-3">
<CCol md="3">
<p className="pl-2">Verbose:</p>
<p className="pl-2">{t('wifi_analysis.override_dfs')}:</p>
</CCol>
<CCol>
<CForm className="pl-4">
<CSwitch
color="primary"
defaultChecked={choseVerbose}
onClick={toggleVerbose}
defaultChecked={dfs}
onClick={toggleDfs}
labelOn={t('common.on')}
labelOff={t('common.off')}
/>
@@ -191,6 +195,13 @@ const WifiScanModal = ({ show, toggleModal }) => {
<h6>{t('scan.result_directions')}</h6>
</CCol>
</CRow>
{errorCode === 1 && (
<CRow className="mb-2">
<CCol>
<CAlert color="warning">{t('wifi_analysis.scan_warning')}</CAlert>
</CCol>
</CRow>
)}
<WifiChannelTable channels={channelList} />
</div>
</CModalBody>

View File

@@ -21,11 +21,32 @@ import { prettyDate, compactSecondsToDetailed, cleanBytesString } from 'utils/he
import styles from './index.module.scss';
const errorField = (t) => (
<CAlert className="py-0" color="danger">
<CAlert className="py-0 my-0" color="danger">
{t('status.error')}
</CAlert>
);
const stats = (lastStats) => (
<div>
{lastStats?.unit?.load[0] !== undefined ? (lastStats?.unit?.load[0] * 100).toFixed(2) : '-'}%
{' / '}
{lastStats?.unit?.load[1] !== undefined ? (lastStats?.unit?.load[1] * 100).toFixed(2) : '-'}%
{' / '}
{lastStats?.unit?.load[2] !== undefined ? (lastStats?.unit?.load[2] * 100).toFixed(2) : '-'}%
</div>
);
const waitingForUpdateField = (t) => (
<CAlert className="py-0 my-0" color="info">
{t('common.waiting_for_update')}
</CAlert>
);
const displayInfo = (value, toDisplay, t) => {
if (value !== undefined) return toDisplay;
return waitingForUpdateField(t);
};
const getMemoryColor = (memTotal, memFree) => {
let memoryUsed = 0;
if (memTotal > 0) memoryUsed = Math.floor(((memTotal - memFree) / memTotal) * 100);
@@ -40,6 +61,16 @@ const getMemoryPercentage = (memTotal, memFree) => {
return `${Math.floor(((memTotal - memFree) / memTotal) * 100)}%`;
};
const memory = (lastStats) => (
<CAlert
style={{ width: '40px' }}
className="p-0 text-center"
color={getMemoryColor(lastStats?.unit?.memory?.total ?? 0, lastStats?.unit?.memory?.free ?? 0)}
>
{getMemoryPercentage(lastStats?.unit?.memory?.total ?? 0, lastStats?.unit?.memory?.free ?? 0)}
</CAlert>
);
const DeviceStatusCard = ({
t,
loading,
@@ -113,11 +144,15 @@ const DeviceStatusCard = ({
<CCol className="my-1" md="8" xl="8">
{error
? errorField(t)
: compactSecondsToDetailed(
: displayInfo(
lastStats?.unit?.uptime,
t('common.day'),
t('common.days'),
t('common.seconds'),
compactSecondsToDetailed(
lastStats?.unit?.uptime,
t('common.day'),
t('common.days'),
t('common.seconds'),
),
t,
)}
</CCol>
<CCol className="my-1" md="4" xl="4">
@@ -130,7 +165,13 @@ const DeviceStatusCard = ({
{t('status.localtime')}:
</CCol>
<CCol className="my-1" md="8" xl="8">
{error ? errorField(t) : prettyDate(lastStats?.unit?.localtime)}
{error
? errorField(t)
: displayInfo(
lastStats?.unit?.localtime,
prettyDate(lastStats?.unit?.localtime),
t,
)}
</CCol>
<CCol className="mt-1" md="4" xl="4">
<CLabel>{t('firmware.revision')}: </CLabel>
@@ -150,52 +191,29 @@ const DeviceStatusCard = ({
{t('status.load_averages')}:
</CCol>
<CCol className="mb-1" md="8" xl="8">
{error ? (
errorField(t)
) : (
<div>
{lastStats?.unit?.load[0] !== undefined
? (lastStats?.unit?.load[0] * 100).toFixed(2)
: '-'}
%{' / '}
{lastStats?.unit?.load[1] !== undefined
? (lastStats?.unit?.load[1] * 100).toFixed(2)
: '-'}
%{' / '}
{lastStats?.unit?.load[2] !== undefined
? (lastStats?.unit?.load[2] * 100).toFixed(2)
: '-'}
%
</div>
)}
{error
? errorField(t)
: displayInfo(lastStats?.unit?.memory?.total, stats(lastStats), t)}
</CCol>
<CCol className="mb-1" md="4" xl="4">
{t('status.total_memory')}:
</CCol>
<CCol className="mb-1" md="8" xl="8" style={{ paddingTop: '5px' }}>
{error ? errorField(t) : cleanBytesString(lastStats?.unit?.memory?.total)}
{error
? errorField(t)
: displayInfo(
lastStats?.unit?.memory?.total,
cleanBytesString(lastStats?.unit?.memory?.total),
t,
)}
</CCol>
<CCol className="mb-1" md="4" xl="4">
{t('status.memory')}:
</CCol>
<CCol className="mb-1" md="8" xl="8" style={{ paddingTop: '5px' }}>
{error ? (
errorField(t)
) : (
<CAlert
style={{ width: '40px' }}
className="p-0 text-center"
color={getMemoryColor(
lastStats?.unit?.memory?.total ?? 0,
lastStats?.unit?.memory?.free ?? 0,
)}
>
{getMemoryPercentage(
lastStats?.unit?.memory?.total ?? 0,
lastStats?.unit?.memory?.free ?? 0,
)}
</CAlert>
)}
{error
? errorField(t)
: displayInfo(lastStats?.unit?.memory?.total, memory(lastStats), t)}
</CCol>
</CRow>
</CCol>