From 5809b57e75805b2c8226bca2f2f02885d2697cb7 Mon Sep 17 00:00:00 2001 From: bourquecharles Date: Mon, 17 May 2021 20:20:10 -0400 Subject: [PATCH] Fixed trace if time is in the past, new color cert --- src/components/DeviceList.js | 18 ++++++++++++------ src/widgets/TraceModalWidget.js | 14 ++++++++++---- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/src/components/DeviceList.js b/src/components/DeviceList.js index 8b6bfe1..6ac1334 100644 --- a/src/components/DeviceList.js +++ b/src/components/DeviceList.js @@ -13,7 +13,7 @@ import { } from '@coreui/react'; import ReactPaginate from 'react-paginate'; 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 { getToken } from '../utils/authHelper'; import axiosInstance from '../utils/axiosInstance'; @@ -120,7 +120,7 @@ const DeviceList = () => { const DeviceListDisplay = ({ devices, loading, updateDevicesPerPage, pageCount, updatePage }) => { const columns = [ { 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: 'UUID', label: 'Config Id', _style: { width: '5%' } }, { key: 'firmware', filter: false, _style: { width: '20%' } }, @@ -165,7 +165,12 @@ const DeviceListDisplay = ({ devices, loading, updateDevicesPerPage, pageCount, const getCertBadge = (cert) => { if(cert === 'NO_CERTIFICATE') { - return

; + return ( +

+ + +
+ ); } let color = 'transparent'; @@ -174,18 +179,19 @@ const DeviceListDisplay = ({ devices, loading, updateDevicesPerPage, pageCount, color = 'danger' break; case 'MISMATCH_SERIAL': - color = 'warning' + color = '#fdfd96' break; case 'VERIFIED': color = 'success'; break; default: return( -
Unknown
+

Unknown

); } + console.log(color); return ( - + ); diff --git a/src/widgets/TraceModalWidget.js b/src/widgets/TraceModalWidget.js index 35a3360..41d264d 100644 --- a/src/widgets/TraceModalWidget.js +++ b/src/widgets/TraceModalWidget.js @@ -76,14 +76,20 @@ const TraceModalWidget = ({ show, toggleModal }) => { setWaiting(true); const token = getToken(); - const utcDate = new Date(chosenDate); - const utcDateString = utcDate.toISOString(); + const dateChosen = new Date(chosenDate); + 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 = { serialNumber: selectedDeviceId, when: utcDateString, - network: 'lan', - interface: 'lan', + network: 'lan' }; if (usingDuration) {