Compare commits
2 Commits
db1d4e0cdb
...
6c88bf8899
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6c88bf8899 | ||
|
|
ab24ff9cdb |
@ -26,12 +26,18 @@ def _repo_root() -> Path:
|
|||||||
|
|
||||||
|
|
||||||
def register(api):
|
def register(api):
|
||||||
"""Wire umbrella panel + APIs."""
|
"""Wire umbrella panel + APIs.
|
||||||
|
|
||||||
|
Note: the panel HTML lives at /plugins/svrnty/umbrella.html (served via
|
||||||
|
register_static). The /umbrella top-level route would require a non-/api/
|
||||||
|
handler, which the plugin loader doesn't allow (see SVRNTY-PLUGIN-PROTOCOL
|
||||||
|
§5.1 — register_route only accepts /api/*). Frontend nav links directly to
|
||||||
|
/plugins/svrnty/umbrella.html.
|
||||||
|
"""
|
||||||
log = api.logger("svrnty.routes.umbrella")
|
log = api.logger("svrnty.routes.umbrella")
|
||||||
api.register_route("/umbrella", "GET", _handle_panel_html)
|
|
||||||
api.register_route("/api/umbrella", "GET", _handle_graph_json)
|
api.register_route("/api/umbrella", "GET", _handle_graph_json)
|
||||||
api.register_route("/api/umbrella/doc", "GET", _handle_doc_body)
|
api.register_route("/api/umbrella/doc", "GET", _handle_doc_body)
|
||||||
log.info("umbrella panel + APIs registered")
|
log.info("umbrella APIs registered")
|
||||||
|
|
||||||
|
|
||||||
def _send(handler, status: int, body: bytes, content_type: str) -> None:
|
def _send(handler, status: int, body: bytes, content_type: str) -> None:
|
||||||
@ -101,11 +107,3 @@ def _handle_doc_body(handler, parsed) -> bool:
|
|||||||
}).encode("utf-8")
|
}).encode("utf-8")
|
||||||
_send(handler, 200, body, "application/json; charset=utf-8")
|
_send(handler, 200, body, "application/json; charset=utf-8")
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
def _handle_panel_html(handler, parsed) -> bool:
|
|
||||||
"""Serve the static umbrella.html via Location redirect (assets live in static/)."""
|
|
||||||
handler.send_response(302)
|
|
||||||
handler.send_header("Location", "/plugins/svrnty/umbrella.html")
|
|
||||||
handler.end_headers()
|
|
||||||
return True
|
|
||||||
|
|||||||
@ -154,10 +154,17 @@
|
|||||||
_activateTab(id);
|
_activateTab(id);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
// Cross-panel link to BTE Command Center.
|
// Cross-panel link to BTE Command Center. Route through canonical
|
||||||
|
// switchPanel so main.svrnty-showing-bte class gets flipped (CSS gates
|
||||||
|
// overlay visibility on that class). SvrntyBTE.open is fallback for
|
||||||
|
// the early-boot edge case where the nav wrapper isn't installed yet.
|
||||||
const bteBtn = panel.querySelector("#svrntyAwOpenBte");
|
const bteBtn = panel.querySelector("#svrntyAwOpenBte");
|
||||||
if (bteBtn) bteBtn.addEventListener("click", () => {
|
if (bteBtn) bteBtn.addEventListener("click", () => {
|
||||||
if (window.SvrntyBTE && window.SvrntyBTE.open) window.SvrntyBTE.open();
|
if (typeof window.switchPanel === "function") {
|
||||||
|
window.switchPanel("bte", { fromRailClick: true });
|
||||||
|
} else if (window.SvrntyBTE && window.SvrntyBTE.open) {
|
||||||
|
window.SvrntyBTE.open();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
// One-click profile switch to cmo-planb.
|
// One-click profile switch to cmo-planb.
|
||||||
const switchBtn = panel.querySelector("#svrntyAwSwitchCmo");
|
const switchBtn = panel.querySelector("#svrntyAwSwitchCmo");
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user