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

This commit is contained in:
root
2024-08-21 13:24:01 +02:00
parent 214c6f89ec
commit 85b9b4baea
2 changed files with 71 additions and 0 deletions

View File

@@ -16,6 +16,32 @@
<h1>Found deployed envinronment</h1>
<div style="text-align:right">
<a href="javascript:void()" id="settings_btn">SETTINGS</a>
</div>
<fieldset id="settings" class="hidden">
<legend>Settings</legend>
<div id="repositories" style="text-align:left">Loading...</div>
<form class="form-install" action="#" method="post">
<div class="row">
<div class="mb-3">
<label for="registry">Please add a new repository name:</label>
<input type="registry" class="form-control" name="repository" id="repository" value="" required>
<div class="invalid-feedback">
Please enter a valid repository name.
</div>
</div>
</div>
<div class="row">
<div class="mb-3">
<button class="btn btn-lg btn-primary btn-block" type="button"> Send </button>
</div>
</div>
</form>
</fieldset>
<fieldset>
<legend>Deployments</legend>
<div id="deployments" style="text-align:left">Loading...</div>
@@ -44,6 +70,24 @@
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.14.6/dist/umd/popper.min.js" integrity="sha384-wHAiFfRlMFy6i5SRaxvfOCifBUQy1xHdJ/yoi7FRNXMRBu5WHdZYu1hA6ZOblgut" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.2.1/dist/js/bootstrap.min.js" integrity="sha384-B0UglyR+jN6CkvvICOB2joaf5I4l3gm9GU6Hc1og6Ls7i6U/mkkaduKaBhlAXv9k" crossorigin="anonymous"></script>
<script>
function check_repositories() {
var url = 'scan.php?op=check_repositories';
jQuery.get(url, function(data) {
if (data!="") {
jQuery("#repositories").html(data);
}
else setTimeout(check_repositories, 500);
});
}
function get_repositories() {
var url = 'scan.php?op=repositories';
jQuery.get(url, function(data) {
if (data=="OK") {
setTimeout(check_repositories, 500);
}
});
}
function check_deployments() {
var url = 'scan.php?op=check_init&services=1';
@@ -85,9 +129,14 @@ function get_containers() {
jQuery(document).ready(function(){
get_repositories();
get_deployments();
get_containers();
jQuery('#settings_btn').click(function() {
jQuery('#settings').toggle();
});
jQuery('select#smarthost').click(function() {
if (jQuery(this).val()=='yes') jQuery('#div_smarthost').show();
else jQuery('#div_smarthost').hide();
@@ -100,6 +149,7 @@ jQuery(document).ready(function(){
if (jQuery(this).val()=='yes') jQuery('#div_vpn').show();
else jQuery('#div_vpn').hide();
});
/*
jQuery('select#discovery').click(function() {
if (jQuery(this).val()=='yes') jQuery('#div_discover').show();
else jQuery('#div_discover').hide();
@@ -132,6 +182,7 @@ jQuery(document).ready(function(){
if (jQuery(this).val()=='Y') jQuery('#div_roundcube').show();
else jQuery('#div_roundcube').hide();
});
*/
});
</script>
</body>

View File

@@ -28,6 +28,26 @@ switch ($_GET["op"]) {
}
else echo "NOT EXISTS";
break;
case "repositories":
$arr = array("STATUS" => 0);
$json = json_encode($arr, JSON_UNESCAPED_SLASHES|JSON_PRETTY_PRINT);
$op = "repositories";
redis_set($op,$json);
echo "OK"; // TODO?
case "check_repositories":
$arr = check_redis("web_out","repositories");
if (!empty($arr)) {
foreach ($arr as $key=>$data) {
if ($key=="repositories") {
echo base64_decode($data["RESULT"]);
redis_remove("$key");
}
}
}
else echo "";
break;
case "init":
$arr = array("STATUS" => 0);
$json = json_encode($arr, JSON_UNESCAPED_SLASHES|JSON_PRETTY_PRINT);