refactoring done, all is now based on dockerode

master 2.5.0
Marc Wäckerlin 6 years ago
parent cae0789ee1
commit 1ca7433f06
  1. 16
      client/servicedock.js
  2. 7
      package.json
  3. 5
      style/style.styl

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

@ -1,22 +1,19 @@
{ {
"name": "ServiceDock", "name": "ServiceDock",
"version": "2.2.0", "version": "2.5.0",
"private": true, "private": true,
"scripts": { "scripts": {
"start": "./bin/www" "start": "./bin/www"
}, },
"dependencies": { "dependencies": {
"body-parser": "*", "body-parser": "*",
"child_process": "^1.0.2",
"cookie-parser": "*", "cookie-parser": "*",
"debug": "*", "debug": "*",
"docker.js": "^1.4.16", "docker.js": "^2.0.0",
"dockerode": "^2.5.7", "dockerode": "^2.5.7",
"express": "*", "express": "*",
"jquery": "^3.1.1", "jquery": "^3.1.1",
"jqueryui": "^1.11.1",
"morgan": "*", "morgan": "*",
"pty.js": "^0.3.1",
"pug": "*", "pug": "*",
"socket.io": "*", "socket.io": "*",
"static-favicon": "*", "static-favicon": "*",

@ -8,6 +8,8 @@ svg
a a
text-decoration: inherit text-decoration: inherit
color: inherit
cursor: pointer
header header
z-index: 98 z-index: 98
@ -54,9 +56,6 @@ header
&[href] &[href]
display: block display: block
#info #info
a
color: inherit
cursor: pointer
#zoom #zoom
margin: 0.5em margin: 0.5em
display: flex display: flex

Loading…
Cancel
Save