Fixed trace if time is in the past, new color cert

This commit is contained in:
bourquecharles
2021-05-17 20:20:10 -04:00
parent 814d758f1d
commit 5809b57e75
2 changed files with 22 additions and 10 deletions

View File

@@ -13,7 +13,7 @@ import {
} from '@coreui/react'; } from '@coreui/react';
import ReactPaginate from 'react-paginate'; import ReactPaginate from 'react-paginate';
import Select from 'react-select'; import Select from 'react-select';
import { cilSync, cilInfo, cilBadge } from '@coreui/icons'; import { cilSync, cilInfo, cilBadge, cilBan } from '@coreui/icons';
import CIcon from '@coreui/icons-react'; import CIcon from '@coreui/icons-react';
import { getToken } from '../utils/authHelper'; import { getToken } from '../utils/authHelper';
import axiosInstance from '../utils/axiosInstance'; import axiosInstance from '../utils/axiosInstance';
@@ -120,7 +120,7 @@ const DeviceList = () => {
const DeviceListDisplay = ({ devices, loading, updateDevicesPerPage, pageCount, updatePage }) => { const DeviceListDisplay = ({ devices, loading, updateDevicesPerPage, pageCount, updatePage }) => {
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' }, { key: 'verifiedCertificate', label: 'Certificate', _style: { width: '1%' } },
{ key: 'serialNumber', _style: { width: '5%' } }, { key: 'serialNumber', _style: { width: '5%' } },
{ key: 'UUID', label: 'Config Id', _style: { width: '5%' } }, { key: 'UUID', label: 'Config Id', _style: { width: '5%' } },
{ key: 'firmware', filter: false, _style: { width: '20%' } }, { key: 'firmware', filter: false, _style: { width: '20%' } },
@@ -165,7 +165,12 @@ const DeviceListDisplay = ({ devices, loading, updateDevicesPerPage, pageCount,
const getCertBadge = (cert) => { const getCertBadge = (cert) => {
if(cert === 'NO_CERTIFICATE') { if(cert === 'NO_CERTIFICATE') {
return <p/>; return (
<div style={{position: 'relative'}}>
<CIcon 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>
);
} }
let color = 'transparent'; let color = 'transparent';
@@ -174,18 +179,19 @@ const DeviceListDisplay = ({ devices, loading, updateDevicesPerPage, pageCount,
color = 'danger' color = 'danger'
break; break;
case 'MISMATCH_SERIAL': case 'MISMATCH_SERIAL':
color = 'warning' color = '#fdfd96'
break; break;
case 'VERIFIED': case 'VERIFIED':
color = 'success'; color = 'success';
break; break;
default: default:
return( return(
<h6>Unknown</h6> <p>Unknown</p>
); );
} }
console.log(color);
return ( return (
<CBadge color={color}> <CBadge color={color} style={{backgroundColor: '#fdfd96'}}>
<CIcon name="cil-badge" content={cilBadge} size="2xl" alt="AP" /> <CIcon name="cil-badge" content={cilBadge} size="2xl" alt="AP" />
</CBadge> </CBadge>
); );

View File

@@ -76,14 +76,20 @@ const TraceModalWidget = ({ show, toggleModal }) => {
setWaiting(true); setWaiting(true);
const token = getToken(); const token = getToken();
const utcDate = new Date(chosenDate); const dateChosen = new Date(chosenDate);
const utcDateString = utcDate.toISOString(); const now = new Date();
let utcDateString = dateChosen.toISOString();
if(dateChosen <= now){
const newDate = new Date();
newDate.setSeconds(newDate.getSeconds() + 60);
utcDateString = newDate.toISOString();
}
const parameters = { const parameters = {
serialNumber: selectedDeviceId, serialNumber: selectedDeviceId,
when: utcDateString, when: utcDateString,
network: 'lan', network: 'lan'
interface: 'lan',
}; };
if (usingDuration) { if (usingDuration) {