From 423aded52876c6f9c7294a253f1bcfef5f02e400 Mon Sep 17 00:00:00 2001 From: amh1k Date: Sun, 13 Sep 2026 14:56:22 +0500 Subject: [PATCH] feat: add performance benchmark sidebar Signed-off-by: amh1k --- .gitignore | 2 ++ backend/dist/ICON-LICENSE.md | 7 +++++++ backend/dist/icon.png | Bin 0 -> 1971 bytes backend/main.go | 10 ++++++++++ charts/plugin-bench/templates/plugin-cr.yaml | 1 + charts/plugin-bench/values.yaml | 4 ++++ src/main.tsx | 5 +++++ 7 files changed, 29 insertions(+) create mode 100644 backend/dist/ICON-LICENSE.md create mode 100644 backend/dist/icon.png diff --git a/.gitignore b/.gitignore index 441205e..f552984 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,7 @@ node_modules/ dist/ +!backend/dist/ +!backend/dist/icon.png backend/dist/main.js backend/plugin-bench *.tgz diff --git a/backend/dist/ICON-LICENSE.md b/backend/dist/ICON-LICENSE.md new file mode 100644 index 0000000..35de5d6 --- /dev/null +++ b/backend/dist/ICON-LICENSE.md @@ -0,0 +1,7 @@ +# Speedometer icon + +Source: https://icon-icons.com/icon/speedometer/137157 + +Author: Community (Material Design). + +The PNG is distributed under the Apache License 2.0. diff --git a/backend/dist/icon.png b/backend/dist/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..566bcb53a490b471439e0ce898d2e49060f0efad GIT binary patch literal 1971 zcmeAS@N?(olHy`uVBq!ia0vp^1|ZDA3?vioaBc-sEa{HEjtmSN`?>!lvI6;x#X;^) z4C~IxyaaL-l0AZa85pY67#JE_7#My5g&JNkFq8sKd6mGxU^Rn*LA+qju0R{0zGneG zA+A6LqhNT4!2kdMZCwo406n>&B*-tAfkjY`QN*ob-Ps2Z&(ydGn{}Q0_VskTDXaR# z*DsQp*i-NP`%x|>Dmmr%jp^ySdKdUJ#MYk7l(F0TG4xr1=FE3oe~;QrRNc1RufZL1 z;+D$B>#DYDy}yc{m)tzm(Ry5*&G(bZh0;>B49WEUKC zC`)s^%D0L4gZ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VlXtdFflPUHa0M`?EK&YR3eOI zPH<)wP=%46xwn&(Q&BKCP}&_yIyA_WAuTf}6&M71`lSUq`H3mT`le?3$w9f9<^F#9 yMn)zU`o#sQsVVtD_oNoZXC~+8#Ty!%8=9Ky0UZ@6E%**-B!j1`pUXO@geCy2{8Lf@ literal 0 HcmV?d00001 diff --git a/backend/main.go b/backend/main.go index f70de9c..6470c53 100644 --- a/backend/main.go +++ b/backend/main.go @@ -15,6 +15,9 @@ import ( //go:embed dist/main.js var distFS embed.FS +//go:embed dist/icon.png +var iconData []byte + type runSummary struct { ID string `json:"id"` Status string `json:"status"` @@ -68,9 +71,16 @@ func handleRuns(w http.ResponseWriter, r *http.Request) { } } +func handleIcon(w http.ResponseWriter, _ *http.Request) { + w.Header().Set("Content-Type", "image/png") + w.Header().Set("Cache-Control", "public, max-age=86400") + _, _ = w.Write(iconData) +} + func main() { mux := http.NewServeMux() mux.HandleFunc("GET /main.js", handleBundle) + mux.HandleFunc("GET /icon.png", handleIcon) mux.HandleFunc("GET /healthz", handleHealth) mux.HandleFunc("GET /api/status", handleStatus) mux.HandleFunc("/api/runs", handleRuns) diff --git a/charts/plugin-bench/templates/plugin-cr.yaml b/charts/plugin-bench/templates/plugin-cr.yaml index fabf3a2..354f7c3 100644 --- a/charts/plugin-bench/templates/plugin-cr.yaml +++ b/charts/plugin-bench/templates/plugin-cr.yaml @@ -8,6 +8,7 @@ spec: version: {{ .Chart.AppVersion | quote }} vendor: {{ .Values.plugin.vendor | quote }} enabled: {{ .Values.plugin.enabled }} + icon: {{ .Values.plugin.icon | quote }} backend: serviceRef: namespace: {{ .Release.Namespace }} diff --git a/charts/plugin-bench/values.yaml b/charts/plugin-bench/values.yaml index 9917a8c..9e8373b 100644 --- a/charts/plugin-bench/values.yaml +++ b/charts/plugin-bench/values.yaml @@ -18,10 +18,14 @@ plugin: vendor: "OpenEverest" enabled: true bundlePath: "/main.js" + icon: "/icon.png" extensionPoints: - type: route path: /performance-benchmark label: Performance Benchmark + - type: sidebarItem + label: Performance Benchmark + icon: "/icon.png" - type: clusterDetailTab path: performance-benchmark label: Performance Benchmark diff --git a/src/main.tsx b/src/main.tsx index 4e8200b..1238e41 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -195,6 +195,11 @@ const register: PluginRegisterFn = (api: PluginApi) => { React = api.React; pluginFetch = api.fetch.bind(api); + api.registerExtension({ + type: 'sidebarItem', + label: 'Performance Benchmark', + }); + api.registerExtension({ type: 'route', label: 'Performance Benchmark',