[Web] load public ip on click and add curl timeout
This commit is contained in:
@@ -51,7 +51,40 @@ $(document).ready(function() {
|
||||
showVersionModal("Version " + mailcow_info.version_tag, mailcow_info.version_tag);
|
||||
})
|
||||
// get public ips
|
||||
get_public_ips();
|
||||
$("#host_show_ip").click(function(){
|
||||
$("#host_show_ip").find(".text").addClass("d-none");
|
||||
$("#host_show_ip").find(".spinner-border").removeClass("d-none");
|
||||
|
||||
window.fetch("/api/v1/get/status/host/ip", { method:'GET', cache:'no-cache' }).then(function(response) {
|
||||
return response.json();
|
||||
}).then(function(data) {
|
||||
console.log(data);
|
||||
|
||||
// display host ips
|
||||
if (data.ipv4)
|
||||
$("#host_ipv4").text(data.ipv4);
|
||||
if (data.ipv6)
|
||||
$("#host_ipv6").text(data.ipv6);
|
||||
|
||||
$("#host_show_ip").addClass("d-none");
|
||||
$("#host_show_ip").find(".text").removeClass("d-none");
|
||||
$("#host_show_ip").find(".spinner-border").addClass("d-none");
|
||||
$("#host_ipv4").removeClass("d-none");
|
||||
$("#host_ipv6").removeClass("d-none");
|
||||
$("#host_ipv6").removeClass("text-danger");
|
||||
$("#host_ipv4").addClass("d-block");
|
||||
$("#host_ipv6").addClass("d-block");
|
||||
}).catch(function(error){
|
||||
console.log(error);
|
||||
|
||||
$("#host_ipv6").removeClass("d-none");
|
||||
$("#host_ipv6").addClass("d-block");
|
||||
$("#host_ipv6").addClass("text-danger");
|
||||
$("#host_ipv6").text(lang_debug.error_show_ip);
|
||||
$("#host_show_ip").find(".text").removeClass("d-none");
|
||||
$("#host_show_ip").find(".spinner-border").addClass("d-none");
|
||||
});
|
||||
});
|
||||
update_container_stats();
|
||||
});
|
||||
jQuery(function($){
|
||||
@@ -1224,20 +1257,6 @@ function update_container_stats(timeout=5){
|
||||
// run again in n seconds
|
||||
setTimeout(update_container_stats, timeout * 1000);
|
||||
}
|
||||
// get public ips
|
||||
function get_public_ips(){
|
||||
window.fetch("/api/v1/get/status/host/ip", {method:'GET',cache:'no-cache'}).then(function(response) {
|
||||
return response.json();
|
||||
}).then(function(data) {
|
||||
console.log(data);
|
||||
|
||||
// display host ips
|
||||
if (data.ipv4)
|
||||
$("#host_ipv4").text(data.ipv4);
|
||||
if (data.ipv6)
|
||||
$("#host_ipv6").text(data.ipv6);
|
||||
});
|
||||
}
|
||||
// format hosts uptime seconds to readable string
|
||||
function formatUptime(seconds){
|
||||
seconds = Number(seconds);
|
||||
|
Reference in New Issue
Block a user