Mount Cortex OS Runtime Health as WebUI panel
This commit is contained in:
@@ -9,6 +9,10 @@
|
||||
font: 14px/1.45 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
|
||||
}
|
||||
|
||||
main.main:not(.svrnty-showing-cortex-os) .cortex-os-runtime-health {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.cortex-os-runtime-health h2 {
|
||||
margin: 0 0 8px;
|
||||
font-size: 15px;
|
||||
|
||||
@@ -42,7 +42,10 @@
|
||||
panel.appendChild(summary);
|
||||
panel.appendChild(list);
|
||||
|
||||
var target = document.querySelector("main") || document.body;
|
||||
var target = document.querySelector("main.main");
|
||||
if (!target) {
|
||||
return panel;
|
||||
}
|
||||
target.appendChild(panel);
|
||||
return panel;
|
||||
}
|
||||
@@ -99,9 +102,17 @@
|
||||
});
|
||||
}
|
||||
|
||||
if (document.readyState === "loading") {
|
||||
document.addEventListener("DOMContentLoaded", loadRuntimeHealth, { once: true });
|
||||
} else {
|
||||
function handlePanelSwitch(event) {
|
||||
var detail = (event && event.detail) || {};
|
||||
if (detail.name === "cortex-os") {
|
||||
loadRuntimeHealth();
|
||||
}
|
||||
}
|
||||
|
||||
window.addEventListener("svrnty:panel-switch", handlePanelSwitch);
|
||||
|
||||
var main = document.querySelector("main.main");
|
||||
if (main && main.classList.contains("svrnty-showing-cortex-os")) {
|
||||
loadRuntimeHealth();
|
||||
}
|
||||
})();
|
||||
|
||||
Reference in New Issue
Block a user