mirror of
				https://github.com/optim-enterprises-bv/OptimCloud-gw-ui.git
				synced 2025-11-03 19:57:46 +00:00 
			
		
		
		
	Prettier run on whole solution
This commit is contained in:
		@@ -23,8 +23,18 @@ const TheSidebar = () => {
 | 
				
			|||||||
  return (
 | 
					  return (
 | 
				
			||||||
    <CSidebar show={show} onShowChange={(val) => dispatch({ type: 'set', sidebarShow: val })}>
 | 
					    <CSidebar show={show} onShowChange={(val) => dispatch({ type: 'set', sidebarShow: val })}>
 | 
				
			||||||
      <CSidebarBrand className="d-md-down-none" to="/devices">
 | 
					      <CSidebarBrand className="d-md-down-none" to="/devices">
 | 
				
			||||||
        <img  className="c-sidebar-brand-full" src={logoBar} style={{ height: '75px'}} alt="OpenWifi" />
 | 
					        <img
 | 
				
			||||||
        <img  className="c-sidebar-brand-minimized" src={logoBar} style={{ height: '75px', width: '75px' }} alt="OpenWifi" />
 | 
					          className="c-sidebar-brand-full"
 | 
				
			||||||
 | 
					          src={logoBar}
 | 
				
			||||||
 | 
					          style={{ height: '75px' }}
 | 
				
			||||||
 | 
					          alt="OpenWifi"
 | 
				
			||||||
 | 
					        />
 | 
				
			||||||
 | 
					        <img
 | 
				
			||||||
 | 
					          className="c-sidebar-brand-minimized"
 | 
				
			||||||
 | 
					          src={logoBar}
 | 
				
			||||||
 | 
					          style={{ height: '75px', width: '75px' }}
 | 
				
			||||||
 | 
					          alt="OpenWifi"
 | 
				
			||||||
 | 
					        />
 | 
				
			||||||
      </CSidebarBrand>
 | 
					      </CSidebarBrand>
 | 
				
			||||||
      <CSidebarNav>
 | 
					      <CSidebarNav>
 | 
				
			||||||
        <CCreateElement
 | 
					        <CCreateElement
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -94,7 +94,7 @@ const DeviceList = () => {
 | 
				
			|||||||
      })
 | 
					      })
 | 
				
			||||||
      .then((response) => {
 | 
					      .then((response) => {
 | 
				
			||||||
        const device = response.data.devicesWithStatus[0];
 | 
					        const device = response.data.devicesWithStatus[0];
 | 
				
			||||||
        const foundIndex = devices.findIndex(obj => obj.serialNumber === serialNumber);
 | 
					        const foundIndex = devices.findIndex((obj) => obj.serialNumber === serialNumber);
 | 
				
			||||||
        const newList = devices;
 | 
					        const newList = devices;
 | 
				
			||||||
        newList[foundIndex] = device;
 | 
					        newList[foundIndex] = device;
 | 
				
			||||||
        setDevices(newList);
 | 
					        setDevices(newList);
 | 
				
			||||||
@@ -103,7 +103,7 @@ const DeviceList = () => {
 | 
				
			|||||||
      .catch(() => {
 | 
					      .catch(() => {
 | 
				
			||||||
        setLoading(false);
 | 
					        setLoading(false);
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
  }
 | 
					  };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  const updateDevicesPerPage = (value) => {
 | 
					  const updateDevicesPerPage = (value) => {
 | 
				
			||||||
    setDevicesPerPage(value);
 | 
					    setDevicesPerPage(value);
 | 
				
			||||||
@@ -143,7 +143,14 @@ const DeviceList = () => {
 | 
				
			|||||||
  );
 | 
					  );
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const DeviceListDisplay = ({ devices, loading, updateDevicesPerPage, pageCount, updatePage, refreshDevice }) => {
 | 
					const DeviceListDisplay = ({
 | 
				
			||||||
 | 
					  devices,
 | 
				
			||||||
 | 
					  loading,
 | 
				
			||||||
 | 
					  updateDevicesPerPage,
 | 
				
			||||||
 | 
					  pageCount,
 | 
				
			||||||
 | 
					  updatePage,
 | 
				
			||||||
 | 
					  refreshDevice,
 | 
				
			||||||
 | 
					}) => {
 | 
				
			||||||
  const columns = [
 | 
					  const columns = [
 | 
				
			||||||
    { key: 'deviceType', label: '', filter: false, sorter: false, _style: { width: '5%' } },
 | 
					    { key: 'deviceType', label: '', filter: false, sorter: false, _style: { width: '5%' } },
 | 
				
			||||||
    { key: 'verifiedCertificate', label: 'Certificate', _style: { width: '1%' } },
 | 
					    { key: 'verifiedCertificate', label: 'Certificate', _style: { width: '1%' } },
 | 
				
			||||||
@@ -194,8 +201,20 @@ const DeviceListDisplay = ({ devices, loading, updateDevicesPerPage, pageCount,
 | 
				
			|||||||
    if (cert === 'NO_CERTIFICATE') {
 | 
					    if (cert === 'NO_CERTIFICATE') {
 | 
				
			||||||
      return (
 | 
					      return (
 | 
				
			||||||
        <div style={{ position: 'relative' }}>
 | 
					        <div style={{ position: 'relative' }}>
 | 
				
			||||||
          <CIcon style={{position: 'absolute', left: '31%', marginTop:'8%'}} name="cil-badge" content={cilBadge} size="2xl" alt="AP" />
 | 
					          <CIcon
 | 
				
			||||||
          <CIcon style={{position: 'absolute', zIndex: 99, left: '21%', color: '#e55353'}} name="cil-ban" content={cilBan} size="3xl" alt="AP" />
 | 
					            style={{ position: 'absolute', left: '31%', marginTop: '8%' }}
 | 
				
			||||||
 | 
					            name="cil-badge"
 | 
				
			||||||
 | 
					            content={cilBadge}
 | 
				
			||||||
 | 
					            size="2xl"
 | 
				
			||||||
 | 
					            alt="AP"
 | 
				
			||||||
 | 
					          />
 | 
				
			||||||
 | 
					          <CIcon
 | 
				
			||||||
 | 
					            style={{ position: 'absolute', zIndex: 99, left: '21%', color: '#e55353' }}
 | 
				
			||||||
 | 
					            name="cil-ban"
 | 
				
			||||||
 | 
					            content={cilBan}
 | 
				
			||||||
 | 
					            size="3xl"
 | 
				
			||||||
 | 
					            alt="AP"
 | 
				
			||||||
 | 
					          />
 | 
				
			||||||
        </div>
 | 
					        </div>
 | 
				
			||||||
      );
 | 
					      );
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@@ -203,7 +222,7 @@ const DeviceListDisplay = ({ devices, loading, updateDevicesPerPage, pageCount,
 | 
				
			|||||||
    let color = 'transparent';
 | 
					    let color = 'transparent';
 | 
				
			||||||
    switch (cert) {
 | 
					    switch (cert) {
 | 
				
			||||||
      case 'VALID_CERTIFICATE':
 | 
					      case 'VALID_CERTIFICATE':
 | 
				
			||||||
        color = 'danger'
 | 
					        color = 'danger';
 | 
				
			||||||
        break;
 | 
					        break;
 | 
				
			||||||
      case 'MISMATCH_SERIAL':
 | 
					      case 'MISMATCH_SERIAL':
 | 
				
			||||||
        return (
 | 
					        return (
 | 
				
			||||||
@@ -217,8 +236,20 @@ const DeviceListDisplay = ({ devices, loading, updateDevicesPerPage, pageCount,
 | 
				
			|||||||
      default:
 | 
					      default:
 | 
				
			||||||
        return (
 | 
					        return (
 | 
				
			||||||
          <div style={{ position: 'relative' }}>
 | 
					          <div style={{ position: 'relative' }}>
 | 
				
			||||||
          <CIcon style={{position: 'absolute', left: '31%', marginTop:'8%'}}name="cil-badge" content={cilBadge} size="2xl" alt="AP" />
 | 
					            <CIcon
 | 
				
			||||||
          <CIcon style={{position: 'absolute', zIndex: 99, left: '21%', color: '#e55353'}} name="cil-ban" content={cilBan} size="3xl" alt="AP" />
 | 
					              style={{ position: 'absolute', left: '31%', marginTop: '8%' }}
 | 
				
			||||||
 | 
					              name="cil-badge"
 | 
				
			||||||
 | 
					              content={cilBadge}
 | 
				
			||||||
 | 
					              size="2xl"
 | 
				
			||||||
 | 
					              alt="AP"
 | 
				
			||||||
 | 
					            />
 | 
				
			||||||
 | 
					            <CIcon
 | 
				
			||||||
 | 
					              style={{ position: 'absolute', zIndex: 99, left: '21%', color: '#e55353' }}
 | 
				
			||||||
 | 
					              name="cil-ban"
 | 
				
			||||||
 | 
					              content={cilBan}
 | 
				
			||||||
 | 
					              size="3xl"
 | 
				
			||||||
 | 
					              alt="AP"
 | 
				
			||||||
 | 
					            />
 | 
				
			||||||
          </div>
 | 
					          </div>
 | 
				
			||||||
        );
 | 
					        );
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@@ -227,8 +258,7 @@ const DeviceListDisplay = ({ devices, loading, updateDevicesPerPage, pageCount,
 | 
				
			|||||||
        <CIcon name="cil-badge" content={cilBadge} size="2xl" alt="AP" />
 | 
					        <CIcon name="cil-badge" content={cilBadge} size="2xl" alt="AP" />
 | 
				
			||||||
      </CBadge>
 | 
					      </CBadge>
 | 
				
			||||||
    );
 | 
					    );
 | 
				
			||||||
  }
 | 
					  };
 | 
				
			||||||
  
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
  const getStatusBadge = (status) => {
 | 
					  const getStatusBadge = (status) => {
 | 
				
			||||||
    if (status) {
 | 
					    if (status) {
 | 
				
			||||||
@@ -286,10 +316,7 @@ const DeviceListDisplay = ({ devices, loading, updateDevicesPerPage, pageCount,
 | 
				
			|||||||
              ),
 | 
					              ),
 | 
				
			||||||
              verifiedCertificate: (item) => (
 | 
					              verifiedCertificate: (item) => (
 | 
				
			||||||
                <td style={{ textAlign: 'center' }}>
 | 
					                <td style={{ textAlign: 'center' }}>
 | 
				
			||||||
                  <CPopover
 | 
					                  <CPopover content={item.verifiedCertificate ?? 'Unknown'} placement="top">
 | 
				
			||||||
                    content={item.verifiedCertificate ?? 'Unknown'}
 | 
					 | 
				
			||||||
                    placement="top"
 | 
					 | 
				
			||||||
                  >
 | 
					 | 
				
			||||||
                    {getCertBadge(item.verifiedCertificate)}
 | 
					                    {getCertBadge(item.verifiedCertificate)}
 | 
				
			||||||
                  </CPopover>
 | 
					                  </CPopover>
 | 
				
			||||||
                </td>
 | 
					                </td>
 | 
				
			||||||
@@ -319,7 +346,12 @@ const DeviceListDisplay = ({ devices, loading, updateDevicesPerPage, pageCount,
 | 
				
			|||||||
              ),
 | 
					              ),
 | 
				
			||||||
              refresh: (item) => (
 | 
					              refresh: (item) => (
 | 
				
			||||||
                <td className="py-2">
 | 
					                <td className="py-2">
 | 
				
			||||||
                  <CButton onClick={() => refreshDevice(item.serialNumber)} color="primary" variant="outline" size="sm">
 | 
					                  <CButton
 | 
				
			||||||
 | 
					                    onClick={() => refreshDevice(item.serialNumber)}
 | 
				
			||||||
 | 
					                    color="primary"
 | 
				
			||||||
 | 
					                    variant="outline"
 | 
				
			||||||
 | 
					                    size="sm"
 | 
				
			||||||
 | 
					                  >
 | 
				
			||||||
                    <CIcon name="cil-sync" content={cilSync} size="sm" />
 | 
					                    <CIcon name="cil-sync" content={cilSync} size="sm" />
 | 
				
			||||||
                  </CButton>
 | 
					                  </CButton>
 | 
				
			||||||
                </td>
 | 
					                </td>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -118,12 +118,7 @@ const ActionModalWidget = ({ show, toggleModal, title, directions, action, extra
 | 
				
			|||||||
        <h6>{directions}</h6>
 | 
					        <h6>{directions}</h6>
 | 
				
			||||||
        <CRow style={{ marginTop: '20px' }}>
 | 
					        <CRow style={{ marginTop: '20px' }}>
 | 
				
			||||||
          <CCol>
 | 
					          <CCol>
 | 
				
			||||||
              <CButton 
 | 
					            <CButton onClick={() => doAction(true)} disabled={waiting} block color="primary">
 | 
				
			||||||
                onClick={() => doAction(true)} 
 | 
					 | 
				
			||||||
                disabled={waiting} 
 | 
					 | 
				
			||||||
                block 
 | 
					 | 
				
			||||||
                color="primary"
 | 
					 | 
				
			||||||
              >
 | 
					 | 
				
			||||||
              {waiting && doingNow ? 'Loading...' : 'Do Now!'}
 | 
					              {waiting && doingNow ? 'Loading...' : 'Do Now!'}
 | 
				
			||||||
              <CSpinner hidden={!waiting || !doingNow} component="span" size="sm" />
 | 
					              <CSpinner hidden={!waiting || !doingNow} component="span" size="sm" />
 | 
				
			||||||
            </CButton>
 | 
					            </CButton>
 | 
				
			||||||
@@ -155,7 +150,7 @@ const ActionModalWidget = ({ show, toggleModal, title, directions, action, extra
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        <div hidden={!hadSuccess && !hadFailure}>
 | 
					        <div hidden={!hadSuccess && !hadFailure}>
 | 
				
			||||||
          <div>
 | 
					          <div>
 | 
				
			||||||
            <pre className='ignore'>{responseBody}</pre>
 | 
					            <pre className="ignore">{responseBody}</pre>
 | 
				
			||||||
          </div>
 | 
					          </div>
 | 
				
			||||||
        </div>
 | 
					        </div>
 | 
				
			||||||
      </CModalBody>
 | 
					      </CModalBody>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -11,7 +11,7 @@ import {
 | 
				
			|||||||
  CForm,
 | 
					  CForm,
 | 
				
			||||||
  CFormGroup,
 | 
					  CFormGroup,
 | 
				
			||||||
  CInputRadio,
 | 
					  CInputRadio,
 | 
				
			||||||
    CLabel
 | 
					  CLabel,
 | 
				
			||||||
} from '@coreui/react';
 | 
					} from '@coreui/react';
 | 
				
			||||||
import React, { useState, useEffect } from 'react';
 | 
					import React, { useState, useEffect } from 'react';
 | 
				
			||||||
import DatePicker from 'react-widgets/DatePicker';
 | 
					import DatePicker from 'react-widgets/DatePicker';
 | 
				
			||||||
@@ -78,7 +78,7 @@ const BlinkModalWidget = ({show, toggleModal}) => {
 | 
				
			|||||||
      serialNumber: selectedDeviceId,
 | 
					      serialNumber: selectedDeviceId,
 | 
				
			||||||
      when: isNow ? '' : utcDateString,
 | 
					      when: isNow ? '' : utcDateString,
 | 
				
			||||||
      pattern: chosenPattern,
 | 
					      pattern: chosenPattern,
 | 
				
			||||||
        duration: 30
 | 
					      duration: 30,
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const headers = {
 | 
					    const headers = {
 | 
				
			||||||
@@ -112,12 +112,7 @@ const BlinkModalWidget = ({show, toggleModal}) => {
 | 
				
			|||||||
        <h6>When would you like make the LEDs of this device blink?</h6>
 | 
					        <h6>When would you like make the LEDs of this device blink?</h6>
 | 
				
			||||||
        <CRow style={{ marginTop: '20px' }}>
 | 
					        <CRow style={{ marginTop: '20px' }}>
 | 
				
			||||||
          <CCol>
 | 
					          <CCol>
 | 
				
			||||||
              <CButton 
 | 
					            <CButton onClick={() => doAction(true)} disabled={waiting} block color="primary">
 | 
				
			||||||
                onClick={() => doAction(true)} 
 | 
					 | 
				
			||||||
                disabled={waiting} 
 | 
					 | 
				
			||||||
                block 
 | 
					 | 
				
			||||||
                color="primary"
 | 
					 | 
				
			||||||
              >
 | 
					 | 
				
			||||||
              {waiting && doingNow ? 'Loading...' : 'Do Now!'}
 | 
					              {waiting && doingNow ? 'Loading...' : 'Do Now!'}
 | 
				
			||||||
              <CSpinner hidden={!waiting || !doingNow} component="span" size="sm" />
 | 
					              <CSpinner hidden={!waiting || !doingNow} component="span" size="sm" />
 | 
				
			||||||
            </CButton>
 | 
					            </CButton>
 | 
				
			||||||
@@ -145,29 +140,48 @@ const BlinkModalWidget = ({show, toggleModal}) => {
 | 
				
			|||||||
          </CCol>
 | 
					          </CCol>
 | 
				
			||||||
        </CRow>
 | 
					        </CRow>
 | 
				
			||||||
        <CRow style={{ marginTop: '20px' }}>
 | 
					        <CRow style={{ marginTop: '20px' }}>
 | 
				
			||||||
            <CCol md="7">
 | 
					          <CCol md="7">Choose a pattern you would like to use:</CCol>
 | 
				
			||||||
                Choose a pattern you would like to use:
 | 
					 | 
				
			||||||
            </CCol>
 | 
					 | 
				
			||||||
          <CCol>
 | 
					          <CCol>
 | 
				
			||||||
            <CForm>
 | 
					            <CForm>
 | 
				
			||||||
              <CFormGroup variant="checkbox" onClick={() => setPattern('on')}>
 | 
					              <CFormGroup variant="checkbox" onClick={() => setPattern('on')}>
 | 
				
			||||||
                        <CInputRadio defaultChecked={chosenPattern === 'on'} id="radio1" name="radios" value="option1" />
 | 
					                <CInputRadio
 | 
				
			||||||
                        <CLabel variant="checkbox" htmlFor="radio1">On</CLabel>
 | 
					                  defaultChecked={chosenPattern === 'on'}
 | 
				
			||||||
 | 
					                  id="radio1"
 | 
				
			||||||
 | 
					                  name="radios"
 | 
				
			||||||
 | 
					                  value="option1"
 | 
				
			||||||
 | 
					                />
 | 
				
			||||||
 | 
					                <CLabel variant="checkbox" htmlFor="radio1">
 | 
				
			||||||
 | 
					                  On
 | 
				
			||||||
 | 
					                </CLabel>
 | 
				
			||||||
              </CFormGroup>
 | 
					              </CFormGroup>
 | 
				
			||||||
              <CFormGroup variant="checkbox" onClick={() => setPattern('off')}>
 | 
					              <CFormGroup variant="checkbox" onClick={() => setPattern('off')}>
 | 
				
			||||||
                        <CInputRadio defaultChecked={chosenPattern === 'off'} id="radio2" name="radios" value="option2" />
 | 
					                <CInputRadio
 | 
				
			||||||
                        <CLabel variant="checkbox" htmlFor="radio2">Off</CLabel>
 | 
					                  defaultChecked={chosenPattern === 'off'}
 | 
				
			||||||
 | 
					                  id="radio2"
 | 
				
			||||||
 | 
					                  name="radios"
 | 
				
			||||||
 | 
					                  value="option2"
 | 
				
			||||||
 | 
					                />
 | 
				
			||||||
 | 
					                <CLabel variant="checkbox" htmlFor="radio2">
 | 
				
			||||||
 | 
					                  Off
 | 
				
			||||||
 | 
					                </CLabel>
 | 
				
			||||||
              </CFormGroup>
 | 
					              </CFormGroup>
 | 
				
			||||||
              <CFormGroup variant="checkbox" onClick={() => setPattern('blink')}>
 | 
					              <CFormGroup variant="checkbox" onClick={() => setPattern('blink')}>
 | 
				
			||||||
                        <CInputRadio defaultChecked={chosenPattern === 'blink'} id="radio2" name="radios" value="option2" />
 | 
					                <CInputRadio
 | 
				
			||||||
                        <CLabel variant="checkbox" htmlFor="radio2">Blink</CLabel>
 | 
					                  defaultChecked={chosenPattern === 'blink'}
 | 
				
			||||||
 | 
					                  id="radio2"
 | 
				
			||||||
 | 
					                  name="radios"
 | 
				
			||||||
 | 
					                  value="option2"
 | 
				
			||||||
 | 
					                />
 | 
				
			||||||
 | 
					                <CLabel variant="checkbox" htmlFor="radio2">
 | 
				
			||||||
 | 
					                  Blink
 | 
				
			||||||
 | 
					                </CLabel>
 | 
				
			||||||
              </CFormGroup>
 | 
					              </CFormGroup>
 | 
				
			||||||
            </CForm>
 | 
					            </CForm>
 | 
				
			||||||
          </CCol>
 | 
					          </CCol>
 | 
				
			||||||
        </CRow>
 | 
					        </CRow>
 | 
				
			||||||
        <div hidden={!hadSuccess && !hadFailure}>
 | 
					        <div hidden={!hadSuccess && !hadFailure}>
 | 
				
			||||||
          <div>
 | 
					          <div>
 | 
				
			||||||
              <pre className='ignore'>{responseBody}</pre>
 | 
					            <pre className="ignore">{responseBody}</pre>
 | 
				
			||||||
          </div>
 | 
					          </div>
 | 
				
			||||||
        </div>
 | 
					        </div>
 | 
				
			||||||
      </CModalBody>
 | 
					      </CModalBody>
 | 
				
			||||||
@@ -196,6 +210,6 @@ const BlinkModalWidget = ({show, toggleModal}) => {
 | 
				
			|||||||
      </CModalFooter>
 | 
					      </CModalFooter>
 | 
				
			||||||
    </CModal>
 | 
					    </CModal>
 | 
				
			||||||
  );
 | 
					  );
 | 
				
			||||||
}
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export default BlinkModalWidget;
 | 
					export default BlinkModalWidget;
 | 
				
			||||||
@@ -40,11 +40,11 @@ const DeviceCommands = ({selectedDeviceId}) => {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  const modifyStart = (value) => {
 | 
					  const modifyStart = (value) => {
 | 
				
			||||||
    setStart(value);
 | 
					    setStart(value);
 | 
				
			||||||
  }
 | 
					  };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  const modifyEnd = (value) => {
 | 
					  const modifyEnd = (value) => {
 | 
				
			||||||
    setEnd(value);
 | 
					    setEnd(value);
 | 
				
			||||||
  }
 | 
					  };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  const getCommands = () => {
 | 
					  const getCommands = () => {
 | 
				
			||||||
    setLoading(true);
 | 
					    setLoading(true);
 | 
				
			||||||
@@ -67,8 +67,7 @@ const DeviceCommands = ({selectedDeviceId}) => {
 | 
				
			|||||||
      .then((response) => {
 | 
					      .then((response) => {
 | 
				
			||||||
        setCommands(response.data.commands);
 | 
					        setCommands(response.data.commands);
 | 
				
			||||||
      })
 | 
					      })
 | 
				
			||||||
      .catch(() => {
 | 
					      .catch(() => {})
 | 
				
			||||||
      })
 | 
					 | 
				
			||||||
      .finally(() => {
 | 
					      .finally(() => {
 | 
				
			||||||
        setLoading(false);
 | 
					        setLoading(false);
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
@@ -85,8 +84,7 @@ const DeviceCommands = ({selectedDeviceId}) => {
 | 
				
			|||||||
        newDetails = [...details, index];
 | 
					        newDetails = [...details, index];
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
      setDetails(newDetails);
 | 
					      setDetails(newDetails);
 | 
				
			||||||
    }
 | 
					    } else {
 | 
				
			||||||
    else{
 | 
					 | 
				
			||||||
      setChosenWifiScan(item.results.status.scan.scan);
 | 
					      setChosenWifiScan(item.results.status.scan.scan);
 | 
				
			||||||
      setScanDate(item.completed);
 | 
					      setScanDate(item.completed);
 | 
				
			||||||
      console.log(scanDate);
 | 
					      console.log(scanDate);
 | 
				
			||||||
@@ -96,20 +94,16 @@ const DeviceCommands = ({selectedDeviceId}) => {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  const refreshCommands = () => {
 | 
					  const refreshCommands = () => {
 | 
				
			||||||
    setEnd(new Date());
 | 
					    setEnd(new Date());
 | 
				
			||||||
  }
 | 
					  };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  const getDetails = (command, commandDetails) => {
 | 
					  const getDetails = (command, commandDetails) => {
 | 
				
			||||||
    if (command === 'reboot' || command === 'leds') {
 | 
					    if (command === 'reboot' || command === 'leds') {
 | 
				
			||||||
      const result = commandDetails.results;
 | 
					      const result = commandDetails.results;
 | 
				
			||||||
      if(result)
 | 
					      if (result) return <pre className="ignore">{JSON.stringify(result, null, 4)}</pre>;
 | 
				
			||||||
        return (
 | 
					 | 
				
			||||||
          <pre className='ignore'>{JSON.stringify(result, null, 4)}</pre>
 | 
					 | 
				
			||||||
        );
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return <pre className='ignore'>{JSON.stringify(commandDetails, null, 4)}</pre>
 | 
					    return <pre className="ignore">{JSON.stringify(commandDetails, null, 4)}</pre>;
 | 
				
			||||||
    
 | 
					  };
 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
  const columns = [
 | 
					  const columns = [
 | 
				
			||||||
    { key: 'UUID', label: 'Id' },
 | 
					    { key: 'UUID', label: 'Id' },
 | 
				
			||||||
    { key: 'command' },
 | 
					    { key: 'command' },
 | 
				
			||||||
@@ -139,7 +133,7 @@ const DeviceCommands = ({selectedDeviceId}) => {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  return (
 | 
					  return (
 | 
				
			||||||
    <CWidgetDropdown
 | 
					    <CWidgetDropdown
 | 
				
			||||||
      inverse='true'
 | 
					      inverse="true"
 | 
				
			||||||
      color="gradient-primary"
 | 
					      color="gradient-primary"
 | 
				
			||||||
      header="Device Commands"
 | 
					      header="Device Commands"
 | 
				
			||||||
      footerSlot={
 | 
					      footerSlot={
 | 
				
			||||||
@@ -190,12 +184,18 @@ const DeviceCommands = ({selectedDeviceId}) => {
 | 
				
			|||||||
                  border
 | 
					                  border
 | 
				
			||||||
                  sorterValue={{ column: 'completed', desc: 'true' }}
 | 
					                  sorterValue={{ column: 'completed', desc: 'true' }}
 | 
				
			||||||
                  scopedSlots={{
 | 
					                  scopedSlots={{
 | 
				
			||||||
                    completed: (item) => <td>{(item.completed && item.completed !== "") ? prettyDate(item.completed) : 'Pending'}</td>,
 | 
					                    completed: (item) => (
 | 
				
			||||||
 | 
					                      <td>
 | 
				
			||||||
 | 
					                        {item.completed && item.completed !== ''
 | 
				
			||||||
 | 
					                          ? prettyDate(item.completed)
 | 
				
			||||||
 | 
					                          : 'Pending'}
 | 
				
			||||||
 | 
					                      </td>
 | 
				
			||||||
 | 
					                    ),
 | 
				
			||||||
                    show_details: (item, index) => (
 | 
					                    show_details: (item, index) => (
 | 
				
			||||||
                      <td className="py-2">
 | 
					                      <td className="py-2">
 | 
				
			||||||
                        <CButton
 | 
					                        <CButton
 | 
				
			||||||
                          color="primary"
 | 
					                          color="primary"
 | 
				
			||||||
                          variant={details.includes(index) ? "" : "outline"}
 | 
					                          variant={details.includes(index) ? '' : 'outline'}
 | 
				
			||||||
                          shape="square"
 | 
					                          shape="square"
 | 
				
			||||||
                          size="sm"
 | 
					                          size="sm"
 | 
				
			||||||
                          onClick={() => {
 | 
					                          onClick={() => {
 | 
				
			||||||
@@ -210,9 +210,7 @@ const DeviceCommands = ({selectedDeviceId}) => {
 | 
				
			|||||||
                      <CCollapse show={details.includes(index)}>
 | 
					                      <CCollapse show={details.includes(index)}>
 | 
				
			||||||
                        <CCardBody>
 | 
					                        <CCardBody>
 | 
				
			||||||
                          <h5>Details</h5>
 | 
					                          <h5>Details</h5>
 | 
				
			||||||
                          <div>
 | 
					                          <div>{getDetails(item.command, item)}</div>
 | 
				
			||||||
                            {getDetails(item.command, item)}
 | 
					 | 
				
			||||||
                          </div>
 | 
					 | 
				
			||||||
                        </CCardBody>
 | 
					                        </CCardBody>
 | 
				
			||||||
                      </CCollapse>
 | 
					                      </CCollapse>
 | 
				
			||||||
                    ),
 | 
					                    ),
 | 
				
			||||||
@@ -231,7 +229,12 @@ const DeviceCommands = ({selectedDeviceId}) => {
 | 
				
			|||||||
        </div>
 | 
					        </div>
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    >
 | 
					    >
 | 
				
			||||||
    <WifiScanResultModalWidget show={showModal} toggle={toggleModal} scanResults={chosenWifiScan} date={scanDate}/>
 | 
					      <WifiScanResultModalWidget
 | 
				
			||||||
 | 
					        show={showModal}
 | 
				
			||||||
 | 
					        toggle={toggleModal}
 | 
				
			||||||
 | 
					        scanResults={chosenWifiScan}
 | 
				
			||||||
 | 
					        date={scanDate}
 | 
				
			||||||
 | 
					      />
 | 
				
			||||||
      <CIcon name="cilNotes" style={{ color: 'white' }} size="lg" />
 | 
					      <CIcon name="cilNotes" style={{ color: 'white' }} size="lg" />
 | 
				
			||||||
    </CWidgetDropdown>
 | 
					    </CWidgetDropdown>
 | 
				
			||||||
  );
 | 
					  );
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -39,13 +39,11 @@ const DeviceConfiguration = ({selectedDeviceId}) => {
 | 
				
			|||||||
      .then((response) => {
 | 
					      .then((response) => {
 | 
				
			||||||
        setDevice(response.data);
 | 
					        setDevice(response.data);
 | 
				
			||||||
      })
 | 
					      })
 | 
				
			||||||
      .catch(() => {
 | 
					      .catch(() => {});
 | 
				
			||||||
      });
 | 
					 | 
				
			||||||
  };
 | 
					  };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  useEffect(() => {
 | 
					  useEffect(() => {
 | 
				
			||||||
    if(selectedDeviceId)
 | 
					    if (selectedDeviceId) getDevice();
 | 
				
			||||||
      getDevice();
 | 
					 | 
				
			||||||
  }, [selectedDeviceId]);
 | 
					  }, [selectedDeviceId]);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (device) {
 | 
					  if (device) {
 | 
				
			||||||
@@ -145,7 +143,12 @@ const DeviceConfiguration = ({selectedDeviceId}) => {
 | 
				
			|||||||
              </CFormGroup>
 | 
					              </CFormGroup>
 | 
				
			||||||
            </CCollapse>
 | 
					            </CCollapse>
 | 
				
			||||||
            <CCardFooter>
 | 
					            <CCardFooter>
 | 
				
			||||||
              <CButton show={collapse ? 'true' : 'false'} color="transparent" onClick={toggle} block>
 | 
					              <CButton
 | 
				
			||||||
 | 
					                show={collapse ? 'true' : 'false'}
 | 
				
			||||||
 | 
					                color="transparent"
 | 
				
			||||||
 | 
					                onClick={toggle}
 | 
				
			||||||
 | 
					                block
 | 
				
			||||||
 | 
					              >
 | 
				
			||||||
                <CIcon name={collapse ? 'cilChevronTop' : 'cilChevronBottom'} size="lg" />
 | 
					                <CIcon name={collapse ? 'cilChevronTop' : 'cilChevronBottom'} size="lg" />
 | 
				
			||||||
              </CButton>
 | 
					              </CButton>
 | 
				
			||||||
            </CCardFooter>
 | 
					            </CCardFooter>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -9,7 +9,7 @@ import {
 | 
				
			|||||||
  CCardBody,
 | 
					  CCardBody,
 | 
				
			||||||
  CRow,
 | 
					  CRow,
 | 
				
			||||||
  CCol,
 | 
					  CCol,
 | 
				
			||||||
  CProgress
 | 
					  CProgress,
 | 
				
			||||||
} from '@coreui/react';
 | 
					} from '@coreui/react';
 | 
				
			||||||
import CIcon from '@coreui/icons-react';
 | 
					import CIcon from '@coreui/icons-react';
 | 
				
			||||||
import DatePicker from 'react-widgets/DatePicker';
 | 
					import DatePicker from 'react-widgets/DatePicker';
 | 
				
			||||||
@@ -34,11 +34,11 @@ const DeviceHealth = ({selectedDeviceId}) => {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  const modifyStart = (value) => {
 | 
					  const modifyStart = (value) => {
 | 
				
			||||||
    setStart(value);
 | 
					    setStart(value);
 | 
				
			||||||
  }
 | 
					  };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  const modifyEnd = (value) => {
 | 
					  const modifyEnd = (value) => {
 | 
				
			||||||
    setEnd(value);
 | 
					    setEnd(value);
 | 
				
			||||||
  }
 | 
					  };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  const getDeviceHealth = () => {
 | 
					  const getDeviceHealth = () => {
 | 
				
			||||||
    setLoading(true);
 | 
					    setLoading(true);
 | 
				
			||||||
@@ -61,8 +61,7 @@ const DeviceHealth = ({selectedDeviceId}) => {
 | 
				
			|||||||
      .then((response) => {
 | 
					      .then((response) => {
 | 
				
			||||||
        setHealthChecks(response.data.values);
 | 
					        setHealthChecks(response.data.values);
 | 
				
			||||||
      })
 | 
					      })
 | 
				
			||||||
      .catch(() => {
 | 
					      .catch(() => {})
 | 
				
			||||||
      })
 | 
					 | 
				
			||||||
      .finally(() => {
 | 
					      .finally(() => {
 | 
				
			||||||
        setLoading(false);
 | 
					        setLoading(false);
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
@@ -100,14 +99,12 @@ const DeviceHealth = ({selectedDeviceId}) => {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
  }, [selectedDeviceId, start, end]);
 | 
					  }, [selectedDeviceId, start, end]);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
  if (healthChecks && healthChecks.length > 0) {
 | 
					  if (healthChecks && healthChecks.length > 0) {
 | 
				
			||||||
    sanityLevel = healthChecks[healthChecks.length - 1].sanity;
 | 
					    sanityLevel = healthChecks[healthChecks.length - 1].sanity;
 | 
				
			||||||
    if (sanityLevel === 100) barColor = 'gradient-success';
 | 
					    if (sanityLevel === 100) barColor = 'gradient-success';
 | 
				
			||||||
    else if (sanityLevel >= 90) barColor = 'gradient-warning';
 | 
					    else if (sanityLevel >= 90) barColor = 'gradient-warning';
 | 
				
			||||||
    else barColor = 'gradient-danger';
 | 
					    else barColor = 'gradient-danger';
 | 
				
			||||||
  }
 | 
					  } else {
 | 
				
			||||||
  else{
 | 
					 | 
				
			||||||
    sanityLevel = 0;
 | 
					    sanityLevel = 0;
 | 
				
			||||||
    barColor = 'gradient-dark';
 | 
					    barColor = 'gradient-dark';
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
@@ -163,7 +160,7 @@ const DeviceHealth = ({selectedDeviceId}) => {
 | 
				
			|||||||
                        <td className="py-2">
 | 
					                        <td className="py-2">
 | 
				
			||||||
                          <CButton
 | 
					                          <CButton
 | 
				
			||||||
                            color="primary"
 | 
					                            color="primary"
 | 
				
			||||||
                            variant={details.includes(index) ? "" : "outline"}
 | 
					                            variant={details.includes(index) ? '' : 'outline'}
 | 
				
			||||||
                            shape="square"
 | 
					                            shape="square"
 | 
				
			||||||
                            size="sm"
 | 
					                            size="sm"
 | 
				
			||||||
                            onClick={() => {
 | 
					                            onClick={() => {
 | 
				
			||||||
@@ -180,7 +177,7 @@ const DeviceHealth = ({selectedDeviceId}) => {
 | 
				
			|||||||
                        <CCardBody>
 | 
					                        <CCardBody>
 | 
				
			||||||
                          <h5>Details</h5>
 | 
					                          <h5>Details</h5>
 | 
				
			||||||
                          <div>
 | 
					                          <div>
 | 
				
			||||||
                            <pre className='ignore'>{JSON.stringify(item.values, null, 4)}</pre>
 | 
					                            <pre className="ignore">{JSON.stringify(item.values, null, 4)}</pre>
 | 
				
			||||||
                          </div>
 | 
					                          </div>
 | 
				
			||||||
                        </CCardBody>
 | 
					                        </CCardBody>
 | 
				
			||||||
                      </CCollapse>
 | 
					                      </CCollapse>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -31,11 +31,11 @@ const DeviceLogs = ({selectedDeviceId}) => {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  const modifyStart = (value) => {
 | 
					  const modifyStart = (value) => {
 | 
				
			||||||
    setStart(value);
 | 
					    setStart(value);
 | 
				
			||||||
  }
 | 
					  };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  const modifyEnd = (value) => {
 | 
					  const modifyEnd = (value) => {
 | 
				
			||||||
    setEnd(value);
 | 
					    setEnd(value);
 | 
				
			||||||
  }
 | 
					  };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  const getLogs = () => {
 | 
					  const getLogs = () => {
 | 
				
			||||||
    setLoading(true);
 | 
					    setLoading(true);
 | 
				
			||||||
@@ -58,8 +58,7 @@ const DeviceLogs = ({selectedDeviceId}) => {
 | 
				
			|||||||
      .then((response) => {
 | 
					      .then((response) => {
 | 
				
			||||||
        setLogs(response.data.values);
 | 
					        setLogs(response.data.values);
 | 
				
			||||||
      })
 | 
					      })
 | 
				
			||||||
      .catch(() => {
 | 
					      .catch(() => {})
 | 
				
			||||||
      })
 | 
					 | 
				
			||||||
      .finally(() => {
 | 
					      .finally(() => {
 | 
				
			||||||
        setLoading(false);
 | 
					        setLoading(false);
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
@@ -98,7 +97,7 @@ const DeviceLogs = ({selectedDeviceId}) => {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  return (
 | 
					  return (
 | 
				
			||||||
    <CWidgetDropdown
 | 
					    <CWidgetDropdown
 | 
				
			||||||
      inverse='true'
 | 
					      inverse="true"
 | 
				
			||||||
      color="gradient-info"
 | 
					      color="gradient-info"
 | 
				
			||||||
      header="Device Logs"
 | 
					      header="Device Logs"
 | 
				
			||||||
      footerSlot={
 | 
					      footerSlot={
 | 
				
			||||||
@@ -139,7 +138,7 @@ const DeviceLogs = ({selectedDeviceId}) => {
 | 
				
			|||||||
                      <td className="py-2">
 | 
					                      <td className="py-2">
 | 
				
			||||||
                        <CButton
 | 
					                        <CButton
 | 
				
			||||||
                          color="primary"
 | 
					                          color="primary"
 | 
				
			||||||
                          variant={details.includes(index) ? "" : "outline"}
 | 
					                          variant={details.includes(index) ? '' : 'outline'}
 | 
				
			||||||
                          shape="square"
 | 
					                          shape="square"
 | 
				
			||||||
                          size="sm"
 | 
					                          size="sm"
 | 
				
			||||||
                          onClick={() => {
 | 
					                          onClick={() => {
 | 
				
			||||||
@@ -155,7 +154,7 @@ const DeviceLogs = ({selectedDeviceId}) => {
 | 
				
			|||||||
                        <CCardBody>
 | 
					                        <CCardBody>
 | 
				
			||||||
                          <h5>Details</h5>
 | 
					                          <h5>Details</h5>
 | 
				
			||||||
                          <div>
 | 
					                          <div>
 | 
				
			||||||
                            <pre className='ignore'>{JSON.stringify(item, null, 4)}</pre>
 | 
					                            <pre className="ignore">{JSON.stringify(item, null, 4)}</pre>
 | 
				
			||||||
                          </div>
 | 
					                          </div>
 | 
				
			||||||
                        </CCardBody>
 | 
					                        </CCardBody>
 | 
				
			||||||
                      </CCollapse>
 | 
					                      </CCollapse>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -14,8 +14,7 @@ const DevicePage = () => {
 | 
				
			|||||||
  const { deviceId } = useParams();
 | 
					  const { deviceId } = useParams();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  useEffect(() => {
 | 
					  useEffect(() => {
 | 
				
			||||||
    if(deviceId)
 | 
					    if (deviceId) dispatch({ type: 'set', selectedDeviceId: deviceId });
 | 
				
			||||||
      dispatch({ type: 'set', selectedDeviceId: deviceId });
 | 
					 | 
				
			||||||
  }, [deviceId]);
 | 
					  }, [deviceId]);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  return (
 | 
					  return (
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -69,7 +69,7 @@ const FirmwareUpgradeModal = ({ show, toggleModal }) => {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  const confirmingIfNow = () => {
 | 
					  const confirmingIfNow = () => {
 | 
				
			||||||
    setCheckingIfNow(true);
 | 
					    setCheckingIfNow(true);
 | 
				
			||||||
  }
 | 
					  };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  useEffect(() => {
 | 
					  useEffect(() => {
 | 
				
			||||||
    setHadSuccess(false);
 | 
					    setHadSuccess(false);
 | 
				
			||||||
@@ -139,7 +139,7 @@ const FirmwareUpgradeModal = ({ show, toggleModal }) => {
 | 
				
			|||||||
          <CCol>
 | 
					          <CCol>
 | 
				
			||||||
            <CButton
 | 
					            <CButton
 | 
				
			||||||
              color="primary"
 | 
					              color="primary"
 | 
				
			||||||
                onClick={() => formValidation() ? confirmingIfNow() : null} 
 | 
					              onClick={() => (formValidation() ? confirmingIfNow() : null)}
 | 
				
			||||||
              disabled={waiting}
 | 
					              disabled={waiting}
 | 
				
			||||||
              hidden={checkingIfNow}
 | 
					              hidden={checkingIfNow}
 | 
				
			||||||
              block
 | 
					              block
 | 
				
			||||||
@@ -148,7 +148,7 @@ const FirmwareUpgradeModal = ({ show, toggleModal }) => {
 | 
				
			|||||||
            </CButton>
 | 
					            </CButton>
 | 
				
			||||||
            <CButton
 | 
					            <CButton
 | 
				
			||||||
              color="primary"
 | 
					              color="primary"
 | 
				
			||||||
                onClick={() => formValidation() ? postUpgrade(true) : null}
 | 
					              onClick={() => (formValidation() ? postUpgrade(true) : null)}
 | 
				
			||||||
              disabled={waiting}
 | 
					              disabled={waiting}
 | 
				
			||||||
              hidden={!checkingIfNow}
 | 
					              hidden={!checkingIfNow}
 | 
				
			||||||
              block
 | 
					              block
 | 
				
			||||||
@@ -196,7 +196,7 @@ const FirmwareUpgradeModal = ({ show, toggleModal }) => {
 | 
				
			|||||||
        <CInvalidFeedback>You need a url...</CInvalidFeedback>
 | 
					        <CInvalidFeedback>You need a url...</CInvalidFeedback>
 | 
				
			||||||
        <div hidden={!hadSuccess && !hadFailure}>
 | 
					        <div hidden={!hadSuccess && !hadFailure}>
 | 
				
			||||||
          <div>
 | 
					          <div>
 | 
				
			||||||
            <pre className='ignore'>{responseBody}</pre>
 | 
					            <pre className="ignore">{responseBody}</pre>
 | 
				
			||||||
          </div>
 | 
					          </div>
 | 
				
			||||||
        </div>
 | 
					        </div>
 | 
				
			||||||
      </CModalBody>
 | 
					      </CModalBody>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -10,7 +10,7 @@ import {
 | 
				
			|||||||
  CCol,
 | 
					  CCol,
 | 
				
			||||||
  CRow,
 | 
					  CRow,
 | 
				
			||||||
  CInvalidFeedback,
 | 
					  CInvalidFeedback,
 | 
				
			||||||
  CSelect
 | 
					  CSelect,
 | 
				
			||||||
} from '@coreui/react';
 | 
					} from '@coreui/react';
 | 
				
			||||||
import React, { useState, useEffect } from 'react';
 | 
					import React, { useState, useEffect } from 'react';
 | 
				
			||||||
import DatePicker from 'react-widgets/DatePicker';
 | 
					import DatePicker from 'react-widgets/DatePicker';
 | 
				
			||||||
@@ -72,7 +72,7 @@ const TraceModalWidget = ({ show, toggleModal }) => {
 | 
				
			|||||||
    const parameters = {
 | 
					    const parameters = {
 | 
				
			||||||
      serialNumber: selectedDeviceId,
 | 
					      serialNumber: selectedDeviceId,
 | 
				
			||||||
      when: dateChosen <= now ? '' : utcDateString,
 | 
					      when: dateChosen <= now ? '' : utcDateString,
 | 
				
			||||||
      network: 'lan'
 | 
					      network: 'lan',
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (usingDuration) {
 | 
					    if (usingDuration) {
 | 
				
			||||||
@@ -140,17 +140,33 @@ const TraceModalWidget = ({ show, toggleModal }) => {
 | 
				
			|||||||
          <CCol xs="12" md="8">
 | 
					          <CCol xs="12" md="8">
 | 
				
			||||||
            {usingDuration ? (
 | 
					            {usingDuration ? (
 | 
				
			||||||
              <CSelect defaultValue="duration" disabled={waiting}>
 | 
					              <CSelect defaultValue="duration" disabled={waiting}>
 | 
				
			||||||
                <option value="20" onClick={() => setDuration(20)}>20s</option>
 | 
					                <option value="20" onClick={() => setDuration(20)}>
 | 
				
			||||||
                <option value="40" onClick={() => setDuration(40)}>40s</option>
 | 
					                  20s
 | 
				
			||||||
                <option value="60" onClick={() => setDuration(60)}>60s</option>
 | 
					                </option>
 | 
				
			||||||
                <option value="120" onClick={() => setDuration(120)}>120s</option>
 | 
					                <option value="40" onClick={() => setDuration(40)}>
 | 
				
			||||||
 | 
					                  40s
 | 
				
			||||||
 | 
					                </option>
 | 
				
			||||||
 | 
					                <option value="60" onClick={() => setDuration(60)}>
 | 
				
			||||||
 | 
					                  60s
 | 
				
			||||||
 | 
					                </option>
 | 
				
			||||||
 | 
					                <option value="120" onClick={() => setDuration(120)}>
 | 
				
			||||||
 | 
					                  120s
 | 
				
			||||||
 | 
					                </option>
 | 
				
			||||||
              </CSelect>
 | 
					              </CSelect>
 | 
				
			||||||
            ) : (
 | 
					            ) : (
 | 
				
			||||||
              <CSelect defaultValue={packets} disabled={waiting}>
 | 
					              <CSelect defaultValue={packets} disabled={waiting}>
 | 
				
			||||||
                <option value="100" onClick={() => setPackets(100)}>100</option>
 | 
					                <option value="100" onClick={() => setPackets(100)}>
 | 
				
			||||||
                <option value="250" onClick={() => setPackets(250)}>250</option>
 | 
					                  100
 | 
				
			||||||
                <option value="500" onClick={() => setPackets(500)}>500</option>
 | 
					                </option>
 | 
				
			||||||
                <option value="1000" onClick={() => setPackets(1000)}>1000</option>
 | 
					                <option value="250" onClick={() => setPackets(250)}>
 | 
				
			||||||
 | 
					                  250
 | 
				
			||||||
 | 
					                </option>
 | 
				
			||||||
 | 
					                <option value="500" onClick={() => setPackets(500)}>
 | 
				
			||||||
 | 
					                  500
 | 
				
			||||||
 | 
					                </option>
 | 
				
			||||||
 | 
					                <option value="1000" onClick={() => setPackets(1000)}>
 | 
				
			||||||
 | 
					                  1000
 | 
				
			||||||
 | 
					                </option>
 | 
				
			||||||
              </CSelect>
 | 
					              </CSelect>
 | 
				
			||||||
            )}
 | 
					            )}
 | 
				
			||||||
          </CCol>
 | 
					          </CCol>
 | 
				
			||||||
@@ -175,7 +191,7 @@ const TraceModalWidget = ({ show, toggleModal }) => {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        <div hidden={!hadSuccess && !hadFailure}>
 | 
					        <div hidden={!hadSuccess && !hadFailure}>
 | 
				
			||||||
          <div>
 | 
					          <div>
 | 
				
			||||||
            <pre className='ignore'>{responseBody} </pre>
 | 
					            <pre className="ignore">{responseBody} </pre>
 | 
				
			||||||
          </div>
 | 
					          </div>
 | 
				
			||||||
        </div>
 | 
					        </div>
 | 
				
			||||||
      </CModalBody>
 | 
					      </CModalBody>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,37 +1,22 @@
 | 
				
			|||||||
import {
 | 
					import { CCard, CCardTitle, CCardBody, CDataTable, CCardHeader } from '@coreui/react';
 | 
				
			||||||
    CCard,
 | 
					 | 
				
			||||||
    CCardTitle,
 | 
					 | 
				
			||||||
    CCardBody,
 | 
					 | 
				
			||||||
    CDataTable,
 | 
					 | 
				
			||||||
    CCardHeader
 | 
					 | 
				
			||||||
  } from '@coreui/react';
 | 
					 | 
				
			||||||
import React from 'react';
 | 
					import React from 'react';
 | 
				
			||||||
import 'react-widgets/styles.css';
 | 
					import 'react-widgets/styles.css';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const WifiChannelCard = ({ channel }) => {
 | 
					const WifiChannelCard = ({ channel }) => {
 | 
				
			||||||
    const columns = [
 | 
					  const columns = [{ key: 'SSID', _style: { width: '70%' } }, { key: 'Signal' }];
 | 
				
			||||||
        { key: 'SSID', _style: { width: '70%' }},
 | 
					 | 
				
			||||||
        { key: 'Signal' },
 | 
					 | 
				
			||||||
    ];
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
  return (
 | 
					  return (
 | 
				
			||||||
    <CCard>
 | 
					    <CCard>
 | 
				
			||||||
      <CCardHeader>
 | 
					      <CCardHeader>
 | 
				
			||||||
                <CCardTitle style={{color:'black'}}>
 | 
					        <CCardTitle style={{ color: 'black' }}>Channel #{channel.channel}</CCardTitle>
 | 
				
			||||||
                    Channel #{channel.channel}
 | 
					 | 
				
			||||||
                </CCardTitle>
 | 
					 | 
				
			||||||
      </CCardHeader>
 | 
					      </CCardHeader>
 | 
				
			||||||
      <CCardBody>
 | 
					      <CCardBody>
 | 
				
			||||||
        <div className="overflow-auto" style={{ height: '250px' }}>
 | 
					        <div className="overflow-auto" style={{ height: '250px' }}>
 | 
				
			||||||
                <CDataTable
 | 
					          <CDataTable items={channel.devices} fields={columns} style={{ color: 'white' }} />
 | 
				
			||||||
                    items={channel.devices}
 | 
					 | 
				
			||||||
                    fields={columns}
 | 
					 | 
				
			||||||
                    style={{ color: 'white' }}
 | 
					 | 
				
			||||||
                />
 | 
					 | 
				
			||||||
        </div>
 | 
					        </div>
 | 
				
			||||||
      </CCardBody>
 | 
					      </CCardBody>
 | 
				
			||||||
    </CCard>
 | 
					    </CCard>
 | 
				
			||||||
  );
 | 
					  );
 | 
				
			||||||
}
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export default WifiChannelCard;
 | 
					export default WifiChannelCard;
 | 
				
			||||||
@@ -1,41 +1,33 @@
 | 
				
			|||||||
import {
 | 
					import { CCol, CRow } from '@coreui/react';
 | 
				
			||||||
    CCol,
 | 
					 | 
				
			||||||
    CRow
 | 
					 | 
				
			||||||
  } from '@coreui/react';
 | 
					 | 
				
			||||||
import React, { useEffect } from 'react';
 | 
					import React, { useEffect } from 'react';
 | 
				
			||||||
import { v4 as createUuid } from 'uuid';
 | 
					import { v4 as createUuid } from 'uuid';
 | 
				
			||||||
import WifiChannelCard from './WifiChannelCard';
 | 
					import WifiChannelCard from './WifiChannelCard';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const WifiChannelTable = ({ channels }) => {
 | 
					const WifiChannelTable = ({ channels }) => {
 | 
				
			||||||
  const sortChannels = () => {
 | 
					  const sortChannels = () => {
 | 
				
			||||||
        channels.sort((a, b) => (a.channel > b.channel) ? 1 : -1);
 | 
					    channels.sort((a, b) => (a.channel > b.channel ? 1 : -1));
 | 
				
			||||||
  };
 | 
					  };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  useEffect(() => {
 | 
					  useEffect(() => {
 | 
				
			||||||
        if (channels)
 | 
					    if (channels) sortChannels();
 | 
				
			||||||
            sortChannels();
 | 
					 | 
				
			||||||
  }, [channels]);
 | 
					  }, [channels]);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  return (
 | 
					  return (
 | 
				
			||||||
    <CRow>
 | 
					    <CRow>
 | 
				
			||||||
      <CCol>
 | 
					      <CCol>
 | 
				
			||||||
                {
 | 
					        {channels.map((channel, index) => {
 | 
				
			||||||
                    channels.map((channel, index) => {
 | 
					 | 
				
			||||||
          if (index % 2 === 0) return <WifiChannelCard key={createUuid()} channel={channel} />;
 | 
					          if (index % 2 === 0) return <WifiChannelCard key={createUuid()} channel={channel} />;
 | 
				
			||||||
                        return <div key={createUuid()}/>
 | 
					          return <div key={createUuid()} />;
 | 
				
			||||||
                    })
 | 
					        })}
 | 
				
			||||||
                }
 | 
					 | 
				
			||||||
      </CCol>
 | 
					      </CCol>
 | 
				
			||||||
      <CCol>
 | 
					      <CCol>
 | 
				
			||||||
                {
 | 
					        {channels.map((channel, index) => {
 | 
				
			||||||
                    channels.map((channel, index) => {
 | 
					 | 
				
			||||||
          if (index % 2 === 1) return <WifiChannelCard key={createUuid()} channel={channel} />;
 | 
					          if (index % 2 === 1) return <WifiChannelCard key={createUuid()} channel={channel} />;
 | 
				
			||||||
                        return <div key={createUuid()}/>
 | 
					          return <div key={createUuid()} />;
 | 
				
			||||||
                    })
 | 
					        })}
 | 
				
			||||||
                }
 | 
					 | 
				
			||||||
      </CCol>
 | 
					      </CCol>
 | 
				
			||||||
    </CRow>
 | 
					    </CRow>
 | 
				
			||||||
  );
 | 
					  );
 | 
				
			||||||
}
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export default WifiChannelTable;
 | 
					export default WifiChannelTable;
 | 
				
			||||||
@@ -10,7 +10,7 @@ import {
 | 
				
			|||||||
  CFormGroup,
 | 
					  CFormGroup,
 | 
				
			||||||
  CInputRadio,
 | 
					  CInputRadio,
 | 
				
			||||||
  CLabel,
 | 
					  CLabel,
 | 
				
			||||||
    CForm
 | 
					  CForm,
 | 
				
			||||||
} from '@coreui/react';
 | 
					} from '@coreui/react';
 | 
				
			||||||
import React, { useState, useEffect } from 'react';
 | 
					import React, { useState, useEffect } from 'react';
 | 
				
			||||||
import { useSelector } from 'react-redux';
 | 
					import { useSelector } from 'react-redux';
 | 
				
			||||||
@@ -55,7 +55,7 @@ import {
 | 
				
			|||||||
    listOfChannels.forEach((channelNumber) => {
 | 
					    listOfChannels.forEach((channelNumber) => {
 | 
				
			||||||
      const channel = {
 | 
					      const channel = {
 | 
				
			||||||
        channel: channelNumber,
 | 
					        channel: channelNumber,
 | 
				
			||||||
                devices: []
 | 
					        devices: [],
 | 
				
			||||||
      };
 | 
					      };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      scanList.forEach((device) => {
 | 
					      scanList.forEach((device) => {
 | 
				
			||||||
@@ -70,7 +70,7 @@ import {
 | 
				
			|||||||
      finalList.push(channel);
 | 
					      finalList.push(channel);
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
    return finalList;
 | 
					    return finalList;
 | 
				
			||||||
    }
 | 
					  };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  const doAction = () => {
 | 
					  const doAction = () => {
 | 
				
			||||||
    setHadFailure(false);
 | 
					    setHadFailure(false);
 | 
				
			||||||
@@ -81,7 +81,7 @@ import {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    const parameters = {
 | 
					    const parameters = {
 | 
				
			||||||
      serialNumber: selectedDeviceId,
 | 
					      serialNumber: selectedDeviceId,
 | 
				
			||||||
        verbose: choseVerbose
 | 
					      verbose: choseVerbose,
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
    const headers = {
 | 
					    const headers = {
 | 
				
			||||||
      Accept: 'application/json',
 | 
					      Accept: 'application/json',
 | 
				
			||||||
@@ -96,11 +96,9 @@ import {
 | 
				
			|||||||
        if (scanList) {
 | 
					        if (scanList) {
 | 
				
			||||||
          setChannelList(parseThroughList(scanList));
 | 
					          setChannelList(parseThroughList(scanList));
 | 
				
			||||||
          setHadSuccess(true);
 | 
					          setHadSuccess(true);
 | 
				
			||||||
            }
 | 
					        } else {
 | 
				
			||||||
            else{
 | 
					 | 
				
			||||||
          setHadFailure(true);
 | 
					          setHadFailure(true);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
            
 | 
					 | 
				
			||||||
      })
 | 
					      })
 | 
				
			||||||
      .catch(() => {
 | 
					      .catch(() => {
 | 
				
			||||||
        setHadFailure(true);
 | 
					        setHadFailure(true);
 | 
				
			||||||
@@ -117,18 +115,30 @@ import {
 | 
				
			|||||||
        <CModalTitle>Wifi Scan</CModalTitle>
 | 
					        <CModalTitle>Wifi Scan</CModalTitle>
 | 
				
			||||||
      </CModalHeader>
 | 
					      </CModalHeader>
 | 
				
			||||||
      <CModalBody>
 | 
					      <CModalBody>
 | 
				
			||||||
          <h6>
 | 
					        <h6>Launch a wifi scan of this device, which should take approximately 25 seconds.</h6>
 | 
				
			||||||
            Launch a wifi scan of this device, which should take approximately 25 seconds.
 | 
					 | 
				
			||||||
          </h6>
 | 
					 | 
				
			||||||
        <CRow style={{ marginTop: '20px' }}>
 | 
					        <CRow style={{ marginTop: '20px' }}>
 | 
				
			||||||
          <CForm style={{ paddingLeft: '5%' }}>
 | 
					          <CForm style={{ paddingLeft: '5%' }}>
 | 
				
			||||||
            <CFormGroup variant="checkbox" onClick={() => setVerbose(true)}>
 | 
					            <CFormGroup variant="checkbox" onClick={() => setVerbose(true)}>
 | 
				
			||||||
                    <CInputRadio defaultChecked={choseVerbose} id="radio1" name="radios" value="option1" />
 | 
					              <CInputRadio
 | 
				
			||||||
                    <CLabel variant="checkbox" htmlFor="radio1">With verbose</CLabel>
 | 
					                defaultChecked={choseVerbose}
 | 
				
			||||||
 | 
					                id="radio1"
 | 
				
			||||||
 | 
					                name="radios"
 | 
				
			||||||
 | 
					                value="option1"
 | 
				
			||||||
 | 
					              />
 | 
				
			||||||
 | 
					              <CLabel variant="checkbox" htmlFor="radio1">
 | 
				
			||||||
 | 
					                With verbose
 | 
				
			||||||
 | 
					              </CLabel>
 | 
				
			||||||
            </CFormGroup>
 | 
					            </CFormGroup>
 | 
				
			||||||
            <CFormGroup variant="checkbox" onClick={() => setVerbose(false)}>
 | 
					            <CFormGroup variant="checkbox" onClick={() => setVerbose(false)}>
 | 
				
			||||||
                    <CInputRadio defaultChecked={!choseVerbose} id="radio2" name="radios" value="option2" />
 | 
					              <CInputRadio
 | 
				
			||||||
                    <CLabel variant="checkbox" htmlFor="radio2">Without verbose</CLabel>
 | 
					                defaultChecked={!choseVerbose}
 | 
				
			||||||
 | 
					                id="radio2"
 | 
				
			||||||
 | 
					                name="radios"
 | 
				
			||||||
 | 
					                value="option2"
 | 
				
			||||||
 | 
					              />
 | 
				
			||||||
 | 
					              <CLabel variant="checkbox" htmlFor="radio2">
 | 
				
			||||||
 | 
					                Without verbose
 | 
				
			||||||
 | 
					              </CLabel>
 | 
				
			||||||
            </CFormGroup>
 | 
					            </CFormGroup>
 | 
				
			||||||
          </CForm>
 | 
					          </CForm>
 | 
				
			||||||
        </CRow>
 | 
					        </CRow>
 | 
				
			||||||
@@ -139,7 +149,7 @@ import {
 | 
				
			|||||||
      <CModalFooter>
 | 
					      <CModalFooter>
 | 
				
			||||||
        <div hidden={!checkingIfSure}>Are you sure?</div>
 | 
					        <div hidden={!checkingIfSure}>Are you sure?</div>
 | 
				
			||||||
        <CButton hidden={checkingIfSure} color="primary" onClick={() => confirmingIfSure()}>
 | 
					        <CButton hidden={checkingIfSure} color="primary" onClick={() => confirmingIfSure()}>
 | 
				
			||||||
            {(hadSuccess || hadFailure) ? 'Re-Scan' : 'Scan'}
 | 
					          {hadSuccess || hadFailure ? 'Re-Scan' : 'Scan'}
 | 
				
			||||||
        </CButton>
 | 
					        </CButton>
 | 
				
			||||||
        <CButton
 | 
					        <CButton
 | 
				
			||||||
          hidden={!checkingIfSure}
 | 
					          hidden={!checkingIfSure}
 | 
				
			||||||
@@ -159,4 +169,3 @@ import {
 | 
				
			|||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export default WifiScanModalWidget;
 | 
					export default WifiScanModalWidget;
 | 
				
			||||||
  
 | 
					 | 
				
			||||||
@@ -6,7 +6,7 @@ import {
 | 
				
			|||||||
  CModalHeader,
 | 
					  CModalHeader,
 | 
				
			||||||
  CModalBody,
 | 
					  CModalBody,
 | 
				
			||||||
  CModalTitle,
 | 
					  CModalTitle,
 | 
				
			||||||
  CModalFooter
 | 
					  CModalFooter,
 | 
				
			||||||
} from '@coreui/react';
 | 
					} from '@coreui/react';
 | 
				
			||||||
import WifiChannelTable from './WifiChannelTable';
 | 
					import WifiChannelTable from './WifiChannelTable';
 | 
				
			||||||
import { prettyDate } from '../../utils/helper';
 | 
					import { prettyDate } from '../../utils/helper';
 | 
				
			||||||
@@ -26,7 +26,7 @@ const WifiScanResultModalWidget = ({show, toggle, scanResults, date}) => {
 | 
				
			|||||||
    listOfChannels.forEach((channelNumber) => {
 | 
					    listOfChannels.forEach((channelNumber) => {
 | 
				
			||||||
      const channel = {
 | 
					      const channel = {
 | 
				
			||||||
        channel: channelNumber,
 | 
					        channel: channelNumber,
 | 
				
			||||||
                devices: []
 | 
					        devices: [],
 | 
				
			||||||
      };
 | 
					      };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      scanList.forEach((device) => {
 | 
					      scanList.forEach((device) => {
 | 
				
			||||||
@@ -41,14 +41,18 @@ const WifiScanResultModalWidget = ({show, toggle, scanResults, date}) => {
 | 
				
			|||||||
      finalList.push(channel);
 | 
					      finalList.push(channel);
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
    return finalList;
 | 
					    return finalList;
 | 
				
			||||||
    }
 | 
					  };
 | 
				
			||||||
  return (
 | 
					  return (
 | 
				
			||||||
    <CModal size="lg" show={show} onClose={toggle}>
 | 
					    <CModal size="lg" show={show} onClose={toggle}>
 | 
				
			||||||
      <CModalHeader closeButton>
 | 
					      <CModalHeader closeButton>
 | 
				
			||||||
            <CModalTitle style={{color: 'black'}}>{date !== '' ? prettyDate(date) : ''} Wifi Scan Results</CModalTitle>
 | 
					        <CModalTitle style={{ color: 'black' }}>
 | 
				
			||||||
 | 
					          {date !== '' ? prettyDate(date) : ''} Wifi Scan Results
 | 
				
			||||||
 | 
					        </CModalTitle>
 | 
				
			||||||
      </CModalHeader>
 | 
					      </CModalHeader>
 | 
				
			||||||
      <CModalBody>
 | 
					      <CModalBody>
 | 
				
			||||||
              {scanResults === null ? null : <WifiChannelTable channels={parseThroughList(scanResults)}/>}
 | 
					        {scanResults === null ? null : (
 | 
				
			||||||
 | 
					          <WifiChannelTable channels={parseThroughList(scanResults)} />
 | 
				
			||||||
 | 
					        )}
 | 
				
			||||||
      </CModalBody>
 | 
					      </CModalBody>
 | 
				
			||||||
      <CModalFooter>
 | 
					      <CModalFooter>
 | 
				
			||||||
        <CButton color="secondary" onClick={toggle}>
 | 
					        <CButton color="secondary" onClick={toggle}>
 | 
				
			||||||
@@ -57,5 +61,5 @@ const WifiScanResultModalWidget = ({show, toggle, scanResults, date}) => {
 | 
				
			|||||||
      </CModalFooter>
 | 
					      </CModalFooter>
 | 
				
			||||||
    </CModal>
 | 
					    </CModal>
 | 
				
			||||||
  );
 | 
					  );
 | 
				
			||||||
}
 | 
					};
 | 
				
			||||||
export default WifiScanResultModalWidget;
 | 
					export default WifiScanResultModalWidget;
 | 
				
			||||||
@@ -20,7 +20,7 @@ import CIcon from '@coreui/icons-react';
 | 
				
			|||||||
import { cilUser, cilLockLocked, cilLink } from '@coreui/icons';
 | 
					import { cilUser, cilLockLocked, cilLink } from '@coreui/icons';
 | 
				
			||||||
import { useDispatch } from 'react-redux';
 | 
					import { useDispatch } from 'react-redux';
 | 
				
			||||||
import axiosInstance from '../../utils/axiosInstance';
 | 
					import axiosInstance from '../../utils/axiosInstance';
 | 
				
			||||||
import logo from '../../assets/OpenWiFi_LogoLockup_DarkGreyColour.svg'
 | 
					import logo from '../../assets/OpenWiFi_LogoLockup_DarkGreyColour.svg';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const Login = () => {
 | 
					const Login = () => {
 | 
				
			||||||
  const dispatch = useDispatch();
 | 
					  const dispatch = useDispatch();
 | 
				
			||||||
@@ -92,7 +92,12 @@ const Login = () => {
 | 
				
			|||||||
      <CContainer>
 | 
					      <CContainer>
 | 
				
			||||||
        <CRow className="justify-content-center">
 | 
					        <CRow className="justify-content-center">
 | 
				
			||||||
          <CCol md="8">
 | 
					          <CCol md="8">
 | 
				
			||||||
            <img  className="c-sidebar-brand-full" src={logo} style={{ paddingLeft: '17%', width: '85%'}} alt="OpenWifi" />
 | 
					            <img
 | 
				
			||||||
 | 
					              className="c-sidebar-brand-full"
 | 
				
			||||||
 | 
					              src={logo}
 | 
				
			||||||
 | 
					              style={{ paddingLeft: '17%', width: '85%' }}
 | 
				
			||||||
 | 
					              alt="OpenWifi"
 | 
				
			||||||
 | 
					            />
 | 
				
			||||||
            <CCardGroup>
 | 
					            <CCardGroup>
 | 
				
			||||||
              <CCard className="p-4">
 | 
					              <CCard className="p-4">
 | 
				
			||||||
                <CCardBody>
 | 
					                <CCardBody>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -3,7 +3,7 @@ import { createStore } from 'redux';
 | 
				
			|||||||
const initialState = {
 | 
					const initialState = {
 | 
				
			||||||
  sidebarShow: 'responsive',
 | 
					  sidebarShow: 'responsive',
 | 
				
			||||||
  connected: false,
 | 
					  connected: false,
 | 
				
			||||||
  selectedDeviceId: null
 | 
					  selectedDeviceId: null,
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const changeState = (state = initialState, { type, ...rest }) => {
 | 
					const changeState = (state = initialState, { type, ...rest }) => {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -5,10 +5,7 @@ import https from 'https';
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
const httpAgent = new http.Agent({ keepAlive: true });
 | 
					const httpAgent = new http.Agent({ keepAlive: true });
 | 
				
			||||||
const httpsAgent = new https.Agent({ keepAlive: true });
 | 
					const httpsAgent = new https.Agent({ keepAlive: true });
 | 
				
			||||||
const axiosInstance = axios.create(
 | 
					const axiosInstance = axios.create(httpAgent, httpsAgent);
 | 
				
			||||||
  httpAgent,
 | 
					 | 
				
			||||||
  httpsAgent
 | 
					 | 
				
			||||||
);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
axiosRetry(axiosInstance, {
 | 
					axiosRetry(axiosInstance, {
 | 
				
			||||||
  retries: 3,
 | 
					  retries: 3,
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -41,10 +41,12 @@ const prettyNumber = (number) => {
 | 
				
			|||||||
    return number;
 | 
					    return number;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  return `0${number}`;
 | 
					  return `0${number}`;
 | 
				
			||||||
}
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export const prettyDate = (dateString) => {
 | 
					export const prettyDate = (dateString) => {
 | 
				
			||||||
  const date = new Date(dateString);
 | 
					  const date = new Date(dateString);
 | 
				
			||||||
  return `${date.getFullYear()}-${prettyNumber(date.getMonth() + 1)}-${prettyNumber(date.getDate())}
 | 
					  return `${date.getFullYear()}-${prettyNumber(date.getMonth() + 1)}-${prettyNumber(date.getDate())}
 | 
				
			||||||
  ${prettyNumber(date.getHours())}:${prettyNumber(date.getMinutes())}:${prettyNumber(date.getSeconds())}`;
 | 
					  ${prettyNumber(date.getHours())}:${prettyNumber(date.getMinutes())}:${prettyNumber(
 | 
				
			||||||
}
 | 
					    date.getSeconds(),
 | 
				
			||||||
 | 
					  )}`;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user