|
|
|
@ -157,9 +157,15 @@ function previewCreate() { |
|
|
|
|
name: $('#image').val(), |
|
|
|
|
id: null |
|
|
|
|
}, |
|
|
|
|
links: [], |
|
|
|
|
volumesfrom: [], |
|
|
|
|
ports: $('#createports option').map(function() {return $(this).data();}).get(), |
|
|
|
|
env: $('#createvars option').map(function() {return $(this).val();}).get(), |
|
|
|
|
volumes: $('#createvolumes option').map(function() {return $(this).data();}).get(), |
|
|
|
|
volumesfrom: $('#createvolumefroms option').map(function() {return $(this).val();}).get(), |
|
|
|
|
links: $('#createlinks option').map(function() {return $(this).data();}).get(), |
|
|
|
|
entrypoint: $('#createentrypoints option').map(function() {return $(this).val();}).get(), |
|
|
|
|
cmd: $('#createcommands option').map(function() {return $(this).val();}).get(), |
|
|
|
|
}; |
|
|
|
|
console.log("PREVIEW", nodes[name]); |
|
|
|
|
$('#preview').html(Viz("digraph {\n"+" rankdir="+rankdir+";\n"+docker.containers.subgraph(name, nodes)+"\n}")); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -171,22 +177,22 @@ function zoom(incr = 0) { |
|
|
|
|
zoomlevel = (zoomlevel+incr)%2; |
|
|
|
|
switch (zoomlevel) { |
|
|
|
|
case 0: { |
|
|
|
|
$("#main svg").css("width", "auto"); |
|
|
|
|
$("#main svg").css("height", "auto"); |
|
|
|
|
$("#main svg").css("max-width", "100%"); |
|
|
|
|
$("#main svg").css("max-height", "100%"); |
|
|
|
|
$("#main svg, #preview svg").css("width", "auto"); |
|
|
|
|
$("#main svg, #preview svg").css("height", "auto"); |
|
|
|
|
$("#main svg, #preview svg").css("max-width", "100%"); |
|
|
|
|
$("#main svg, #preview svg").css("max-height", "100%"); |
|
|
|
|
} break; |
|
|
|
|
case 1: { |
|
|
|
|
$("#main svg").css("width", "100%"); |
|
|
|
|
$("#main svg").css("height", "auto"); |
|
|
|
|
$("#main svg").css("max-width", "100%"); |
|
|
|
|
$("#main svg").css("max-height", "none"); |
|
|
|
|
$("#main svg, #preview svg").css("width", "100%"); |
|
|
|
|
$("#main svg, #preview svg").css("height", "auto"); |
|
|
|
|
$("#main svg, #preview svg").css("max-width", "100%"); |
|
|
|
|
$("#main svg, #preview svg").css("max-height", "none"); |
|
|
|
|
} break; |
|
|
|
|
case 2: { |
|
|
|
|
$("#main.svg").css("width", "auto"); |
|
|
|
|
$("#main.svg").css("height", "100%"); |
|
|
|
|
$("#main.svg").css("max-width", "none"); |
|
|
|
|
$("#main.svg").css("max-height", "100%"); |
|
|
|
|
$("#main.svg, #preview svg").css("width", "auto"); |
|
|
|
|
$("#main.svg, #preview svg").css("height", "100%"); |
|
|
|
|
$("#main.svg, #preview svg").css("max-width", "none"); |
|
|
|
|
$("#main.svg, #preview svg").css("max-height", "100%"); |
|
|
|
|
} break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -201,6 +207,7 @@ function rotateviz() { |
|
|
|
|
else |
|
|
|
|
rankdir = "LR"; |
|
|
|
|
showviz(); |
|
|
|
|
previewCreate(); |
|
|
|
|
} |
|
|
|
|
function showviz(vizpath, more) { |
|
|
|
|
if (!vizpath) { |
|
|
|
@ -488,7 +495,17 @@ function initForms() { |
|
|
|
|
.append('<option '+$(this).siblings("input") |
|
|
|
|
.map(function() { |
|
|
|
|
if (this.hasAttribute('data-name')) { |
|
|
|
|
return this.getAttribute('data-name')+'="'+this.value.replace(/"/g, '"')+'"'; |
|
|
|
|
var res = ""; |
|
|
|
|
var obj = this; |
|
|
|
|
this.getAttribute('data-name').split(' ').forEach(function(n) { |
|
|
|
|
res += 'data-'+n+'="'+ |
|
|
|
|
(obj.type!='checkbox'||obj.checked |
|
|
|
|
?obj.value:obj.getAttribute('data-false')) |
|
|
|
|
.replace(/&/g, '&') |
|
|
|
|
.replace(/"/g, '"') |
|
|
|
|
+'"'; |
|
|
|
|
}) |
|
|
|
|
return res; |
|
|
|
|
} else return ''; |
|
|
|
|
}).get().join(' ')+'>'+$(this).siblings("input") |
|
|
|
|
.map(function() { |
|
|
|
@ -498,8 +515,9 @@ function initForms() { |
|
|
|
|
val=''; sep='' |
|
|
|
|
} |
|
|
|
|
return sep+val; |
|
|
|
|
}).get().join('')+'</option>') |
|
|
|
|
$(this).siblings("input").value(); |
|
|
|
|
}).get().join('')+'</option>'); |
|
|
|
|
$(this).siblings("input").val(); |
|
|
|
|
previewCreate(); |
|
|
|
|
}); |
|
|
|
|
//$("#preview").html(Viz("digraph {\nrankdir="+rankdir+";\n"+docker.containers.graph()+"\n}"));
|
|
|
|
|
} |
|
|
|
|