|
|
|
@ -12,7 +12,12 @@ function showdate() { |
|
|
|
|
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() |
|
|
|
|
var txt = '<h1>Error</h1><p>'+(new Date()).toLocaleString()+'</p>' |
|
|
|
|
if (e) |
|
|
|
|
txt += (e.msg?'<p>'+e.msg+'</p>':'<pre>'+e+'</pre>') |
|
|
|
|
+ (e.data?'<pre>'+e.data+'</pre>':'') |
|
|
|
|
$('#error').html(txt).show() |
|
|
|
|
console.trace() |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function update() { |
|
|
|
@ -23,14 +28,14 @@ function update() { |
|
|
|
|
'services': docker.services.get(), |
|
|
|
|
'tasks': docker.tasks.get() |
|
|
|
|
} |
|
|
|
|
$('a#data').attr('href', 'data:application/json;base64,'+btoa(JSON.stringify(data))) |
|
|
|
|
$('a#data').attr('href', 'data:application/json;base64,'+btoa(unescape(encodeURIComponent(JSON.stringify(data))))) |
|
|
|
|
.attr('target', '_blank') |
|
|
|
|
.attr('download', window.location.hostname+'.json') |
|
|
|
|
var dot = docker.graphics.header(parameters) |
|
|
|
|
if (stack) dot += stack; |
|
|
|
|
if (standalone) dot += standalone; |
|
|
|
|
dot += docker.graphics.footer() |
|
|
|
|
$('a#dot').attr('href', 'data:text/vnd.graphviz;base64,'+btoa(dot)) |
|
|
|
|
$('a#dot').attr('href', 'data:text/vnd.graphviz;base64,'+btoa(unescape(encodeURIComponent(dot)))) |
|
|
|
|
.attr('target', '_blank') |
|
|
|
|
.attr('download', window.location.hostname+'.dot') |
|
|
|
|
$('#error').hide() |
|
|
|
@ -38,12 +43,13 @@ function update() { |
|
|
|
|
try { |
|
|
|
|
var svg = docker.graphics.viz(dot) |
|
|
|
|
$('#wizard').html(svg) |
|
|
|
|
$('#status').removeClass().addClass('success') |
|
|
|
|
$('a#svg').attr('href', 'data:image/svg;base64,'+btoa(svg)) |
|
|
|
|
$('a#svg').attr('href', 'data:image/svg;base64,'+btoa(unescape(encodeURIComponent(svg)))) |
|
|
|
|
.attr('target', '_blank') |
|
|
|
|
.attr('download', window.location.hostname+'.svg') |
|
|
|
|
$('#status').removeClass().addClass('success') |
|
|
|
|
} catch (e) { |
|
|
|
|
error(e) |
|
|
|
|
console.trace() |
|
|
|
|
} |
|
|
|
|
showdate() |
|
|
|
|
} |
|
|
|
|