|
|
@ -1,11 +1,10 @@ |
|
|
|
var socket = io.connect() |
|
|
|
var socket = io.connect() |
|
|
|
var docker = new Docker(socket, error, sigstack) |
|
|
|
var docker = new Docker(socket, error, sigstack) |
|
|
|
var parameters = docker.graphics.parameters |
|
|
|
var parameters = docker.graphics.parameters |
|
|
|
console.log(localStorage) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function error(msg, data) { |
|
|
|
function error(e) { |
|
|
|
$('#status').removeClass().addClass('error') |
|
|
|
$('#status').removeClass().addClass('error') |
|
|
|
$('#error').html('<h1>Error</h1><p>'+(new Date()).toLocaleString()+'</p><p>'+msg+'</p><pre>'+data+'</pre>').show() |
|
|
|
$('#error').html('<h1>Error</h1><p>'+(new Date()).toLocaleString()+'</p><p>'+e.msg+'</p><pre>'+e.data+'</pre>').show() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function sigstack() { |
|
|
|
function sigstack() { |
|
|
@ -13,31 +12,33 @@ function sigstack() { |
|
|
|
$('#clock').text((new Date()).toLocaleString()) |
|
|
|
$('#clock').text((new Date()).toLocaleString()) |
|
|
|
$('#status').removeClass().addClass('wait') |
|
|
|
$('#status').removeClass().addClass('wait') |
|
|
|
var dot = docker.graphics.stack(parameters) |
|
|
|
var dot = docker.graphics.stack(parameters) |
|
|
|
var svg = docker.graphics.viz(dot, error) |
|
|
|
$('a#dot').attr('href', 'data:text/vnd.graphviz;base64,'+btoa(dot)) |
|
|
|
$('#stacks').html(svg) |
|
|
|
.attr('target', '_blank') |
|
|
|
|
|
|
|
.attr('download', window.location.hostname+'.dot') |
|
|
|
|
|
|
|
try { |
|
|
|
$('#clock').text((new Date()).toLocaleString()) |
|
|
|
$('#clock').text((new Date()).toLocaleString()) |
|
|
|
|
|
|
|
var svg = docker.graphics.viz(dot) |
|
|
|
|
|
|
|
$('#stacks').html(svg) |
|
|
|
$('#status').removeClass().addClass('success') |
|
|
|
$('#status').removeClass().addClass('success') |
|
|
|
$('a#svg').attr('href', 'data:image/svg;base64,'+btoa(svg)) |
|
|
|
$('a#svg').attr('href', 'data:image/svg;base64,'+btoa(svg)) |
|
|
|
.attr('target', '_blank') |
|
|
|
.attr('target', '_blank') |
|
|
|
.attr('download', window.location.hostname+'.svg') |
|
|
|
.attr('download', window.location.hostname+'.svg') |
|
|
|
$('a#dot').attr('href', 'data:text/vnd.graphviz;base64,'+btoa(dot)) |
|
|
|
} catch (e) { |
|
|
|
.attr('target', '_blank') |
|
|
|
error(e) |
|
|
|
.attr('download', window.location.hostname+'.dot') |
|
|
|
} |
|
|
|
|
|
|
|
$('#clock').text((new Date()).toLocaleString()) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function setParameters() { |
|
|
|
function setParameters() { |
|
|
|
localStorage.rankdir = (++localStorage.rankdir)%setParameters.rankdirs.length |
|
|
|
localStorage.rankdir = (++localStorage.rankdir)%setParameters.rankdirs.length |
|
|
|
parameters.rankdir = setParameters.rankdirs[localStorage.rankdir] |
|
|
|
parameters.rankdir = setParameters.rankdirs[localStorage.rankdir] |
|
|
|
$('#orientation').removeClass().addClass(parameters.rankdir.toLowerCase()) |
|
|
|
$('#orientation').removeClass().addClass(parameters.rankdir.toLowerCase()) |
|
|
|
console.log(localStorage.rankdir) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
setParameters.rankdirs = ['LR', 'TB', 'RL', 'BT'] |
|
|
|
setParameters.rankdirs = ['LR', 'TB', 'RL', 'BT'] |
|
|
|
if (!localStorage.rankdir) |
|
|
|
if (!localStorage.rankdir) |
|
|
|
localStorage.rankdir = -1 |
|
|
|
localStorage.rankdir = -1 |
|
|
|
else |
|
|
|
else |
|
|
|
--localStorage.rankdir |
|
|
|
--localStorage.rankdir |
|
|
|
console.log(localStorage.rankdir) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function init() { |
|
|
|
function init() { |
|
|
|
setParameters() |
|
|
|
setParameters() |
|
|
|