Fix tag apparition in Chart log panel + Fix attribute category panel bug

pull/174/head
nicolas pelletier 2023-04-26 20:33:02 +02:00
parent 480e339ced
commit a636f14ca1
3 changed files with 19 additions and 11 deletions

View File

@ -328,9 +328,13 @@ class EventMessage():
if self.name == 'Attribute': if self.name == 'Attribute':
self.feed = jsonMsg['log'] self.feed = jsonMsg['log']
self.feed = LogItem(self.feed, filters).get_row() self.feed = LogItem(self.feed, filters).get_row()
if (self.feed[2]):
self.feed[2]['data'] = json.dumps(self.feed[2]['data'])
elif self.name == 'ObjectAttribute': elif self.name == 'ObjectAttribute':
self.feed = jsonMsg['log'] self.feed = jsonMsg['log']
self.feed = LogItem(self.feed, filters).get_row() self.feed = LogItem(self.feed, filters).get_row()
if (self.feed[2]):
self.feed[2]['data'] = json.dumps(self.feed[2]['data'])
else: else:
self.feed = jsonMsg['log'] self.feed = jsonMsg['log']

View File

@ -174,7 +174,7 @@ $(document).ready(function () {
livelog = new $.livelog($("#divLogTable"), { livelog = new $.livelog($("#divLogTable"), {
pollingFrequency: 5000, pollingFrequency: 5000,
tableHeader: head, tableHeader: head,
tableMaxEntries: 50, tableMaxEntries: 300,
// animate: false, // animate: false,
preDataURL: urlForLogs, preDataURL: urlForLogs,
endpoint: urlForLogs endpoint: urlForLogs
@ -194,9 +194,9 @@ function updateLogTable(name, log, zmqName, ignoreLed) {
ledmanager.updateKeepAlive(zmqName); ledmanager.updateKeepAlive(zmqName);
} }
// only add row for attribute // add row for attribute and Object attribute
if (name == "Attribute" ) { if (name == "Attribute" || name == "ObjectAttribute") {
var categName = log[toPlotLocationLog]; var categName = log[3];
sources.addIfNotPresent(categName); sources.addIfNotPresent(categName);
sources.incCountOnSource(categName); sources.incCountOnSource(categName);
sources.incCountOnSource('global'); sources.incCountOnSource('global');
@ -209,6 +209,7 @@ function updateLogTable(name, log, zmqName, ignoreLed) {
} }
function slideAndMax(orig, newData) { function slideAndMax(orig, newData) {
var slided = []; var slided = [];
var max = newData; var max = newData;
@ -335,7 +336,8 @@ function createHead(callback) {
var $toRet; var $toRet;
if (typeof data === 'object') { if (typeof data === 'object') {
$toRet = $('<span></span>'); $toRet = $('<span></span>');
data.data.forEach(function(cur, i) { let tagList = JSON.parse(data.data);
tagList.forEach(function(cur, i) {
switch (data.name) { switch (data.name) {
case 'Tag': case 'Tag':
var $tag = $('<a></a>'); var $tag = $('<a></a>');
@ -841,7 +843,7 @@ $(document).ready(function() {
$panel.removeClass('liveLogFullScreen'); $panel.removeClass('liveLogFullScreen');
$this.data('isfullscreen', false); $this.data('isfullscreen', false);
$panel.find('#divLogTable').css({'overflow': 'hidden'}); $panel.find('#divLogTable').css({'overflow': 'hidden'});
livelog.changeOptions({tableMaxEntries: 50}); livelog.changeOptions({tableMaxEntries: 300});
} }
}); });

View File

@ -1,5 +1,5 @@
var updateIntervalDirect = 1000*2; // 2s var updateIntervalDirect = 1000*2; // 2s
var updateInterval = 1000*60*60*graph_log_refresh_rate; // 1h var updateInterval = 1000*60*60*graph_log_refresh_rate; // 1 hour
var maxNumPoint = hours_spanned+1; var maxNumPoint = hours_spanned+1;
var optionsLineChart = { var optionsLineChart = {
@ -8,7 +8,7 @@ var optionsLineChart = {
lines: { lines: {
fill: true, fill: true,
fillColor: { fillColor: {
colors: [ { opacity: 1 }, { opacity: 0.1 } ] colors: [ { opacity: 0.1 }, { opacity: 0.1 } ]
} }
} }
}, },
@ -17,14 +17,15 @@ var optionsLineChart = {
xaxis: { min: 0, max: maxNumPoint }, xaxis: { min: 0, max: maxNumPoint },
ticks: maxNumPoint+1, ticks: maxNumPoint+1,
points: { show: true }, points: { show: true },
lines: { show: true, fill: true }, lines: { show: true, fill: true, lineDashType: "dash"},
grid: { grid: {
tickColor: "#dddddd", tickColor: "#dddddd",
borderWidth: 0 borderWidth: 0
}, },
legend: { legend: {
show: true, show: true,
position: "nw" position: "nw",
dockInsidePlotArea: true
} }
}; };
@ -51,7 +52,8 @@ function updateChartDirect() {
plotLineChart.getOptions().yaxes[0].max = sources.getGlobalMax(); plotLineChart.getOptions().yaxes[0].max = sources.getGlobalMax();
plotLineChart.setupGrid(); plotLineChart.setupGrid();
plotLineChart.draw(); plotLineChart.draw();
//setTimeout(updateChartDirect, updateIntervalDirect); setTimeout(updateChartDirect, updateIntervalDirect);
} }
updateChartDirect() updateChartDirect()