mirror of
https://github.com/Telecominfraproject/wlan-cloud-ucentralgw-ui.git
synced 2025-11-02 03:37:50 +00:00
Prettier run
This commit is contained in:
@@ -337,7 +337,9 @@ const DeviceListDisplay = ({
|
||||
content={item.firmware ? item.firmware : t('common.na')}
|
||||
placement="top"
|
||||
>
|
||||
<p style={{width: '225px'}} className="text-truncate">{item.firmware}</p>
|
||||
<p style={{ width: '225px' }} className="text-truncate">
|
||||
{item.firmware}
|
||||
</p>
|
||||
</CPopover>
|
||||
</td>
|
||||
),
|
||||
@@ -347,7 +349,9 @@ const DeviceListDisplay = ({
|
||||
content={item.compatible ? item.compatible : t('common.na')}
|
||||
placement="top"
|
||||
>
|
||||
<p style={{width: '150px'}} className="text-truncate">{item.compatible}</p>
|
||||
<p style={{ width: '150px' }} className="text-truncate">
|
||||
{item.compatible}
|
||||
</p>
|
||||
</CPopover>
|
||||
</td>
|
||||
),
|
||||
@@ -359,7 +363,9 @@ const DeviceListDisplay = ({
|
||||
content={item.ipAddress ? item.ipAddress : t('common.na')}
|
||||
placement="top"
|
||||
>
|
||||
<p style={{width: '150px'}} className="text-truncate">{item.ipAddress}</p>
|
||||
<p style={{ width: '150px' }} className="text-truncate">
|
||||
{item.ipAddress}
|
||||
</p>
|
||||
</CPopover>
|
||||
</td>
|
||||
),
|
||||
|
||||
@@ -3,7 +3,16 @@ import { useTranslation } from 'react-i18next';
|
||||
import PropTypes from 'prop-types';
|
||||
import { CButton, CSpinner, CModalFooter } from '@coreui/react';
|
||||
|
||||
const UpgradeFooter = ({ isNow, isShown, isLoading, action, color, variant, block, toggleParent }) => {
|
||||
const UpgradeFooter = ({
|
||||
isNow,
|
||||
isShown,
|
||||
isLoading,
|
||||
action,
|
||||
color,
|
||||
variant,
|
||||
block,
|
||||
toggleParent,
|
||||
}) => {
|
||||
const { t } = useTranslation();
|
||||
const [askingIfSure, setAskingIfSure] = useState(false);
|
||||
|
||||
|
||||
@@ -42,11 +42,10 @@ const FirmwareUpgradeModal = ({ show, toggleModal }) => {
|
||||
const selectedDeviceId = useSelector((state) => state.selectedDeviceId);
|
||||
|
||||
const toggleNow = () => {
|
||||
if(isNow){
|
||||
if (isNow) {
|
||||
setWaitForUpgrade(false);
|
||||
setDisableWaiting(true);
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
setDisableWaiting(false);
|
||||
}
|
||||
|
||||
@@ -114,8 +113,7 @@ const FirmwareUpgradeModal = ({ show, toggleModal }) => {
|
||||
setShowWaitingConsole(true);
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
})
|
||||
.catch(() => {})
|
||||
.finally(() => {
|
||||
setBlockFields(false);
|
||||
setWaitingForUpgrade(false);
|
||||
@@ -198,7 +196,10 @@ const FirmwareUpgradeModal = ({ show, toggleModal }) => {
|
||||
<CInvalidFeedback>{t('common.need_date')}</CInvalidFeedback>
|
||||
</CCol>
|
||||
</CRow>
|
||||
<CRow className={styles.spacedRow} hidden={true || !isNow || disabledWaiting || !deviceConnected}>
|
||||
<CRow
|
||||
className={styles.spacedRow}
|
||||
hidden={true || !isNow || disabledWaiting || !deviceConnected}
|
||||
>
|
||||
<CCol md="8">
|
||||
<p className={styles.spacedText}>
|
||||
{t('upgrade.wait_for_upgrade')}
|
||||
|
||||
@@ -60,10 +60,10 @@ const StatisticsChartList = ({ selectedDeviceId }) => {
|
||||
// Looping through the interfaces of the log
|
||||
for (const inter of log.data.interfaces) {
|
||||
interfaceList[interfaceTypes[inter.name]][0].data.push(
|
||||
inter.counters?.tx_bytes? Math.floor(inter.counters.tx_bytes / 1024) : 0
|
||||
inter.counters?.tx_bytes ? Math.floor(inter.counters.tx_bytes / 1024) : 0,
|
||||
);
|
||||
interfaceList[interfaceTypes[inter.name]][1].data.push(
|
||||
inter.counters?.rx_bytes? Math.floor(inter.counters.rx_bytes / 1024) : 0
|
||||
inter.counters?.rx_bytes ? Math.floor(inter.counters.rx_bytes / 1024) : 0,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -74,7 +74,7 @@ const StatisticsChartList = ({ selectedDeviceId }) => {
|
||||
group: 'txrx',
|
||||
},
|
||||
stroke: {
|
||||
curve: 'smooth'
|
||||
curve: 'smooth',
|
||||
},
|
||||
xaxis: {
|
||||
title: {
|
||||
@@ -115,22 +115,22 @@ const StatisticsChartList = ({ selectedDeviceId }) => {
|
||||
};
|
||||
|
||||
const getStatistics = () => {
|
||||
const options = {
|
||||
headers: {
|
||||
Accept: 'application/json',
|
||||
Authorization: `Bearer ${getToken()}`,
|
||||
},
|
||||
params: {
|
||||
serialNumber: '24f5a207a130',
|
||||
},
|
||||
};
|
||||
const options = {
|
||||
headers: {
|
||||
Accept: 'application/json',
|
||||
Authorization: `Bearer ${getToken()}`,
|
||||
},
|
||||
params: {
|
||||
serialNumber: '24f5a207a130',
|
||||
},
|
||||
};
|
||||
|
||||
axiosInstance
|
||||
.get(`/device/${selectedDeviceId}/statistics?newest=true&limit=50`, options)
|
||||
.then((response) => {
|
||||
transformIntoDataset(response.data.data);
|
||||
})
|
||||
.catch(() => {});
|
||||
axiosInstance
|
||||
.get(`/device/${selectedDeviceId}/statistics?newest=true&limit=50`, options)
|
||||
.then((response) => {
|
||||
transformIntoDataset(response.data.data);
|
||||
})
|
||||
.catch(() => {});
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
@@ -161,11 +161,11 @@ const StatisticsChartList = ({ selectedDeviceId }) => {
|
||||
fontSize: '25px',
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
return (
|
||||
<div key={createUuid()}>
|
||||
<DeviceStatisticsChart chart={ options } />
|
||||
<DeviceStatisticsChart chart={options} />
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
|
||||
@@ -37,7 +37,9 @@ const DeviceStatisticsCard = ({ selectedDeviceId }) => {
|
||||
<CCardHeader>
|
||||
<CRow>
|
||||
<CCol>
|
||||
<div className={["text-value-lg", styles.cardTitle].join(" ")}>{t('statistics.title')}</div>
|
||||
<div className={['text-value-lg', styles.cardTitle].join(' ')}>
|
||||
{t('statistics.title')}
|
||||
</div>
|
||||
</CCol>
|
||||
<CCol className={styles.cardOptions}>
|
||||
<CDropdown className="m-1 btn-group">
|
||||
|
||||
@@ -33,7 +33,7 @@ const ActionModal = ({ show, toggleModal }) => {
|
||||
|
||||
const toggleNow = () => {
|
||||
setIsNow(!isNow);
|
||||
}
|
||||
};
|
||||
|
||||
const setDate = (date) => {
|
||||
if (date) {
|
||||
|
||||
@@ -7,7 +7,7 @@ import axiosInstance from 'utils/axiosInstance';
|
||||
|
||||
import styles from './index.module.scss';
|
||||
|
||||
const WaitingForTraceBody = ({serialNumber, commandUuid, toggle}) => {
|
||||
const WaitingForTraceBody = ({ serialNumber, commandUuid, toggle }) => {
|
||||
const { t } = useTranslation();
|
||||
const [secondsElapsed, setSecondsElapsed] = useState(0);
|
||||
const [waitingForFile, setWaitingForFile] = useState(true);
|
||||
@@ -23,12 +23,12 @@ const WaitingForTraceBody = ({serialNumber, commandUuid, toggle}) => {
|
||||
axiosInstance
|
||||
.get(`/command/${encodeURIComponent(commandUuid)}`, options)
|
||||
.then((response) => {
|
||||
if(response.data.waitingForFile === 0){
|
||||
if (response.data.waitingForFile === 0) {
|
||||
setWaitingForFile(false);
|
||||
}
|
||||
})
|
||||
.catch(() => {});
|
||||
}
|
||||
};
|
||||
|
||||
const downloadTrace = () => {
|
||||
const options = {
|
||||
@@ -48,36 +48,36 @@ const WaitingForTraceBody = ({serialNumber, commandUuid, toggle}) => {
|
||||
link.download = `Trace_${commandUuid}.pcap`;
|
||||
link.click();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
const timer = setInterval(() => {
|
||||
setSecondsElapsed(secondsElapsed + 1);
|
||||
}, 1000);
|
||||
if(!waitingForFile){
|
||||
if (!waitingForFile) {
|
||||
clearInterval(timer);
|
||||
}
|
||||
return () => {
|
||||
clearInterval(timer);
|
||||
}
|
||||
};
|
||||
}, [waitingForFile, secondsElapsed]);
|
||||
|
||||
useEffect(() => {
|
||||
const refreshStatus = setInterval(() => {
|
||||
getTraceResult();
|
||||
}, 5000);
|
||||
if(!waitingForFile){
|
||||
if (!waitingForFile) {
|
||||
clearInterval(refreshStatus);
|
||||
}
|
||||
return () => {
|
||||
clearInterval(refreshStatus);
|
||||
}
|
||||
};
|
||||
}, [waitingForFile]);
|
||||
|
||||
return (
|
||||
<div>
|
||||
<CModalBody>
|
||||
<h6>{t('trace.waiting_seconds', {seconds: secondsElapsed})}</h6>
|
||||
<h6>{t('trace.waiting_seconds', { seconds: secondsElapsed })}</h6>
|
||||
<p>{t('trace.waiting_directions')}</p>
|
||||
<div className={styles.centerDiv}>
|
||||
<CSpinner hidden={!waitingForFile} />
|
||||
@@ -97,14 +97,13 @@ const WaitingForTraceBody = ({serialNumber, commandUuid, toggle}) => {
|
||||
</CButton>
|
||||
</CModalFooter>
|
||||
</div>
|
||||
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
WaitingForTraceBody.propTypes = {
|
||||
serialNumber: PropTypes.string.isRequired,
|
||||
commandUuid: PropTypes.string.isRequired,
|
||||
toggle: PropTypes.func.isRequired
|
||||
toggle: PropTypes.func.isRequired,
|
||||
};
|
||||
|
||||
export default WaitingForTraceBody;
|
||||
|
||||
@@ -47,7 +47,7 @@ const TraceModal = ({ show, toggleModal }) => {
|
||||
|
||||
const toggleWaitForTrace = () => {
|
||||
setWaitForTrace(!waitForTrace);
|
||||
}
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
setWaitForTrace(false);
|
||||
@@ -88,7 +88,7 @@ const TraceModal = ({ show, toggleModal }) => {
|
||||
.post(`/device/${encodeURIComponent(selectedDeviceId)}/trace`, parameters, { headers })
|
||||
.then((response) => {
|
||||
setHadSuccess(true);
|
||||
if(waitForTrace) {
|
||||
if (waitForTrace) {
|
||||
setCommandUuid(response.data.UUID);
|
||||
setWaitingForTrace(true);
|
||||
}
|
||||
@@ -114,17 +114,18 @@ const TraceModal = ({ show, toggleModal }) => {
|
||||
}
|
||||
}, [show]);
|
||||
|
||||
|
||||
const getBody = () => {
|
||||
if(waitingForTrace){
|
||||
if (waitingForTrace) {
|
||||
return (
|
||||
<WaitingForTraceBody toggle={toggleModal} serialNumber={selectedDeviceId} commandUuid={commandUuid}/>
|
||||
<WaitingForTraceBody
|
||||
toggle={toggleModal}
|
||||
serialNumber={selectedDeviceId}
|
||||
commandUuid={commandUuid}
|
||||
/>
|
||||
);
|
||||
}
|
||||
if(hadSuccess){
|
||||
return(
|
||||
<SuccessfulActionModalBody toggleModal={toggleModal} />
|
||||
);
|
||||
if (hadSuccess) {
|
||||
return <SuccessfulActionModalBody toggleModal={toggleModal} />;
|
||||
}
|
||||
return (
|
||||
<div>
|
||||
@@ -221,9 +222,7 @@ const TraceModal = ({ show, toggleModal }) => {
|
||||
</CRow>
|
||||
<CRow className={styles.spacedRow} hidden={!isDeviceConnected}>
|
||||
<CCol md="8">
|
||||
<p className={styles.spacedText}>
|
||||
{t('trace.wait_for_file')}
|
||||
</p>
|
||||
<p className={styles.spacedText}>{t('trace.wait_for_file')}</p>
|
||||
</CCol>
|
||||
<CCol>
|
||||
<CSwitch
|
||||
@@ -257,7 +256,7 @@ const TraceModal = ({ show, toggleModal }) => {
|
||||
</CModalFooter>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<CModal show={show} onClose={toggleModal}>
|
||||
|
||||
@@ -9,7 +9,7 @@ import {
|
||||
CForm,
|
||||
CSwitch,
|
||||
CCol,
|
||||
CSpinner
|
||||
CSpinner,
|
||||
} from '@coreui/react';
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
@@ -186,7 +186,7 @@ const WifiScanModal = ({ show, toggleModal }) => {
|
||||
</CModalBody>
|
||||
<CModalFooter>
|
||||
<LoadingButton
|
||||
label={(!hadSuccess && !hadFailure) ? t('scan.scan') : t('scan.re_scan')}
|
||||
label={!hadSuccess && !hadFailure ? t('scan.scan') : t('scan.re_scan')}
|
||||
isLoadingLabel={t('scan.scanning')}
|
||||
isLoading={waiting}
|
||||
action={doAction}
|
||||
@@ -195,7 +195,7 @@ const WifiScanModal = ({ show, toggleModal }) => {
|
||||
disabled={waiting}
|
||||
/>
|
||||
<CButton color="secondary" onClick={toggleModal}>
|
||||
{(!hadSuccess && !hadFailure) ? t('common.cancel') : t('common.exit')}
|
||||
{!hadSuccess && !hadFailure ? t('common.cancel') : t('common.exit')}
|
||||
</CButton>
|
||||
</CModalFooter>
|
||||
</CModal>
|
||||
|
||||
Reference in New Issue
Block a user