import cockpit from "cockpit";
function init_1() {
return (cockpit.spawn(["hostname"])
.then(data => {
document.getElementById("host").innerText = data.trim();
}));
}
function init_2() {
return (cockpit.file("/etc/os-release").read()
.then(data => {
document.getElementById("release").innerText = data;
}));
}
function navigate() {
document.getElementById("path").innerText = cockpit.location.path.join("/");
document.body.removeAttribute("hidden");
}
function maybe_phase_2() {
cockpit.removeEventListener("visibilitychange", maybe_phase_2);
if (cockpit.hidden) {
cockpit.addEventListener("visibilitychange", maybe_phase_2);
} else {
init_2().then(navigate);
}
}
function init() {
init_1().then(maybe_phase_2);
}
document.addEventListener("DOMContentLoaded", init);