mirror of
https://github.com/lucky-sideburn/kubeinvaders.git
synced 2026-08-23 21:46:21 +00:00
fix html
This commit is contained in:
+4
-2
@@ -244,7 +244,7 @@ experiments:
|
||||
</div>
|
||||
<div class="row" style="margin-top: 1%;">
|
||||
<div class="col text-center">
|
||||
<button type="button" style="width: 10em;" id="logConsoleRegex" class="btn btn-sm btn-dark ext-center" onclick="setRedisLogRegex()">Set Regex</button>
|
||||
<button type="button" style="width: 10em;" id="logConsoleRegex" class="btn btn-sm btn-dark ext-center" onclick="setLogRegex()">Set Regex</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
@@ -306,12 +306,14 @@ experiments:
|
||||
$('#alert_placeholder3').replaceWith(alert_div_webtail + 'Stopping log tail</div>');
|
||||
log_tail_switch = false;
|
||||
log_tail_div.style.display = "none";
|
||||
disableLogTail();
|
||||
} else {
|
||||
$('#alert_placeholder3').replaceWith(alert_div_webtail + 'Starting log tail</div>');
|
||||
$("#logConsoleButton").text("Stop Logs Tail");
|
||||
log_tail_switch = true;
|
||||
log_tail_div.style.display = "block";
|
||||
setRedisLogRegex();
|
||||
setLogRegex();
|
||||
enableTail();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+35
-22
@@ -208,34 +208,47 @@ function getCurrentChaosContainer() {
|
||||
oReq.send();
|
||||
}
|
||||
|
||||
function setRedisLogRegex() {
|
||||
$('#alert_placeholder3').replaceWith(alert_div + 'Setting Regular Expression for filtering log source (by pod name)</div>');
|
||||
function enableLogTail() {
|
||||
var oReq = new XMLHttpRequest();
|
||||
oReq.open("POST", "https://" + clu_endpoint + "/kube/chaos/containers?action=enable_logs_tail", true);
|
||||
|
||||
if (log_tail_switch) {
|
||||
var oReq = new XMLHttpRequest();
|
||||
oReq.open("GET", "https://" + clu_endpoint + "/kube/chaos/containers?action=disable_logs_tail", true);
|
||||
oReq.onreadystatechange = function () {
|
||||
if (this.readyState === XMLHttpRequest.DONE && this.status === 200) {
|
||||
$('#alert_placeholder3').replaceWith(alert_div + 'Logs tail started </div>');
|
||||
}
|
||||
};;
|
||||
oReq.setRequestHeader("Content-Type", "application/json");
|
||||
// TODO: send payload for auth...
|
||||
oReq.send({});
|
||||
}
|
||||
|
||||
oReq.onreadystatechange = function () {
|
||||
if (this.readyState === XMLHttpRequest.DONE && this.status === 200) {
|
||||
$('#alert_placeholder3').replaceWith(alert_div + 'Logs tail stopped </div>');
|
||||
}
|
||||
};;
|
||||
function disableLogTail() {
|
||||
var oReq = new XMLHttpRequest();
|
||||
oReq.open("POST", "https://" + clu_endpoint + "/kube/chaos/containers?action=disable_log_tail", true);
|
||||
|
||||
oReq.send()
|
||||
oReq.onreadystatechange = function () {
|
||||
if (this.readyState === XMLHttpRequest.DONE && this.status === 200) {
|
||||
$('#alert_placeholder3').replaceWith(alert_div + 'Logs tail stopped </div>');
|
||||
}
|
||||
};;
|
||||
oReq.setRequestHeader("Content-Type", "application/json");
|
||||
// TODO: send payload for auth...
|
||||
oReq.send({});
|
||||
}
|
||||
|
||||
} else {
|
||||
var oReq = new XMLHttpRequest();
|
||||
oReq.open("POST", "https://" + clu_endpoint + "/kube/chaos/containers?action=enable_logs_tail", true);
|
||||
function setLogRegex() {
|
||||
$('#alert_placeholder3').replaceWith(alert_div + 'Setting regex for filtering log source (by pod name)</div>');
|
||||
var oReq = new XMLHttpRequest();
|
||||
oReq.open("POST", "https://" + clu_endpoint + "/kube/chaos/containers?action=set_log_regex", true);
|
||||
|
||||
oReq.onreadystatechange = function () {
|
||||
if (this.readyState === XMLHttpRequest.DONE && this.status === 200) {
|
||||
$('#alert_placeholder3').replaceWith(alert_div + 'Logs tail started</div>');
|
||||
}
|
||||
};;
|
||||
oReq.onreadystatechange = function () {
|
||||
if (this.readyState === XMLHttpRequest.DONE && this.status === 200) {
|
||||
$('#alert_placeholder3').replaceWith(alert_div + 'Logs tail started</div>');
|
||||
}
|
||||
};;
|
||||
|
||||
oReq.setRequestHeader("Content-Type", "application/json");
|
||||
oReq.send($('#logConsoleRegex').val())
|
||||
}
|
||||
oReq.setRequestHeader("Content-Type", "application/json");
|
||||
oReq.send($('#logConsoleRegex').val());
|
||||
}
|
||||
|
||||
function setChaosContainer() {
|
||||
|
||||
@@ -33,14 +33,19 @@ elseif ngx.var.request_method == "POST" and action == 'set' then
|
||||
red:set("chaos_container", body_data)
|
||||
ngx.say("New chaos container definition has been configured in Redis")
|
||||
return ngx.exit(ngx.status)
|
||||
elseif ngx.var.request_method == "POST" and action == "enable_logs_tail" then
|
||||
|
||||
elseif ngx.var.request_method == "POST" and action == "set_log_regex" then
|
||||
local body_data = ngx.req.get_body_data()
|
||||
red:set("log_pod_regex", body_data)
|
||||
red:set("logs_enabled", "1")
|
||||
ngx.say("New container definition has been saved in Redis")
|
||||
return ngx.exit(ngx.status)
|
||||
elseif ngx.var.request_method == "GET" and action == "disable_logs_tail" then
|
||||
|
||||
elseif ngx.var.request_method == "POST" and action == "enable_logs_tail" then
|
||||
local body_data = ngx.req.get_body_data()
|
||||
red:set("logs_enabled", "1")
|
||||
return ngx.exit(ngx.status)
|
||||
|
||||
elseif ngx.var.request_method == "POST" and action == "disable_logs_tail" then
|
||||
red:set("logs_enabled", "0")
|
||||
ngx.say("New container definition has been saved in Redis")
|
||||
return ngx.exit(ngx.status)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user