You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by wu...@apache.org on 2026/05/20 09:00:29 UTC
(skywalking-horizon-ui) 02/02: bff: menu falls back to bundled templates when OAP is unreachable
This is an automated email from the ASF dual-hosted git repository.
wu-sheng pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/skywalking-horizon-ui.git
commit 8a00c6ec1065c6f1c7a1271aa63adb25c428dd57
Author: Wu Sheng <wu...@foxmail.com>
AuthorDate: Wed May 20 17:00:20 2026 +0800
bff: menu falls back to bundled templates when OAP is unreachable
/api/menu returned an empty layer list when the OAP query failed, so the
sidebar lost all layer navigation whenever OAP was down. Build the layer
list from the bundled layer templates (allLayerTemplates) in the catch
path — same deriveLayer as the live path, with serviceCount -1 (unknown)
and active=false. The operator keeps full navigation offline; each page
still surfaces its own OAP-down state. RBAC menu gating applies equally
to the fallback (it's the same LayerDef shape + verbs).
---
apps/bff/src/http/query/menu.ts | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/apps/bff/src/http/query/menu.ts b/apps/bff/src/http/query/menu.ts
index 2eae4d0..a122fc5 100644
--- a/apps/bff/src/http/query/menu.ts
+++ b/apps/bff/src/http/query/menu.ts
@@ -314,8 +314,22 @@ export function registerMenuRoute(app: FastifyInstance, deps: MenuRouteDeps): vo
};
return reply.send(body);
} catch (err) {
+ // OAP unreachable — fall back to the bundled layer templates so the
+ // sidebar still renders navigation (each page surfaces its own
+ // OAP-down state). Service counts are unknown (-1) and layers are
+ // marked inactive; everything else (alias / color / slots / caps)
+ // comes from the template, exactly like the live path.
+ const HIDDEN_LAYERS = new Set(['BANYANDB']);
+ const seen = new Set<string>();
+ const layers: LayerDef[] = [];
+ for (const tpl of allLayerTemplates()) {
+ const key = canonical(tpl.key.toUpperCase());
+ if (seen.has(key) || HIDDEN_LAYERS.has(key)) continue;
+ seen.add(key);
+ layers.push(deriveLayer(key, false, null, -1, null));
+ }
const body: MenuResponse = {
- layers: [],
+ layers,
generatedAt: Date.now(),
oap: {
reachable: false,