|
|
|
@ -1,22 +1,30 @@ |
|
|
|
|
var socket = io.connect() |
|
|
|
|
var docker = new Docker(socket, error, sigstack) |
|
|
|
|
var docker = new Docker(socket, error, sigstack, sigcontainer) |
|
|
|
|
var parameters = docker.graphics.parameters |
|
|
|
|
var showstack = true |
|
|
|
|
var showcontainer = true |
|
|
|
|
|
|
|
|
|
function showdate() { |
|
|
|
|
$('#clock').text((new Date()).toLocaleString()) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function error(e) { |
|
|
|
|
showdate() |
|
|
|
|
$('#status').removeClass().addClass('error') |
|
|
|
|
$('#error').html('<h1>Error</h1><p>'+(new Date()).toLocaleString()+'</p><p>'+e.msg+'</p><pre>'+e.data+'</pre>').show() |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function sigstack() { |
|
|
|
|
$('#error').hide() |
|
|
|
|
$('#clock').text((new Date()).toLocaleString()) |
|
|
|
|
if (!showstack) return; |
|
|
|
|
showdate() |
|
|
|
|
$('#status').removeClass().addClass('wait') |
|
|
|
|
var dot = docker.graphics.stack(parameters) |
|
|
|
|
$('a#dot').attr('href', 'data:text/vnd.graphviz;base64,'+btoa(dot)) |
|
|
|
|
.attr('target', '_blank') |
|
|
|
|
.attr('download', window.location.hostname+'.dot') |
|
|
|
|
$('#error').hide() |
|
|
|
|
showdate() |
|
|
|
|
try { |
|
|
|
|
$('#clock').text((new Date()).toLocaleString()) |
|
|
|
|
var svg = docker.graphics.viz(dot) |
|
|
|
|
$('#stacks').html(svg) |
|
|
|
|
$('#status').removeClass().addClass('success') |
|
|
|
@ -26,7 +34,35 @@ function sigstack() { |
|
|
|
|
} catch (e) { |
|
|
|
|
error(e) |
|
|
|
|
} |
|
|
|
|
$('#clock').text((new Date()).toLocaleString()) |
|
|
|
|
showdate() |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function sigcontainer() { |
|
|
|
|
if (!showcontainer) return; |
|
|
|
|
console.log(docker.containers.get()) |
|
|
|
|
showdate() |
|
|
|
|
$('#status').removeClass().addClass('wait') |
|
|
|
|
var dot = docker.graphics.standalone(parameters) |
|
|
|
|
/* |
|
|
|
|
$('a#dot').attr('href', 'data:text/vnd.graphviz;base64,'+btoa(dot)) |
|
|
|
|
.attr('target', '_blank') |
|
|
|
|
.attr('download', window.location.hostname+'.dot') |
|
|
|
|
*/ |
|
|
|
|
$('#error').hide() |
|
|
|
|
showdate() |
|
|
|
|
try { |
|
|
|
|
var svg = docker.graphics.viz(dot) |
|
|
|
|
$('#standalone').html(svg) |
|
|
|
|
$('#status').removeClass().addClass('success') |
|
|
|
|
/* |
|
|
|
|
$('a#svg').attr('href', 'data:image/svg;base64,'+btoa(svg)) |
|
|
|
|
.attr('target', '_blank') |
|
|
|
|
.attr('download', window.location.hostname+'.svg') |
|
|
|
|
*/ |
|
|
|
|
} catch (e) { |
|
|
|
|
error(e) |
|
|
|
|
} |
|
|
|
|
showdate() |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function setParameters() { |
|
|
|
@ -41,6 +77,8 @@ else |
|
|
|
|
--localStorage.rankdir |
|
|
|
|
|
|
|
|
|
function init() { |
|
|
|
|
showdate() |
|
|
|
|
$('#status').removeClass().addClass('wait') |
|
|
|
|
setParameters() |
|
|
|
|
$('#orientation').on('click', () => { |
|
|
|
|
setParameters() |
|
|
|
|