Refresh button added to commands

This commit is contained in:
bourquecharles
2021-05-18 20:16:51 -04:00
parent 187a81f326
commit 3dd0253230
4 changed files with 22 additions and 4 deletions

View File

@@ -85,7 +85,7 @@ const DeviceActions = () => {
<BlinkModalWidget show={showBlinkModal} toggleModal={toggleBlinkModal}/>
<FirmwareUpgradeModal show={showUpgradeModal} toggleModal={toggleUpgradeModal} />
<TraceModalWidget show={showTraceModal} toggleModal={toggleTraceModal} />
<WifiScanModalWidget show={showScanModal} toggleModal={toggleScanModal} />
<WifiScanModalWidget show={showScanModal} toggleModal={toggleScanModal} />
</CCard>
);
};

View File

@@ -13,6 +13,7 @@ import {
import CIcon from '@coreui/icons-react';
import { useSelector } from 'react-redux';
import DatePicker from 'react-widgets/DatePicker';
import { cilSync } from '@coreui/icons';
import { prettyDate, addDays } from '../utils/helper';
import axiosInstance from '../utils/axiosInstance';
import { getToken } from '../utils/authHelper';
@@ -87,6 +88,10 @@ const DeviceCommands = () => {
}
};
const refreshCommands = () => {
setEnd(new Date());
}
const getDetails = (command, commandDetails) => {
if (command === 'wifiscan') {
return null;
@@ -134,6 +139,21 @@ const DeviceCommands = () => {
footerSlot={
<div style={{ padding: '20px' }}>
<CCollapse show={collapse}>
<CRow>
<CCol/>
<CCol>
<div style={{float: 'right'}}>
<CButton onClick={() => refreshCommands()} size="sm">
<CIcon
name="cil-sync"
content={cilSync}
style={{ color: 'white' }}
size="2xl"
/>
</CButton>
</div>
</CCol>
</CRow>
<CRow style={{ marginBottom: '10px' }}>
<CCol>
From:

View File

@@ -14,7 +14,6 @@ const DevicePage = () => {
// Storing the deviceId in the store
let selectedDeviceId = useSelector((state) => state.selectedDeviceId);
const { deviceId } = useParams();
if (!selectedDeviceId || selectedDeviceId !== deviceId) {
dispatch({ type: 'set', selectedDeviceId: deviceId });
selectedDeviceId = deviceId;
@@ -30,7 +29,7 @@ const DevicePage = () => {
<CRow>
<CCol xs="12" sm="6">
<DeviceConfiguration />
<DeviceCommands />
<DeviceCommands/>
</CCol>
<CCol xs="12" sm="6">
<DeviceLogs />

View File

@@ -28,7 +28,6 @@ import {
const [checkingIfSure, setCheckingIfSure] = useState(false);
const selectedDeviceId = useSelector((state) => state.selectedDeviceId);
const confirmingIfSure = () => {
setCheckingIfSure(true);
};