1
0
Fork 0

Inserting warning and danger-badges if counter reaches specified levels

main
Kim - DG9VH 4 years ago
parent 63ba1aa3f1
commit 394df4804e

@ -133,7 +133,7 @@
<!-- Standard-Panel-Inhalt --> <!-- Standard-Panel-Inhalt -->
<div class="panel-heading">Dapnet-Messages<span class="pull-right clickable"><i class="glyphicon glyphicon-chevron-up"></i></span></div> <div class="panel-heading">Dapnet-Messages<span class="pull-right clickable"><i class="glyphicon glyphicon-chevron-up"></i></span></div>
<div class="panel-body"> <div class="panel-body">
<div id="messagesinqueue">Messages in Queue: 0</div> <span class="badge badge-light" id="messagesinqueue">Messages in Queue: 0</span>
<!-- Tabelle --> <!-- Tabelle -->
<div class="table-responsive"> <div class="table-responsive">
<table id="dapnetmessages" class="table dapnetmessages table-condensed table-striped table-hover"> <table id="dapnetmessages" class="table dapnetmessages table-condensed table-striped table-hover">

@ -1,2 +1,9 @@
# 1 = show link to QRZ.com, 0 = off
var qrz = 1; var qrz = 1;
# 1 = enable debug in javascript-console, 0 = 0ff
var debug = 0; var debug = 0;
# Set messagecounters for different badge-colors
var warnlevel = 200;
var emergencylevel = 500;

@ -288,16 +288,44 @@ function getDapnetMessages(document, event) {
if (messagecount < 0 ) { if (messagecount < 0 ) {
messagecount = 0; messagecount = 0;
} }
if (messagecount <= warnlevel) {
document.getElementById('messagesinqueue').className = "badge badge-light";
}
if (messagecount > warnlevel) {
document.getElementById('messagesinqueue').className = "badge badge-warning";
}
if (messagecount > emergencylevel) {
document.getElementById('messagesinqueue').className = "badge badge-danger";
}
document.getElementById('messagesinqueue').innerHTML = "Messages in Queue: " + messagecount; document.getElementById('messagesinqueue').innerHTML = "Messages in Queue: " + messagecount;
} }
if (line.indexOf("Messages in Queue") > 0 ) { if (line.indexOf("Messages in Queue") > 0 ) {
getMessagesInQueue(line); getMessagesInQueue(line);
if (messagecount <= warnlevel) {
document.getElementById('messagesinqueue').className = "badge badge-light";
}
if (messagecount > warnlevel) {
document.getElementById('messagesinqueue').className = "badge badge-warning";
}
if (messagecount > emergencylevel) {
document.getElementById('messagesinqueue').className = "badge badge-danger";
}
document.getElementById('messagesinqueue').innerHTML = "Messages in Queue: " + messagecount; document.getElementById('messagesinqueue').innerHTML = "Messages in Queue: " + messagecount;
} }
if (line.indexOf("Rejecting") > 0 ) { if (line.indexOf("Rejecting") > 0 ) {
messagecount--; messagecount--;
if (messagecount < 0 ) { if (messagecount < 0 ) {
messagecount = 0; messagecount = 0;
if (messagecount <= warnlevel) {
document.getElementById('messagesinqueue').className = "badge badge-light";
}
if (messagecount > warnlevel) {
document.getElementById('messagesinqueue').className = "badge badge-warning";
}
if (messagecount > emergencylevel) {
document.getElementById('messagesinqueue').className = "badge badge-danger";
}
document.getElementById('messagesinqueue').innerHTML = "Messages in Queue: " + messagecount; document.getElementById('messagesinqueue').innerHTML = "Messages in Queue: " + messagecount;
} }
} }

Loading…
Cancel
Save