Commit 70910d50 authored by PD0ZRY Rudy's avatar PD0ZRY Rudy
Browse files

Herpy dooves.

parent e685137e
......@@ -6,10 +6,13 @@ var options = {
var activeCallCount = 0
var activeCalls = {}
var dup = false
var history = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
var CLI = require('clui'),
clc = require('cli-color');
var Sparkline = require('clui').Sparkline;
var Line = CLI.Line,
LineBuffer = CLI.LineBuffer;
......@@ -35,7 +38,6 @@ socket.on('connect', function(){
return
}
activeCalls[data['SessionID']] = data
redrawDisplay()
if (dup) console.log("Duplicated session")
}
if (data['Stop'] != 0)
......@@ -43,7 +45,6 @@ socket.on('connect', function(){
if (activeCalls[data['SessionID']] != undefined)
{
delete(activeCalls[data['SessionID']])
redrawDisplay()
}
}
})
......@@ -57,10 +58,17 @@ socket.on('disconnect', function(){
dup = false
});
setInterval(function () {
redrawDisplay()
}, 1000);
function redrawDisplay()
{
console.log('\033[2J');
history.push(Object.keys(activeCalls).length)
if (history.length > 30) history.shift()
var outputBuffer = new LineBuffer({
x: 0,
y: 0,
......@@ -72,7 +80,7 @@ function redrawDisplay()
.fill()
.store();
var message = new Line(outputBuffer)
.column('Session count: '+Object.keys(activeCalls).length, 20, [clc.green])
.column(Sparkline(history, ' calls active'))
.fill()
.store();
var header = new Line(outputBuffer)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment