diff --git a/manage.html b/manage.html index dc2963e..536dcc2 100644 --- a/manage.html +++ b/manage.html @@ -190,6 +190,26 @@ function load_template(additional) { }); } +function reinstall(additional) { + jQuery("#"+additional).html('Loading...'); + var url = 'scan.php?op=reinstall&additional='+additional; + jQuery.get(url, function(data) { + if (data=="OK") { + setTimeout(check_reinstall, 1000, additional); + } + }); +} + +function check_reinstall(additional) { + var url = 'scan.php?op=check_reinstall'; + jQuery.get(url, function(data) { + if (data!="") { + jQuery("#"+additional).html(data); + } + else setTimeout(check_reinstall, 1000, additional); + }); +} + function uninstall(additional) { var url = 'scan.php?op=uninstall&additional='+additional; jQuery.get(url, function(data) { diff --git a/scan.php b/scan.php index 33c7fa2..d5891b8 100644 --- a/scan.php +++ b/scan.php @@ -133,7 +133,7 @@ switch ($_GET["op"]) { foreach ($data["DEPLOYMENTS"] as $service_name => $content) { //echo base64_decode($content); if (array_key_exists($service_name,$data["INSTALLED_SERVICES"])) { - echo '
'.$service_name.' - '.$content.' - INSTALLED - UNINSTALL
'; + echo '
'.$service_name.' - '.$content.' - INSTALLED - UNINSTALL - REINSTALL
'; } else echo '
'.$service_name.' - '.$content.'
'; echo '
'; @@ -170,6 +170,8 @@ switch ($_GET["op"]) { redis_set($op,$json); echo "OK"; // TODO? break; + case "check_reinstall": + $reinstall = 1; case "check_deployment": $arr = check_redis("web_out","deployment"); if (!empty($arr)) { @@ -177,6 +179,9 @@ switch ($_GET["op"]) { if ($key=="deployment") { if ($data["STATUS"]=="0") { // ask $template = json_decode(base64_decode($data["TEMPLATE"])); + if ($reinstall) { + var_dump($template); + } echo "

"; foreach ($template->fields as $field) { if (isset($field->generated)) { @@ -192,7 +197,7 @@ switch ($_GET["op"]) {
name}\" id=\"additional\"> - +
@@ -263,15 +268,23 @@ switch ($_GET["op"]) { } echo $text; break; + case "reinstall": + $arr = array("NAME" => $_GET["additional"], "ACTION" => "reinstall"); + $json = json_encode($arr, JSON_UNESCAPED_SLASHES|JSON_PRETTY_PRINT); + + $op = "deployment"; + redis_set($op,$json); + echo "OK"; // TODO? + break; case "uninstall": - if ($key=check_uninstall()) { - $text="Uninstall process has already started.
Please wait and do not start a new one..."; + if ($key=check_deploy()) { + $text="Deploy/uninstall process has already started.
Please wait and do not start a new one..."; } else { $text="Uninstall in progress... Please wait..."; $arr = array("NAME" => $_GET["additional"], "ACTION" => "uninstall"); $json = json_encode($arr, JSON_UNESCAPED_SLASHES|JSON_PRETTY_PRINT); - $op = "uninstall"; + $op = "deployment"; redis_set($op,$json); } echo $text;