// dla IE8, i tak ostatecznie nie wspierany;
if(typeof console === "undefined" || typeof console.log === "undefined") { console.log = function() {}; }
function MyCustomConfirmBox(title, message, btn_cancel, btn_ok, callback_ok, callback_cancel) {
var dialog = bootbox.dialog({
title: title,
message: message,
closeButton: true,
buttons: {
cancel: {
label: btn_cancel,
callback: callback_cancel
},
confirm: {
label: btn_ok,
callback: callback_ok
}
},
});
dialog.find('.modal-content').css({
'margin-top': '45%',
'top': '45%'
});
}
function MyCustomRebootInfo() {
var dialog = bootbox.dialog({
title: "Konfiguracja zapisana / Configuration saved",
closeButton: false,
message: '
Wysyłanie żądania restartu urządzenia / Requesting device restart ..
\
\
\
'
});
dialog.find('.modal-content').css({
'margin-top': '45%',
'top': '45%'
});
$(document).ready(function () {
window.setTimeout(function () { location.href = "/"; }, 35000);
});
$.ajax({
url: "/reboot",
context: document.body,
complete: function(jqXHR, textStatus) {
console.log("reboot req: complete: " + textStatus);
if(textStatus == "success") {
$("#id_reboot_info_msg").text("Urządzenie restartuje się / Device is restarting ..");
} else {
$("#id_reboot_info_msg").text("Nie udało się wywołać restartu / Device restart failed");
}
}
});
}
function MyGenPopoverContent(fwver, build, hw, mac, other) {
let content = '\
fw ver: | ' + fwver + ' |
\
build: | ' + build + ' |
\
hw: | ' + hw + ' |
\
mac: | ' + mac + ' |
'
let j = JSON.parse(other)
if(j.length > 0) {
content += '
|
';
j.forEach(el => {
let key;
for(let k in el) { key = k; break; }
console.log(key, el[key]);
content += '' + key + ': | ' + el[key] + ' |
';
});
}
content += '
';
return { placement : 'bottom', html: true, content: content }
}