parent
5b14b54d1e
commit
cdb0a28bb9
5 changed files with 33 additions and 16 deletions
@ -1,10 +1,23 @@ |
||||
var socket = null; |
||||
var docker = null; |
||||
function error(msg) { |
||||
// handle display errors
|
||||
|
||||
function error(msg, data) { |
||||
$('#error').html('<h1>Error</h1><p>'+(new Date()).toLocaleString()+'</p><p>'+msg+'</p><pre>'+data+'</pre>').show() |
||||
} |
||||
|
||||
function sigstack() { |
||||
$('#error').hide() |
||||
var dot = docker.graphics.stack() |
||||
var svg = docker.graphics.viz(dot, error) |
||||
$('#stacks').html(svg) |
||||
$('a#svgStacks').attr('href', 'data:image/svg;base64,'+btoa(svg)) |
||||
.attr('target', '_blank') |
||||
.attr('download', window.location.hostname+'.svg') |
||||
.show() |
||||
} |
||||
|
||||
function init() { |
||||
socket = io.connect() |
||||
docker = new Docker(socket, error, '#containers', '#nodes', '#stacks') |
||||
docker = new Docker(socket, error, sigstack) |
||||
} |
||||
$(init) |
||||
|
@ -1,9 +1,10 @@ |
||||
body |
||||
padding: 50px |
||||
font: 14px "Lucida Grande", Helvetica, Arial, sans-serif |
||||
a |
||||
color: #00B7FF |
||||
|
||||
#stacks > svg |
||||
svg |
||||
width: 100% |
||||
height: auto |
||||
height: auto |
||||
|
||||
#error |
||||
display: none |
||||
background-color: red |
||||
|
||||
#svgStacks |
||||
display: none |
@ -1,5 +1,5 @@ |
||||
extends layout |
||||
|
||||
block content |
||||
h1 ServiceDock |
||||
div#stacks |
||||
div#stacks loading... |
||||
a#svgStacks download image |
Loading…
Reference in new issue