mirror of
https://github.com/openmhz/trunk-server.git
synced 2026-11-13 17:27:37 -05:00
fixes
This commit is contained in:
@@ -13,7 +13,6 @@ exports.isLoggedIn = function (req, res, next) {
|
|||||||
// -------------------------------------------
|
// -------------------------------------------
|
||||||
|
|
||||||
exports.listSystems = async function (req, res, next) {
|
exports.listSystems = async function (req, res, next) {
|
||||||
console.log("Listing Systems for: " + req.user._id);
|
|
||||||
const userId = new mongoose.Types.ObjectId(req.user._id);
|
const userId = new mongoose.Types.ObjectId(req.user._id);
|
||||||
const systems = await System.find({ userId: userId }).exec();
|
const systems = await System.find({ userId: userId }).exec();
|
||||||
if (systems == null) {
|
if (systems == null) {
|
||||||
@@ -69,7 +68,6 @@ exports.listSystems = async function (req, res, next) {
|
|||||||
const stats = await SystemStat.find({ shortName: { $in: shortNames } }).exec();
|
const stats = await SystemStat.find({ shortName: { $in: shortNames } }).exec();
|
||||||
var sys_stats = {}
|
var sys_stats = {}
|
||||||
for (var i = 0; i < stats.length; i++) {
|
for (var i = 0; i < stats.length; i++) {
|
||||||
console.log(stats[i])
|
|
||||||
sys_stats[stats[i].shortName] = {
|
sys_stats[stats[i].shortName] = {
|
||||||
uploadErrors: stats[i].uploadErrors,
|
uploadErrors: stats[i].uploadErrors,
|
||||||
callTotals: stats[i].callTotals,
|
callTotals: stats[i].callTotals,
|
||||||
@@ -78,7 +76,6 @@ exports.listSystems = async function (req, res, next) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(sys_stats["test"]);
|
|
||||||
res.json({
|
res.json({
|
||||||
success: true,
|
success: true,
|
||||||
systems: returnSys,
|
systems: returnSys,
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ const CallChart = (props) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var callTotals = callData.callTotals;
|
var callTotals = callData.callTotals;
|
||||||
var errorTotals = callData.errorTotals;
|
var uploadErrors = callData.uploadErrors;
|
||||||
|
|
||||||
// Define the graph dimensions and margins
|
// Define the graph dimensions and margins
|
||||||
const width = props.width;
|
const width = props.width;
|
||||||
@@ -50,6 +50,7 @@ const CallChart = (props) => {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<svg width={width} height={height}>
|
<svg width={width} height={height}>
|
||||||
<Group left={margin.left} top={margin.top}>
|
<Group left={margin.left} top={margin.top}>
|
||||||
@@ -59,13 +60,18 @@ const CallChart = (props) => {
|
|||||||
data={callTotals}
|
data={callTotals}
|
||||||
x={x}
|
x={x}
|
||||||
y={y}
|
y={y}
|
||||||
|
xScale={xScale}
|
||||||
|
yScale={yScale}
|
||||||
strokeWidth={2}
|
strokeWidth={2}
|
||||||
|
stroke="#333"
|
||||||
curve={curveStep}
|
curve={curveStep}
|
||||||
/>
|
/>
|
||||||
<LinePath
|
<LinePath
|
||||||
data={errorTotals}
|
data={uploadErrors}
|
||||||
x={x}
|
x={x}
|
||||||
y={y}
|
y={y}
|
||||||
|
xScale={xScale}
|
||||||
|
yScale={yScale}
|
||||||
strokeWidth={2}
|
strokeWidth={2}
|
||||||
stroke="red"
|
stroke="red"
|
||||||
curve={curveStep}
|
curve={curveStep}
|
||||||
|
|||||||
@@ -5,11 +5,22 @@ import { scaleLinear, scaleTime, scaleOrdinal } from '@visx/scale';
|
|||||||
import { timeParse, timeFormat } from 'd3-time-format';
|
import { timeParse, timeFormat } from 'd3-time-format';
|
||||||
import { AxisBottom, AxisLeft } from '@visx/axis';
|
import { AxisBottom, AxisLeft } from '@visx/axis';
|
||||||
import { Loader } from "semantic-ui-react";
|
import { Loader } from "semantic-ui-react";
|
||||||
import { LegendOrdinal} from '@visx/legend';
|
import {
|
||||||
|
Legend,
|
||||||
|
LegendLinear,
|
||||||
|
LegendQuantile,
|
||||||
|
LegendOrdinal,
|
||||||
|
LegendSize,
|
||||||
|
LegendThreshold,
|
||||||
|
LegendItem,
|
||||||
|
LegendLabel,
|
||||||
|
} from '@visx/legend';
|
||||||
class ErrorChart extends Component {
|
class ErrorChart extends Component {
|
||||||
|
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
|
||||||
|
const legendGlyphSize = 15;
|
||||||
var errorData = this.props.data;
|
var errorData = this.props.data;
|
||||||
if (!errorData) {
|
if (!errorData) {
|
||||||
return (
|
return (
|
||||||
@@ -105,13 +116,35 @@ class ErrorChart extends Component {
|
|||||||
<LegendOrdinal
|
<LegendOrdinal
|
||||||
scale={zScale}
|
scale={zScale}
|
||||||
labelMargin="0 15px 0 0"
|
labelMargin="0 15px 0 0"
|
||||||
|
orientation="horizontal"
|
||||||
onMouseOver={data => event => {
|
onMouseOver={data => event => {
|
||||||
console.log(
|
console.log(
|
||||||
`mouse over: ${data.text}`,
|
`mouse over: ${data.text}`,
|
||||||
`index: ${data.index}`,
|
`index: ${data.index}`,
|
||||||
);
|
);
|
||||||
}}
|
}}
|
||||||
/>
|
>
|
||||||
|
{(labels) => (
|
||||||
|
<div style={{ display: 'flex', flexDirection: 'row' }}>
|
||||||
|
{labels.map((label, i) => (
|
||||||
|
<LegendItem
|
||||||
|
key={`legend-quantile-${i}`}
|
||||||
|
margin="0 5px"
|
||||||
|
|
||||||
|
>
|
||||||
|
<svg width={legendGlyphSize} height={legendGlyphSize}>
|
||||||
|
<rect fill={label.value} width={legendGlyphSize} height={legendGlyphSize} />
|
||||||
|
</svg>
|
||||||
|
<LegendLabel align="left" margin="0 0 0 4px">
|
||||||
|
{label.text}
|
||||||
|
</LegendLabel>
|
||||||
|
</LegendItem>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
|
|
||||||
|
</LegendOrdinal>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -39,11 +39,12 @@ const System = () => {
|
|||||||
const [groupVisible, setGroupVisible] = useState(false);
|
const [groupVisible, setGroupVisible] = useState(false);
|
||||||
const [editGroupId, setEditGroupId] = useState(false);
|
const [editGroupId, setEditGroupId] = useState(false);
|
||||||
const [errorData, setErrorData] = useState({});
|
const [errorData, setErrorData] = useState({});
|
||||||
const [callData, setCallData] = useState({});
|
const [callStatistics, setCallStatistics] = useState({});
|
||||||
const [groupOrder, setGroupOrder] = useState([]);
|
const [groupOrder, setGroupOrder] = useState([]);
|
||||||
|
|
||||||
|
|
||||||
const processErrors = (errors) => {
|
const processErrors = (statistics) => {
|
||||||
|
const errors = statistics.decodeErrorsFreq;
|
||||||
var allData = [];
|
var allData = [];
|
||||||
|
|
||||||
var num = 0;
|
var num = 0;
|
||||||
@@ -53,21 +54,25 @@ const System = () => {
|
|||||||
var minValue = 0;
|
var minValue = 0;
|
||||||
var maxValue = 0;
|
var maxValue = 0;
|
||||||
var legend = [];
|
var legend = [];
|
||||||
for (var j = 0; j < errors.length; j++) {
|
var MS_PER_MINUTE = 60000;
|
||||||
|
for (const freq in errors) {
|
||||||
|
const freqErrors = errors[freq];
|
||||||
var data = [];
|
var data = [];
|
||||||
for (var i = 0; i < errors[j].values.length; i++) {
|
for (var i = 0; i < freqErrors.errorHistory.length; i++) {
|
||||||
var time = new Date(errors[j].values[i].time);
|
let spotsBack = freqErrors.errorHistory.length - i;
|
||||||
if (errors[j].values[i].errors > maxValue)
|
let time = new Date(now - spotsBack * 15 * MS_PER_MINUTE);
|
||||||
maxValue = errors[j].values[i].errors;
|
|
||||||
if (time < minDate) minDate = time;
|
if (time < minDate) minDate = time;
|
||||||
|
|
||||||
|
if (freqErrors.errorHistory[i] > maxValue)
|
||||||
|
maxValue = freqErrors.errorHistory[i];
|
||||||
var value = {
|
var value = {
|
||||||
id: num++,
|
id: num++,
|
||||||
y: errors[j].values[i].errors,
|
y: freqErrors.errorHistory[i],
|
||||||
x: time
|
x: time
|
||||||
};
|
};
|
||||||
data.push(value);
|
data.push(value);
|
||||||
}
|
}
|
||||||
const id = Math.floor(errors[j]._id / 1000) / 1000 + "MHz";
|
const id = Math.floor(freq / 1000) / 1000 + "MHz";
|
||||||
legend.push(id);
|
legend.push(id);
|
||||||
var obj = {
|
var obj = {
|
||||||
id: id,
|
id: id,
|
||||||
@@ -116,16 +121,16 @@ const System = () => {
|
|||||||
maxValue = statistic.uploadErrors[j];
|
maxValue = statistic.uploadErrors[j];
|
||||||
uploadErrors.push({ x: time, y: statistic.uploadErrors[j] });
|
uploadErrors.push({ x: time, y: statistic.uploadErrors[j] });
|
||||||
}
|
}
|
||||||
const callData = {
|
const data = {
|
||||||
minDate: minDate,
|
minDate: minDate,
|
||||||
maxDate: maxDate,
|
maxDate: maxDate,
|
||||||
minValue: minValue,
|
minValue: minValue,
|
||||||
maxValue: maxValue,
|
maxValue: maxValue,
|
||||||
callTotals: callTotals,
|
callTotals: callTotals,
|
||||||
errorTotals: uploadErrors
|
uploadErrors: uploadErrors
|
||||||
};
|
};
|
||||||
|
|
||||||
setCallData(callData);
|
setCallStatistics(data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -235,6 +240,7 @@ const System = () => {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (isSystemsSuccess) {
|
if (isSystemsSuccess) {
|
||||||
processStatistics(systemsData.stats[shortName])
|
processStatistics(systemsData.stats[shortName])
|
||||||
|
processErrors(systemsData.stats[shortName])
|
||||||
}
|
}
|
||||||
}, [isSystemsSuccess]);
|
}, [isSystemsSuccess]);
|
||||||
/*
|
/*
|
||||||
@@ -492,7 +498,7 @@ const System = () => {
|
|||||||
<Icon name="microphone" />
|
<Icon name="microphone" />
|
||||||
24-Hour Call History
|
24-Hour Call History
|
||||||
</Divider>
|
</Divider>
|
||||||
<CallChart data={callData} />
|
<CallChart data={callStatistics} />
|
||||||
<Divider horizontal>
|
<Divider horizontal>
|
||||||
<Icon name="microphone" />
|
<Icon name="microphone" />
|
||||||
Hourly Vocoder Error Percentage
|
Hourly Vocoder Error Percentage
|
||||||
|
|||||||
Reference in New Issue
Block a user