refactoring done, all is now based on dockerode
This commit is contained in:
		| @@ -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() | ||||
| } | ||||
|   | ||||
| @@ -1,22 +1,19 @@ | ||||
| { | ||||
|   "name": "ServiceDock", | ||||
|   "version": "2.2.0", | ||||
|   "version": "2.5.0", | ||||
|   "private": true, | ||||
|   "scripts": { | ||||
|     "start": "./bin/www" | ||||
|   }, | ||||
|   "dependencies": { | ||||
|     "body-parser": "*", | ||||
|     "child_process": "^1.0.2", | ||||
|     "cookie-parser": "*", | ||||
|     "debug": "*", | ||||
|     "docker.js": "^1.4.16", | ||||
|     "docker.js": "^2.0.0", | ||||
|     "dockerode": "^2.5.7", | ||||
|     "express": "*", | ||||
|     "jquery": "^3.1.1", | ||||
|     "jqueryui": "^1.11.1", | ||||
|     "morgan": "*", | ||||
|     "pty.js": "^0.3.1", | ||||
|     "pug": "*", | ||||
|     "socket.io": "*", | ||||
|     "static-favicon": "*", | ||||
|   | ||||
| @@ -8,6 +8,8 @@ svg | ||||
|  | ||||
| a | ||||
|   text-decoration: inherit | ||||
|   color: inherit | ||||
|   cursor: pointer | ||||
|  | ||||
| header | ||||
|   z-index: 98 | ||||
| @@ -54,9 +56,6 @@ header | ||||
|         &[href] | ||||
|           display: block | ||||
|   #info | ||||
|     a | ||||
|       color: inherit | ||||
|       cursor: pointer | ||||
|     #zoom | ||||
|       margin: 0.5em | ||||
|       display: flex | ||||
|   | ||||
		Reference in New Issue
	
	Block a user