hotfix/WIFI-1017: Displayed plotting stats in AP Details OS Stats page

This commit is contained in:
chris-cosentino
2020-11-04 16:53:11 -05:00
parent bd5152bcf8
commit 648422d40e
2 changed files with 16 additions and 21 deletions

View File

@@ -18,33 +18,29 @@ const processMetrics = data => {
const cpuUtilCores = {}; const cpuUtilCores = {};
const freeMemory = []; const freeMemory = [];
const cpuTemperature = []; const cpuTemperature = [];
const timeStamp = [];
data.forEach(i => { data.forEach(i => {
if (i?.detailsJSON?.apPerformance) { if (i?.detailsJSON?.apPerformance) {
freeMemory.push(i.detailsJSON.apPerformance.freeMemory); const time = parseInt(i.createdTimestamp, []);
cpuTemperature.push(i.detailsJSON.apPerformance.cpuTemperature); freeMemory.push([time, i.detailsJSON.apPerformance.freeMemory]);
// eslint-disable-next-line radix cpuTemperature.push([time, i.detailsJSON.apPerformance.cpuTemperature]);
timeStamp.push(parseInt(i.createdTimestamp));
i.detailsJSON.apPerformance.cpuUtilized.forEach((j, index) => { i.detailsJSON.apPerformance.cpuUtilized.forEach((j, index) => {
if (!(index in cpuUtilCores)) { if (!(index in cpuUtilCores)) {
cpuUtilCores[index] = []; cpuUtilCores[index] = [];
} }
cpuUtilCores[index].push(j); cpuUtilCores[index].push([time, j]);
}); });
} }
}); });
return { cpuUtilCores, freeMemory, cpuTemperature, timeStamp }; return { cpuUtilCores, freeMemory, cpuTemperature };
}; };
const HighChartGraph = ({ osData }) => { const HighChartGraph = ({ osData }) => {
const dateTimeLabelFormats = { const dateTimeLabelFormats = {
millisecond: '%l:%M:%S%P', minute: '%l:%M%P',
second: '%l:%M:%S%P', hour: '%l:%M%P',
minute: '%l:%M:%S%P', day: '%a. %l:%M%P',
hour: '%l:%M:%S%P',
day: '%a. %l:%M:%S%P',
week: '', week: '',
month: '', month: '',
year: '', year: '',
@@ -61,21 +57,20 @@ const HighChartGraph = ({ osData }) => {
}, [osData]); }, [osData]);
return ( return (
<HighchartsStockChart data-testid="highchartsGraph"> <HighchartsStockChart
data-testid="highchartsGraph"
time={{
useUTC: false,
}}
>
<Chart zoomType="x" backgroundColor="#141414" /> <Chart zoomType="x" backgroundColor="#141414" />
<Tooltip split={false} shared useHTML /> <Tooltip split={false} shared useHTML xDateFormat="%b %e %Y %l:%M:%S%P" />
<XAxis <XAxis
tickPixelInterval={90} tickPixelInterval={90}
dateTimeLabelFormats={dateTimeLabelFormats} dateTimeLabelFormats={dateTimeLabelFormats}
offset={20} offset={20}
type="datetime" type="datetime"
categories={metrics.timeStamp}
labels={{
formatter: i => {
return new Date(i.value).toUTCString();
},
}}
> >
<XAxis.Title>Time</XAxis.Title> <XAxis.Title>Time</XAxis.Title>
</XAxis> </XAxis>

View File

@@ -56,7 +56,7 @@ const LineChart = ({ title, data, options }) => {
split={false} split={false}
shared shared
useHTML useHTML
xDateFormat="%b %e %Y %l:%M%P" xDateFormat="%b %e %Y %l:%M:%S%P"
pointFormatter={options.tooltipFormatter ? options.tooltipFormatter : null} pointFormatter={options.tooltipFormatter ? options.tooltipFormatter : null}
/> />
<Legend> <Legend>