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 0000000..566bcb5 Binary files /dev/null and b/backend/dist/icon.png differ 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',