From 9e7658389f5de4f6c327ada7ac0d6c92984590d4 Mon Sep 17 00:00:00 2001 From: Haitao Pan Date: Tue, 17 Mar 2026 19:54:03 +0800 Subject: [PATCH] Tighten homepage navigation layout --- files/grafana/homepage.json | 132 ++++++++++++++++-------------------- merge_dashboards.py | 78 ++++++++++----------- 2 files changed, 93 insertions(+), 117 deletions(-) diff --git a/files/grafana/homepage.json b/files/grafana/homepage.json index 61ff255..7ecf11b 100644 --- a/files/grafana/homepage.json +++ b/files/grafana/homepage.json @@ -91,35 +91,19 @@ "type": "text", "title": "\u603b\u89c8\u5bfc\u822a", "gridPos": { - "h": 3, + "h": 5, "w": 24, "x": 0, "y": 0 }, "transparent": true, "options": { - "content": "\n
\n
\n
Platform Engineering Home
\n
\u5e73\u53f0\u5de5\u7a0b\u603b\u89c8\u5165\u53e3
\n
\u9996\u9875\u53ea\u4fdd\u7559\u5168\u5c40\u8109\u640f\u3001\u8d44\u6e90\u57df\u6458\u8981\u4e0e\u8df3\u8f6c\uff0c\u8be6\u7ec6\u660e\u7ec6\u7edf\u4e00\u4e0b\u6c89\u5230\u4e8c\u7ea7 dashboard\u3002
\n
\n
\n IAAS\u8d44\u6e90\n PaaS\u670d\u52a1\n \u4e1a\u52a1\u5355\u5143\n
\n
\n", + "content": "\n
\n
\n
\n
Platform Engineering Home
\n
\u5e73\u53f0\u5de5\u7a0b\u603b\u89c8\u5165\u53e3
\n
\u6309 IaaS\u3001PaaS\u3001SaaS \u9010\u5c42\u4e0b\u94bb\uff0c\u9996\u9875\u53ea\u4fdd\u7559\u5165\u53e3\u4e0e\u5168\u5c40\u8109\u640f\u3002
\n
\n
IaaS \u2192 PaaS \u2192 SaaS
\n
\n
\n
\n
\n
IaaS\u8d44\u6e90
\n
\u8ba1\u7b97 / \u5b58\u50a8 / \u7f51\u7edc
\n
\n
\n
\n
\n
PaaS\u670d\u52a1
\n
\u63a7\u5236\u9762 / \u96c6\u7fa4 / DB / \u7f13\u5b58
\n
\n
\n
\n
\n
\u4e1a\u52a1\u76d1\u63a7
\n
\u4ee3\u7406 / \u8bf7\u6c42
\n
\n
\n
\n
\n", "mode": "html" } }, { "id": 2, - "type": "text", - "title": "\u7ed3\u6784\u8bf4\u660e", - "gridPos": { - "h": 5, - "w": 24, - "x": 0, - "y": 3 - }, - "transparent": true, - "options": { - "content": "\n
\n
\n
IAAS\u8d44\u6e90
\n
\u8ba1\u7b97 / \u5b58\u50a8 / \u7f51\u7edc
\n
\u5148\u770b\u5bbf\u4e3b\u3001\u78c1\u76d8\u3001VIP \u4e0e\u5e95\u5c42\u8d44\u6e90\u662f\u5426\u5065\u5eb7\u3002
\n
\n
\n
PaaS\u670d\u52a1
\n
\u63a7\u5236\u9762 / \u96c6\u7fa4 / DB / \u7f13\u5b58
\n
\u5e73\u53f0\u81ea\u8eab\u4e0e\u5171\u4eab\u670d\u52a1\u6309\u8d44\u6e90\u57df\u7a33\u5b9a\u5206\u5c42\u3002
\n
\n
\n
\u4e1a\u52a1\u5355\u5143
\n
\u4ee3\u7406 / \u8bf7\u6c42
\n
\u4e1a\u52a1\u63a5\u5165\u9762\u4e0e\u8bf7\u6c42\u89c2\u6d4b\u5355\u72ec\u6536\u53e3\uff0c\u4e0d\u518d\u6df7\u5728\u5e95\u5c42\u8d44\u6e90\u91cc\u3002
\n
\n
\n", - "mode": "html" - } - }, - { - "id": 3, "type": "row", "title": "\u5e73\u53f0\u8109\u640f", "collapsed": false, @@ -128,7 +112,7 @@ "h": 1, "w": 24, "x": 0, - "y": 8 + "y": 5 } }, { @@ -332,11 +316,11 @@ }, "gridPos": { "x": 0, - "y": 4, + "y": 6, "w": 4, - "h": 7 + "h": 6 }, - "id": 4, + "id": 3, "links": [ { "title": "Pigsty Docs", @@ -750,11 +734,11 @@ }, "gridPos": { "x": 4, - "y": 4, + "y": 6, "w": 4, - "h": 7 + "h": 6 }, - "id": 5, + "id": 4, "links": [ { "targetBlank": true, @@ -1525,11 +1509,11 @@ }, "gridPos": { "x": 8, - "y": 4, + "y": 6, "w": 8, - "h": 7 + "h": 6 }, - "id": 6, + "id": 5, "options": { "colorMode": "background", "graphMode": "area", @@ -1904,11 +1888,11 @@ }, "gridPos": { "x": 16, - "y": 4, + "y": 6, "w": 8, - "h": 7 + "h": 6 }, - "id": 7, + "id": 6, "options": { "legend": { "calcs": [ @@ -1956,7 +1940,7 @@ "type": "timeseries" }, { - "id": 8, + "id": 7, "type": "row", "title": "IAAS\u8d44\u6e90", "collapsed": false, @@ -1965,18 +1949,18 @@ "h": 1, "w": 24, "x": 0, - "y": 16 + "y": 12 } }, { - "id": 9, + "id": 8, "type": "text", "title": "\u8ba1\u7b97\u6458\u8981", "gridPos": { "h": 5, "w": 8, "x": 0, - "y": 17 + "y": 13 }, "transparent": true, "options": { @@ -1985,14 +1969,14 @@ } }, { - "id": 10, + "id": 9, "type": "text", "title": "\u5b58\u50a8\u6458\u8981", "gridPos": { "h": 5, "w": 8, "x": 8, - "y": 17 + "y": 13 }, "transparent": true, "options": { @@ -2001,14 +1985,14 @@ } }, { - "id": 11, + "id": 10, "type": "text", "title": "\u7f51\u7edc\u6458\u8981", "gridPos": { "h": 5, "w": 8, "x": 16, - "y": 17 + "y": 13 }, "transparent": true, "options": { @@ -2017,7 +2001,7 @@ } }, { - "id": 12, + "id": 11, "type": "dashlist", "title": "\u8ba1\u7b97\u76ee\u5f55", "pluginVersion": "12.3.0", @@ -2025,7 +2009,7 @@ "h": 9, "w": 8, "x": 0, - "y": 22 + "y": 18 }, "options": { "includeVars": true, @@ -2043,7 +2027,7 @@ } }, { - "id": 13, + "id": 12, "type": "dashlist", "title": "\u5b58\u50a8\u76ee\u5f55", "pluginVersion": "12.3.0", @@ -2051,7 +2035,7 @@ "h": 9, "w": 8, "x": 8, - "y": 22 + "y": 18 }, "options": { "includeVars": true, @@ -2069,7 +2053,7 @@ } }, { - "id": 14, + "id": 13, "type": "dashlist", "title": "\u7f51\u7edc\u76ee\u5f55", "pluginVersion": "12.3.0", @@ -2077,7 +2061,7 @@ "h": 8, "w": 8, "x": 16, - "y": 22 + "y": 18 }, "options": { "includeVars": true, @@ -2095,7 +2079,7 @@ } }, { - "id": 15, + "id": 14, "type": "row", "title": "PaaS\u670d\u52a1", "collapsed": false, @@ -2104,18 +2088,18 @@ "h": 1, "w": 24, "x": 0, - "y": 31 + "y": 27 } }, { - "id": 16, + "id": 15, "type": "text", "title": "\u5e73\u53f0\u63a7\u5236\u9762\u6458\u8981", "gridPos": { "h": 5, "w": 6, "x": 0, - "y": 32 + "y": 28 }, "transparent": true, "options": { @@ -2124,14 +2108,14 @@ } }, { - "id": 17, + "id": 16, "type": "text", "title": "\u96c6\u7fa4\u6458\u8981", "gridPos": { "h": 5, "w": 6, "x": 6, - "y": 32 + "y": 28 }, "transparent": true, "options": { @@ -2140,14 +2124,14 @@ } }, { - "id": 18, + "id": 17, "type": "text", "title": "DB\u6458\u8981", "gridPos": { "h": 5, "w": 6, "x": 12, - "y": 32 + "y": 28 }, "transparent": true, "options": { @@ -2156,14 +2140,14 @@ } }, { - "id": 19, + "id": 18, "type": "text", "title": "\u7f13\u5b58\u6458\u8981", "gridPos": { "h": 5, "w": 6, "x": 18, - "y": 32 + "y": 28 }, "transparent": true, "options": { @@ -2172,7 +2156,7 @@ } }, { - "id": 20, + "id": 19, "type": "dashlist", "title": "\u5e73\u53f0\u63a7\u5236\u9762\u76ee\u5f55", "pluginVersion": "12.3.0", @@ -2180,7 +2164,7 @@ "h": 10, "w": 6, "x": 0, - "y": 37 + "y": 33 }, "options": { "includeVars": true, @@ -2198,7 +2182,7 @@ } }, { - "id": 21, + "id": 20, "type": "dashlist", "title": "\u96c6\u7fa4\u76ee\u5f55", "pluginVersion": "12.3.0", @@ -2206,7 +2190,7 @@ "h": 8, "w": 6, "x": 6, - "y": 37 + "y": 33 }, "options": { "includeVars": true, @@ -2224,7 +2208,7 @@ } }, { - "id": 22, + "id": 21, "type": "dashlist", "title": "DB\u76ee\u5f55", "pluginVersion": "12.3.0", @@ -2232,7 +2216,7 @@ "h": 14, "w": 6, "x": 12, - "y": 37 + "y": 33 }, "options": { "includeVars": true, @@ -2250,7 +2234,7 @@ } }, { - "id": 23, + "id": 22, "type": "dashlist", "title": "\u7f13\u5b58\u76ee\u5f55", "pluginVersion": "12.3.0", @@ -2258,7 +2242,7 @@ "h": 9, "w": 6, "x": 18, - "y": 37 + "y": 33 }, "options": { "includeVars": true, @@ -2276,27 +2260,27 @@ } }, { - "id": 24, + "id": 23, "type": "row", - "title": "\u4e1a\u52a1\u5355\u5143", + "title": "\u4e1a\u52a1\u76d1\u63a7", "collapsed": false, "panels": [], "gridPos": { "h": 1, "w": 24, "x": 0, - "y": 51 + "y": 47 } }, { - "id": 25, + "id": 24, "type": "text", "title": "\u4ee3\u7406\u6458\u8981", "gridPos": { "h": 5, "w": 12, "x": 0, - "y": 52 + "y": 48 }, "transparent": true, "options": { @@ -2305,14 +2289,14 @@ } }, { - "id": 26, + "id": 25, "type": "text", "title": "\u8bf7\u6c42\u6458\u8981", "gridPos": { "h": 5, "w": 12, "x": 12, - "y": 52 + "y": 48 }, "transparent": true, "options": { @@ -2321,7 +2305,7 @@ } }, { - "id": 27, + "id": 26, "type": "dashlist", "title": "\u4ee3\u7406\u76ee\u5f55", "pluginVersion": "12.3.0", @@ -2329,7 +2313,7 @@ "h": 8, "w": 12, "x": 0, - "y": 57 + "y": 53 }, "options": { "includeVars": true, @@ -2347,7 +2331,7 @@ } }, { - "id": 28, + "id": 27, "type": "dashlist", "title": "\u8bf7\u6c42\u76ee\u5f55", "pluginVersion": "12.3.0", @@ -2355,7 +2339,7 @@ "h": 9, "w": 12, "x": 12, - "y": 57 + "y": 53 }, "options": { "includeVars": true, diff --git a/merge_dashboards.py b/merge_dashboards.py index b4a191b..c8362f0 100644 --- a/merge_dashboards.py +++ b/merge_dashboards.py @@ -103,7 +103,7 @@ DOMAIN_SECTIONS = [ ], }, { - "title": "业务单元", + "title": "业务监控", "items": [ { "title": "代理", @@ -209,38 +209,34 @@ def summary_card_html(item): def homepage_nav_html(): return """ -
-
-
Platform Engineering Home
-
平台工程总览入口
-
首页只保留全局脉搏、资源域摘要与跳转,详细明细统一下沉到二级 dashboard。
+
+
+
+
Platform Engineering Home
+
平台工程总览入口
+
按 IaaS、PaaS、SaaS 逐层下钻,首页只保留入口与全局脉搏。
+
+
IaaS → PaaS → SaaS
-
- IAAS资源 - PaaS服务 - 业务单元 -
-
-""" - - -def homepage_guide_html(): - return """ -
-
-
IAAS资源
-
计算 / 存储 / 网络
-
先看宿主、磁盘、VIP 与底层资源是否健康。
-
-
-
PaaS服务
-
控制面 / 集群 / DB / 缓存
-
平台自身与共享服务按资源域稳定分层。
-
-
-
业务单元
-
代理 / 请求
-
业务接入面与请求观测单独收口,不再混在底层资源里。
+
+
+
+
IaaS资源
+
计算 / 存储 / 网络
+
+
+
+
+
PaaS服务
+
控制面 / 集群 / DB / 缓存
+
+
+
+
+
业务监控
+
代理 / 请求
+
+
""" @@ -324,24 +320,20 @@ def merge_dashboards(): panel_id = 1 homepage["panels"].append( - make_text_panel(panel_id, "总览导航", homepage_nav_html(), 0, 0, 24, 3) - ) - panel_id += 1 - homepage["panels"].append( - make_text_panel(panel_id, "结构说明", homepage_guide_html(), 0, 3, 24, 5) + make_text_panel(panel_id, "总览导航", homepage_nav_html(), 0, 0, 24, 5) ) panel_id += 1 - current_y = 8 + current_y = 5 homepage["panels"].append(make_row_panel(panel_id, "平台脉搏", current_y)) panel_id += 1 current_y += 1 summary_layout = [ - ("Pigsty ${version}", 0, 4, 4, 7), - ("Modules", 4, 4, 4, 7), - ("Instances", 8, 4, 8, 7), - ("Firing Alerts", 16, 4, 8, 7), + ("Pigsty ${version}", 0, 6, 4, 6), + ("Modules", 4, 6, 4, 6), + ("Instances", 8, 6, 8, 6), + ("Firing Alerts", 16, 6, 8, 6), ] summary_panels = {panel.get("title"): panel for panel in select_platform_summary_panels(control_plane)} for title, x, y, w, h in summary_layout: @@ -349,7 +341,7 @@ def merge_dashboards(): continue homepage["panels"].append(clone_panel(summary_panels[title], x, y, w, h)) panel_id += 1 - current_y += 7 + current_y += 6 for section in DOMAIN_SECTIONS: panel_id, current_y = add_domain_section(homepage, panel_id, current_y, section)