Added support of TAG albel in live dashboard

pull/18/head
Sami Mokaddem 2017-10-30 10:44:12 +01:00
parent 1833ea821c
commit 9f942ded9c
2 changed files with 30 additions and 1 deletions

View File

@ -267,9 +267,27 @@ function slideAndMax(orig, newData) {
return [curMaxDataNumLog, slided];
}
function getTextColour(rgb) {
var r = parseInt('0x'+rgb.substring(0,2));
var g = parseInt('0x'+rgb.substring(2,4));
var b = parseInt('0x'+rgb.substring(4,6));
var avg = ((2 * r) + b + (3 * g))/6;
if (avg < 128) {
return 'white';
} else {
return 'black';
}
}
function addObjectToLog(name, obj, td) {
if(name == "Tag") {
td.appendChild(document.createTextNode('tag'));
var a = document.createElement('A');
a.classList.add('tagElem');
a.style.backgroundColor = obj.colour;
a.style.color = getTextColour(obj.colour.substring(1,6));
a.innerHTML = obj.name;
td.appendChild(a);
td.appendChild(document.createElement('br'));
} else if (name == "mispObject") {
td.appendChild(document.createTextNode('mispObj'));
} else {

View File

@ -30,6 +30,17 @@
</head>
<style>
.tagElem {
display: inline-block;
padding: 2px 4px;
font-size: 12px;
font-weight: bold;
line-height: 14px;
border-bottom-left-radius: 3px;
box-shadow: 3px 3px 3px #888888;
}
table {
overflow-y: scroll;
}