template
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
root
2024-08-27 11:24:32 +02:00
parent 0801358211
commit 38bb017e69
2 changed files with 39 additions and 18 deletions

View File

@@ -143,6 +143,26 @@ function get_deployments() {
} }
}); });
} }
function load_template(additional) {
var url = 'scan.php?op=deployment&additional='+additional;
jQuery.get(url, function(data) {
if (data=="OK") {
setTimeout(check_deployment, 500, additional);
}
});
}
function check_deployment(additional) {
var url = 'scan.php?op=check_deployment';
jQuery.get(url, function(data) {
if (data!="") {
jQuery("#"+additional).html(data);
}
else setTimeout(check_deployment, 500, additional);
});
}
function check_containers() { function check_containers() {
var url = 'scan.php?op=check_containers'; var url = 'scan.php?op=check_containers';
jQuery.get(url, function(data) { jQuery.get(url, function(data) {

View File

@@ -76,7 +76,8 @@ switch ($_GET["op"]) {
else { else {
foreach ($data["DEPLOYMENTS"] as $service_name => $content) { foreach ($data["DEPLOYMENTS"] as $service_name => $content) {
//echo base64_decode($content); //echo base64_decode($content);
echo $service_name."<br>"; echo '<div><a href="#" onclick="load_template(\''.$service_name.'\')">'.$service_name.'</a> - '.$content.'</div>';
echo '<div id="'.$service_name.'"></div>'
} }
} }
} }
@@ -107,6 +108,23 @@ switch ($_GET["op"]) {
redis_set($op,$json); redis_set($op,$json);
echo "OK"; // TODO? echo "OK"; // TODO?
break; break;
case "check_deployment":
$arr = check_redis("web_out","deployment");
if (!empty($arr)) {
foreach ($arr as $key=>$data) {
if ($key=="deployment") {
if ($data["STATUS"]=="0") { // ask
echo base64_decode($data["TEMPLATE"]);
}
else { // deploy
echo $data["STATUS"];
}
redis_remove("$key");
}
}
}
else echo "";
break;
case "deploy": case "deploy":
if ($key=check_deploy()) { if ($key=check_deploy()) {
$text="A deployment has already started.<br>Please wait and do not start a new one..."; $text="A deployment has already started.<br>Please wait and do not start a new one...";
@@ -121,23 +139,6 @@ switch ($_GET["op"]) {
} }
echo $text; echo $text;
break; break;
case "check_deployment":
$arr = check_redis("web_out","deployment");
if (!empty($arr)) {
foreach ($arr as $key=>$data) {
if ($key=="deployment") {
if ($data["STATUS"]=="0") { // ask
echo base64_decode($data["TEMPLATE"]);
}
else {
echo $data["STATUS"];
}
redis_remove("$key");
}
}
}
else echo "";
break;
case "repositories": case "repositories":
$arr = array("STATUS" => 0); $arr = array("STATUS" => 0);
$json = json_encode($arr, JSON_UNESCAPED_SLASHES|JSON_PRETTY_PRINT); $json = json_encode($arr, JSON_UNESCAPED_SLASHES|JSON_PRETTY_PRINT);