lots of cucc
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
root
2024-11-26 18:40:46 +01:00
parent 8f48a99184
commit c0d7365c0f
4 changed files with 77 additions and 34 deletions

View File

@@ -13,7 +13,7 @@
<body id="scan" class="text-center">
<div class="container-fluid">
<div class="col-md-12">
<h1>Scanning your device for any prevoius installed vesions</h1>
<h1>Scanning your device for any previous installed vesions</h1>
<div class="row d-flex justify-content-center mt-100">
<div class="progress blue" data-value="100">
<span class="progress-left">

View File

@@ -94,9 +94,10 @@ function redirectToManage() {
}
function check_install() {
var url = 'scan.php?op=check_install&key=<?php echo $key;?>';
$.get(url, function(data){
console.log(data);
console.log('check_install:'+data+' counter: '+counter);
if (data=='INSTALLED') {
redirectToManage();
}
@@ -108,17 +109,55 @@ function check_install() {
});
}
function check_redis() {
var url = 'scan.php?op=redis';
$.get(url, function(data){
console.log('check_redis: '+data);
if (data=='OK') {
$("#redis").html('Redis server - OK');
check_install();
}
else {
$("#redis").html('Redis server is not available...');
setTimeout(check_redis, 1000);
}
});
}
function check_directory() {
var url = 'scan.php?op=directory';
$.get(url, function(data){
console.log('check_directory: '+data);
if (data=='OK') {
$("#redis").html('Connection is ready - OK');
check_install();
}
else {
$("#redis").html('Shared directory is not available...');
}
});
}
function check_interface() {
var url = 'scan.php?op=get_interface';
$.get(url, function(data){
console.log('check_interface: '+data);
if (data=='redis') {
check_redis();
}
else if (data=='directory') {
check_directory();
}
else {
$("#redis").html('Invalid interface definition...');
}
});
}
check_interface();
counter=0;
});
</script>

View File

@@ -94,10 +94,13 @@
function check_repositories() {
var url = 'scan.php?op=check_repositories';
jQuery.get(url, function(data) {
if (data!="") {
jQuery("#repositories").html(data);
console.log('check_repositories: '+data);
if (data=="WAIT" || data=="") {
setTimeout(check_repositories, 500);
}
else {
jQuery("#repositories").html(data);
}
else setTimeout(check_repositories, 500);
});
}
@@ -107,6 +110,7 @@ function get_repositories() {
if (data=="OK") {
setTimeout(check_repositories, 500);
}
else alert(data);
});
}
@@ -137,6 +141,7 @@ function get_system() {
if (data=="OK") {
setTimeout(check_system, 1000);
}
else alert(data);
});
}
@@ -296,9 +301,9 @@ function get_containers() {
jQuery(document).ready(function(){
get_deployments();
get_system();
get_repositories();
get_deployments();
get_services();
jQuery('#settings_btn').click(function() {

View File

@@ -29,26 +29,12 @@ switch ($_GET["op"]) {
echo "RedisException caught: " . $e->getMessage();
}
break;
case "check_install":
$arr = check_redis("web_out",$_GET["key"]);
if (!empty($arr)) {
foreach ($arr as $key=>$data) {
//echo $key."-".$_GET["key"];
if ($key==$_GET["key"]) { // if install key moved to web_out
if ($data["INSTALL_STATUS"]>0) {
redis_remove("$key");
echo "INSTALLED";
}
}
}
}
else echo "NOT EXISTS";
break;
case "system":
$arr = array("STATUS" => 0);
$json = json_encode($arr, JSON_UNESCAPED_SLASHES|JSON_PRETTY_PRINT);
if (set_output("system",$json)) echo "OK"; // TODO?
if (set_output("system",$json)) echo "OK";
else echo "ERROR";
break;
case "check_system":
$arr = check_response("system");
@@ -73,13 +59,27 @@ switch ($_GET["op"]) {
}
else echo "WAIT";
break;
case "check_install": // called in install.php - check if install process has finished
$arr = check_response($_GET["key"]); // TODO - replace key with "install", key can be "install*"
if (!empty($arr)) {
foreach ($arr as $key=>$data) {
//echo $key."-".$_GET["key"];
if ($key==$_GET["key"]) { // if install key moved to web_out
if ($data["INSTALL_STATUS"]>0) {
remove_response("$key");
echo "INSTALLED";
}
}
}
}
else echo "NOT EXISTS"; // TODO - check if in progress or just not exists ???
break;
case "services":
$arr = array("STATUS" => 0);
$json = json_encode($arr, JSON_UNESCAPED_SLASHES|JSON_PRETTY_PRINT);
$op = "services"; //"init:".date("YmdHis");
redis_set($op,$json);
echo "OK"; // TODO?
if (set_output("services",$json)) echo "OK";
else echo "ERROR";
break;
case "check_services":
$arr = check_redis("web_out","services");
@@ -131,9 +131,8 @@ switch ($_GET["op"]) {
$arr = array("STATUS" => 0);
$json = json_encode($arr, JSON_UNESCAPED_SLASHES|JSON_PRETTY_PRINT);
$op = "deployments";
redis_set($op,$json);
echo "OK"; // TODO?
if (set_output("deployments",$json)) echo "OK";
else echo "ERROR";
break;
case "check_deployments":
$arr = check_redis("web_out","deployments");
@@ -307,11 +306,11 @@ switch ($_GET["op"]) {
$json = json_encode($arr, JSON_UNESCAPED_SLASHES|JSON_PRETTY_PRINT);
$op = "repositories";
redis_set($op,$json);
echo "OK"; // TODO?
if (set_output("repositories",$json)) echo "OK";
else echo "ERROR";
break;
case "check_repositories":
$arr = check_redis("web_out","repositories");
$arr = check_response("repositories");
if (!empty($arr)) {
foreach ($arr as $key=>$data) {
if ($key=="repositories") {
@@ -319,12 +318,12 @@ switch ($_GET["op"]) {
foreach ($repos->repositories as $repo) {
echo $repo."<br>";
}
redis_remove("$key");
remove_response("$key");
}
}
redis_remove("add_repository");
remove_response("add_repository");
}
else echo "";
else echo "WAIT";
break;
case "add_repository":
redis_remove("add_repository");