mirror of
https://github.com/optim-enterprises-bv/OptimCloud-gw-ui.git
synced 2025-10-29 17:32:20 +00:00
[WIFI-12375] Download command results fix
Signed-off-by: Charles <charles.bourque96@gmail.com>
This commit is contained in:
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "ucentral-client",
|
"name": "ucentral-client",
|
||||||
"version": "2.9.0(16)",
|
"version": "2.9.0(18)",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "ucentral-client",
|
"name": "ucentral-client",
|
||||||
"version": "2.9.0(16)",
|
"version": "2.9.0(18)",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@chakra-ui/icons": "^2.0.11",
|
"@chakra-ui/icons": "^2.0.11",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "ucentral-client",
|
"name": "ucentral-client",
|
||||||
"version": "2.9.0(16)",
|
"version": "2.9.0(18)",
|
||||||
"description": "",
|
"description": "",
|
||||||
"private": true,
|
"private": true,
|
||||||
"main": "index.tsx",
|
"main": "index.tsx",
|
||||||
|
|||||||
@@ -283,7 +283,11 @@ export const useDownloadScriptResult = ({ serialNumber, commandId }: { serialNum
|
|||||||
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 = `Script_${commandId}.tar.gz`;
|
const headerLine =
|
||||||
|
(response.headers['content-disposition'] as string | undefined) ??
|
||||||
|
(response.headers['content-disposition'] as string | undefined);
|
||||||
|
const filename = headerLine?.split('filename=')[1]?.split(',')[0] ?? `Script_${commandId}.tar.gz`;
|
||||||
|
link.download = filename;
|
||||||
link.click();
|
link.click();
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -92,7 +92,11 @@ export const useDownloadTrace = ({ serialNumber, commandId }: { serialNumber: st
|
|||||||
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 = `Trace_${commandId}.pcap`;
|
const headerLine =
|
||||||
|
(response.headers['content-disposition'] as string | undefined) ??
|
||||||
|
(response.headers['content-disposition'] as string | undefined);
|
||||||
|
const filename = headerLine?.split('filename=')[1]?.split(',')[0] ?? `Trace_${commandId}.pcap`;
|
||||||
|
link.download = filename;
|
||||||
link.click();
|
link.click();
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -9,10 +9,12 @@ import {
|
|||||||
Title,
|
Title,
|
||||||
Tooltip,
|
Tooltip,
|
||||||
Legend,
|
Legend,
|
||||||
|
Filler,
|
||||||
|
ChartData,
|
||||||
} from 'chart.js';
|
} from 'chart.js';
|
||||||
import { Line } from 'react-chartjs-2';
|
import { Line } from 'react-chartjs-2';
|
||||||
|
|
||||||
ChartJS.register(CategoryScale, LinearScale, PointElement, LineElement, Title, Tooltip, Legend);
|
ChartJS.register(CategoryScale, LinearScale, PointElement, LineElement, Title, Tooltip, Legend, Filler);
|
||||||
|
|
||||||
const getDivisionFactor = (maxBytes: number) => {
|
const getDivisionFactor = (maxBytes: number) => {
|
||||||
if (maxBytes < 1024) {
|
if (maxBytes < 1024) {
|
||||||
@@ -42,22 +44,28 @@ const InterfaceChart = ({ data }: Props) => {
|
|||||||
|
|
||||||
const { factor, unit } = getDivisionFactor(data.maxTx);
|
const { factor, unit } = getDivisionFactor(data.maxTx);
|
||||||
|
|
||||||
const points = {
|
const points: ChartData<'line', string[], string> = {
|
||||||
labels: data.recorded.map((recorded) => new Date(recorded * 1000).toLocaleTimeString()),
|
labels: data.recorded.map((recorded) => new Date(recorded * 1000).toLocaleTimeString()),
|
||||||
datasets: [
|
datasets: [
|
||||||
{
|
{
|
||||||
// Real 'Tx', but shown as 'Rx'
|
// Real 'Tx', but shown as 'Rx'
|
||||||
label: 'Tx',
|
label: 'Tx',
|
||||||
data: data.rx.map((tx) => (Math.floor((tx / factor) * 100) / 100).toFixed(2)),
|
data: data.rx.map((tx) => (Math.floor((tx / factor) * 100) / 100).toFixed(2)),
|
||||||
borderColor: colorMode === 'light' ? '#63B3ED' : '#BEE3F8', // blue-300 - blue-100
|
borderColor: colorMode === 'light' ? 'rgba(99, 179, 237, 1)' : 'rgba(190, 227, 248, 1)', // blue-300 - blue-100
|
||||||
backgroundColor: colorMode === 'light' ? '#63B3ED' : '#BEE3F8', // blue-300 - blue-100
|
backgroundColor: colorMode === 'light' ? 'rgba(99, 179, 237, 0.3)' : 'rgba(190, 227, 248, 0.3)', // blue-300 - blue-100
|
||||||
|
tension: 0.5,
|
||||||
|
pointRadius: 0,
|
||||||
|
fill: 'start',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// Real 'Rx', but shown as 'Tx'
|
// Real 'Rx', but shown as 'Tx'
|
||||||
label: 'Rx',
|
label: 'Rx',
|
||||||
data: data.tx.map((rx) => (Math.floor((rx / factor) * 100) / 100).toFixed(2)),
|
data: data.tx.map((rx) => (Math.floor((rx / factor) * 100) / 100).toFixed(2)),
|
||||||
borderColor: colorMode === 'light' ? '#48BB78' : '#9AE6B4', // green-400 - green-200
|
borderColor: colorMode === 'light' ? 'rgba(72, 187, 120, 1)' : 'rgba(154, 230, 180, 1)', // green-400 - green-200
|
||||||
backgroundColor: colorMode === 'light' ? '#48BB78' : '#9AE6B4', // green-400 - green-200
|
backgroundColor: colorMode === 'light' ? 'rgba(72, 187, 120, 0.3)' : 'rgba(154, 230, 180, 0.3)', // green-400 - green-200
|
||||||
|
tension: 0.5,
|
||||||
|
pointRadius: 0,
|
||||||
|
fill: 'start',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user