diff --git a/0001-fix-web-page-404-bug.patch b/0001-fix-web-page-404-bug.patch new file mode 100644 index 0000000000000000000000000000000000000000..245266d48dfa5733876602b58dbf10d70a606bc5 --- /dev/null +++ b/0001-fix-web-page-404-bug.patch @@ -0,0 +1,55 @@ +From 501fe6ed3af8a918961ca3d727b84d83981fee39 Mon Sep 17 00:00:00 2001 +From: Wangjunqi123 +Date: Mon, 10 Mar 2025 17:26:08 +0800 +Subject: [PATCH] fix web page 404 bug + +--- + README.md | 2 +- + main.go | 4 +--- + 2 files changed, 2 insertions(+), 4 deletions(-) + +diff --git a/README.md b/README.md +index 0fbc296..3619e0d 100644 +--- a/README.md ++++ b/README.md +@@ -27,7 +27,7 @@ PilotGo grafana plugin maintains grafana to provide beautiful visual monitoring + grafana_server:addr为安装grafana地址; + >cd PilotGo-plugin-grafana + >go run main.go +-5. 将grafana插件服务注册到PilotGo平台 [插件管理] -> [添加插件] -> 插件名称:grafana;插件地址:http://ip:端口(默认9999) -> [启用插件] 启用成功,即可在PilotGo平台查看grafana插件看板;若启动失败,通过 /opt/PilotGo/plugin/grafana/log 查看插件报错原因。 ++5. 将grafana插件服务注册到PilotGo平台 [插件管理] -> [添加插件] -> 插件名称:grafana;插件地址:http://ip:port/plugin/grafana(默认9999) -> [启用插件] 启用成功,即可在PilotGo平台查看grafana插件看板;若启动失败,通过 /opt/PilotGo/plugin/grafana/log 查看插件报错原因。 + + #### 使用说明 + +diff --git a/main.go b/main.go +index a4f7c26..7f3645e 100644 +--- a/main.go ++++ b/main.go +@@ -5,7 +5,6 @@ import ( + "net/http/httputil" + "net/url" + "os" +- "strings" + + "gitee.com/openeuler/PilotGo/sdk/common" + "gitee.com/openeuler/PilotGo/sdk/logger" +@@ -44,7 +43,7 @@ func main() { + + // 添加扩展点 + var ex []common.Extention +- me1 := &common.MachineExtention{ ++ me1 := &common.PageExtention{ + Type: common.ExtentionPage, + Name: "plugin-grafana", + URL: "/plugin/grafana", +@@ -89,7 +88,6 @@ func ReverseProxyHandler(c *gin.Context) { + } + + proxy := httputil.NewSingleHostReverseProxy(target) +- c.Request.URL.Path = strings.Replace(c.Request.URL.Path, "/plugin/grafana", "", 1) //请求API + + // proxy.ModifyResponse = func(r *http.Response) error { + // if setCookie := r.Header.Get("Set-Cookie"); setCookie != "" { +-- +2.25.1 + diff --git a/PilotGo-plugin-grafana.spec b/PilotGo-plugin-grafana.spec index 2cc3bb963c0f3cb1ba83132f944311ffef4fae3a..a4362bd26348e262d9ebc4af39a93be69ee2a19e 100644 --- a/PilotGo-plugin-grafana.spec +++ b/PilotGo-plugin-grafana.spec @@ -2,12 +2,13 @@ Name: PilotGo-plugin-grafana Version: 1.1.0 -Release: 2 +Release: 3 Summary: PilotGo grafana plugin maintains grafana to provide beautiful visual monitoring interface. License: MulanPSL-2.0 URL: https://gitee.com/openeuler/PilotGo-plugin-grafana Source0: https://gitee.com/openeuler/PilotGo-plugin-grafana/repository/archive/v%{version}.tar.gz Patch0: Add-extention-of-grafana.patch +Patch1: 0001-fix-web-page-404-bug.patch BuildRequires: systemd BuildRequires: golang @@ -20,6 +21,7 @@ PilotGo grafana plugin maintains grafana to provide beautiful visual monitoring %prep %setup -n %{name}-v%{version} %patch 0 -p1 +%patch 1 -p1 %build GO111MODULE=on go build -mod=vendor -o PilotGo-plugin-grafana main.go @@ -50,6 +52,9 @@ fi %{_unitdir}/PilotGo-plugin-grafana.service %changelog +* Mon Mar 10 2025 wangjunqi - 1.1.0-3 +- fix web page 404 bug + * Wed May 15 2024 jianxinyu - 1.1.0-2 - Solve the problem of missing grafana extension