added about and images
This commit is contained in:
9
html/about.php.in
Normal file
9
html/about.php.in
Normal file
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
exec("docker --version", $docker);
|
||||
$res = Array("project" => "@PACKAGE_NAME@",
|
||||
"version" => "@VERSION@",
|
||||
"docker" => $docker,
|
||||
"description" => "@DESCRIPTION_ENCODED@",
|
||||
"readme" => "@README_ENCODED@");
|
||||
echo json_encode($res);
|
||||
?>
|
39
html/images.php
Normal file
39
html/images.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
exec("docker images -aq", $res, $ret);
|
||||
if ($ret!=0) {
|
||||
echo 'digraph {';
|
||||
echo ' A [label="Error\nCannot get Docker Images"];';
|
||||
echo ' B [label="Does the Webserver have Docker rights?"];';
|
||||
echo ' A->B [label="Probable\nCause"];';
|
||||
echo '}';
|
||||
return;
|
||||
}
|
||||
exec("docker inspect ".join(" ", $res), $res2, $ret);
|
||||
if ($ret==0) {
|
||||
$images=json_decode(join($res2), true);
|
||||
echo "digraph {\n";
|
||||
echo " rankdir=TB;\n";
|
||||
|
||||
foreach ($images as $i) {
|
||||
$name = "";
|
||||
if (isset($i['RepoTags']) && count($i['RepoTags'])>0) {
|
||||
$name = join("\\n", $i['RepoTags']);
|
||||
if (isset($i['Author']) && $i['Author']!="") $name .= '\\n['.$i['Author'].']';
|
||||
}
|
||||
echo ' "'.$i['Id'].'" [label="'.$name.'"];'."\n";
|
||||
}
|
||||
|
||||
foreach ($images as $i) {
|
||||
if (isset($i['Parent']) && $i['Parent']!="")
|
||||
echo ' "'.$i['Parent'].'" -> "'.$i['Id'].'";'."\n";
|
||||
}
|
||||
|
||||
echo "}";
|
||||
} else {
|
||||
echo 'digraph {';
|
||||
echo ' A [label="Error\nCannot Inspect Docker Container"];';
|
||||
echo '}';
|
||||
return;
|
||||
}
|
||||
|
||||
?>
|
@@ -25,6 +25,8 @@
|
||||
<ul id="menu" style="display: none" onmouseleave="$('#menu').hide();">
|
||||
<li onclick="$('#menu').hide();overview()">Overview</li>
|
||||
<li onclick="$('#menu').hide();manage()">Manage</li>
|
||||
<li onclick="$('#menu').hide();imgs()">Images</li>
|
||||
<li onclick="$('#menu').hide();about()">About</li>
|
||||
</ul>
|
||||
|
||||
<div id="main">
|
||||
@@ -35,10 +37,6 @@
|
||||
|
||||
<div id="status">
|
||||
|
||||
<noscript>This is a secure and encryptet chat application, that runs
|
||||
in your browser and does not send any credentials to the
|
||||
server. Your password and your secret key is fully under your
|
||||
control. That's why you must enable javascript and local storage for
|
||||
this application.</noscript>
|
||||
<noscript>JavaScript is required for the interface.</noscript>
|
||||
|
||||
</div>
|
||||
|
@@ -8,12 +8,12 @@
|
||||
## 1 2 3 4 5 6 7 8
|
||||
## 45678901234567890123456789012345678901234567890123456789012345678901234567890
|
||||
|
||||
EXTRA_DIST = index.html.in
|
||||
EXTRA_DIST = index.html.in about.php.in
|
||||
|
||||
wwwdir = ${pkgdatadir}/html
|
||||
www_DATA = index.html
|
||||
www_DATA = index.html about.php
|
||||
dist_www_DATA = servicedock.css servicedock.js jquery.js viz.js \
|
||||
menu.svg overview.php details.php manage.php \
|
||||
action.php jquery-ui.js jquery-ui.css
|
||||
action.php jquery-ui.js jquery-ui.css images
|
||||
|
||||
MAINTAINERCLEANFILES = makefile.in
|
||||
|
@@ -48,7 +48,7 @@ if ($ret==0) {
|
||||
|
||||
echo " {rank=same;\n";
|
||||
foreach ($containers as $c) {
|
||||
foreach ($c['Volumes'] as $in => $out) {
|
||||
if (isset($c['Volumes'])) foreach ($c['Volumes'] as $in => $out) {
|
||||
echo ' "'.$in.':'.$out.'" [label="'.$in.'";shape=box];',"\n";
|
||||
}
|
||||
}
|
||||
@@ -56,7 +56,7 @@ if ($ret==0) {
|
||||
|
||||
echo " {rank=same;\n";
|
||||
foreach ($containers as $c) {
|
||||
foreach ($c['Volumes'] as $in => $out) {
|
||||
if (isset($c['Volumes'])) foreach ($c['Volumes'] as $in => $out) {
|
||||
if (!preg_match(',^/var/lib/docker/,', $out))
|
||||
echo ' "'.$out.'" [shape=box];',"\n";
|
||||
}
|
||||
@@ -64,7 +64,7 @@ if ($ret==0) {
|
||||
echo " };\n";
|
||||
|
||||
foreach ($containers as $c) {
|
||||
foreach ($c['Volumes'] as $in => $out) {
|
||||
if (isset($c['Volumes'])) foreach ($c['Volumes'] as $in => $out) {
|
||||
if (!preg_match(',^/var/lib/docker/,', $out))
|
||||
echo ' "'.$in.':'.$out.'" -> "'.$out.'";',"\n";
|
||||
}
|
||||
@@ -78,7 +78,7 @@ if ($ret==0) {
|
||||
$link = preg_replace(',.*:/?'.$name.'/,', '', $l);
|
||||
echo '"'.$name.'" -> "'.$to.'" [label="'.$link.'"];'."\n";
|
||||
}
|
||||
foreach ($c['Volumes'] as $in => $out) {
|
||||
if (isset($c['Volumes'])) foreach ($c['Volumes'] as $in => $out) {
|
||||
echo '"'.$name.'" -> "'.$in.':'.$out.'";',"\n";
|
||||
}
|
||||
}
|
||||
|
@@ -9,7 +9,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
p {
|
||||
pre, p {
|
||||
padding: .5em 0 1em 0;
|
||||
}
|
||||
|
||||
|
@@ -92,6 +92,24 @@ function togglemenu() {
|
||||
$("#menu").toggle();
|
||||
}
|
||||
|
||||
function about(c) {
|
||||
$.ajax({url: "about.php", success: function(res) {
|
||||
try {
|
||||
var a = JSON.parse(res);
|
||||
status("<h2>"+a.description+"</h2>"+
|
||||
"<p>"+a.project+"-"+a.version+"</p>"+
|
||||
"<p>"+a.docker+"</p>"+
|
||||
"<h3>README</h3>"+
|
||||
"<pre>"+a.readme+"</pre>");
|
||||
} catch(e) {
|
||||
status("<pre>"+res+"</pre>");
|
||||
error("Exception Caught: "+e);
|
||||
}
|
||||
}}).fail(function() {
|
||||
error("offline");
|
||||
});
|
||||
}
|
||||
|
||||
function details(c) {
|
||||
$.ajax({url: "details.php?container="+c, success: function(res) {
|
||||
try {
|
||||
@@ -101,7 +119,7 @@ function details(c) {
|
||||
error("Exception Caught: "+e);
|
||||
}
|
||||
}}).fail(function() {
|
||||
error("offline")
|
||||
error("offline");
|
||||
});
|
||||
}
|
||||
|
||||
@@ -110,7 +128,7 @@ function action(container, action) {
|
||||
success(res);
|
||||
manage();
|
||||
}}).fail(function() {
|
||||
error("offline")
|
||||
error("offline");
|
||||
});
|
||||
}
|
||||
|
||||
@@ -119,7 +137,7 @@ function manage() {
|
||||
$.ajax({url: "manage.php", success: function(res) {
|
||||
status(res);
|
||||
}}).fail(function() {
|
||||
error("offline")
|
||||
error("offline");
|
||||
});
|
||||
}
|
||||
|
||||
@@ -128,13 +146,31 @@ function overview() {
|
||||
$.ajax({url: "overview.php", success: function(res) {
|
||||
try {
|
||||
status(Viz(res));
|
||||
//status(res);
|
||||
} catch(e) {
|
||||
status("<pre>"+res+"</pre>");
|
||||
error("Exception Caught: "+e);
|
||||
(res = res.split("\n")).forEach(function(v, i, a) {
|
||||
a[i] = ("000"+(i+1)).slice(-3)+": "+v;
|
||||
});
|
||||
status("<h2>Exception Caught:</h2><p>"+e+"<p><pre>"+res.join("\n")+"</pre>");
|
||||
}
|
||||
}}).fail(function() {
|
||||
error("offline")
|
||||
error("offline");
|
||||
});
|
||||
}
|
||||
|
||||
/** Show an Overview of all Docker Images */
|
||||
function imgs() {
|
||||
$.ajax({url: "images.php", success: function(res) {
|
||||
try {
|
||||
status(Viz(res));
|
||||
//status(res);
|
||||
} catch(e) {
|
||||
(res = res.split("\n")).forEach(function(v, i, a) {
|
||||
a[i] = ("000"+(i+1)).slice(-3)+": "+v;
|
||||
});
|
||||
status("<h2>Exception Caught:</h2><p>"+e+"<p><pre>"+res.join("\n")+"</pre>");
|
||||
}
|
||||
}}).fail(function() {
|
||||
error("offline");
|
||||
});
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user