Disabling download for failed traces

This commit is contained in:
bourquecharles
2021-06-05 12:05:05 -04:00
parent 0bda2b4b5e
commit 1778596fcf

View File

@@ -125,7 +125,7 @@ const DeviceCommands = ({ selectedDeviceId }) => {
const blob = new Blob([response.data], { type: 'application/octet-stream' }) const blob = new Blob([response.data], { type: 'application/octet-stream' })
const link = document.createElement('a') const link = document.createElement('a')
link.href = window.URL.createObjectURL(blob) link.href = window.URL.createObjectURL(blob)
link.download = 'Report.pdf' link.download = `Trace_${uuid}.pcap`;
link.click() link.click()
}); });
} }
@@ -159,7 +159,7 @@ const DeviceCommands = ({ selectedDeviceId }) => {
setScanDate(item.completed); setScanDate(item.completed);
setShowScanModal(true); setShowScanModal(true);
} }
else if (item.command === 'trace') { else if (item.command === 'trace' && item.waitingForFile === 0) {
downloadTrace(item.UUID); downloadTrace(item.UUID);
} }
else { else {
@@ -339,7 +339,7 @@ const DeviceCommands = ({ selectedDeviceId }) => {
<CButton <CButton
color="primary" color="primary"
variant={details.includes(index) ? '' : 'outline'} variant={details.includes(index) ? '' : 'outline'}
disabled={item.completed === 0} disabled={item.completed === 0 || (item.command === 'trace' && item.waitingForFile !== 0)}
shape="square" shape="square"
size="sm" size="sm"
onClick={() => { onClick={() => {
@@ -347,8 +347,8 @@ const DeviceCommands = ({ selectedDeviceId }) => {
}} }}
> >
{ {
item.command === 'trace' ? item.command === 'trace' ?
<CIcon content={cilCloudDownload}/> <CIcon content={cilCloudDownload} size="lg"/>
: :
<FontAwesomeIcon <FontAwesomeIcon
icon={faClipboardCheck} icon={faClipboardCheck}