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