From f897c0f1975673ff87da1532788effcae09ef096 Mon Sep 17 00:00:00 2001 From: Andrei Pohilko Date: Sun, 6 Nov 2022 16:16:36 +0000 Subject: [PATCH] Display forced namespace in UI --- pkg/dashboard/api.go | 2 +- pkg/dashboard/server.go | 11 ++++++----- pkg/dashboard/static/index.html | 11 +++++++---- pkg/dashboard/static/scripts.js | 1 + pkg/dashboard/subproc/data.go | 11 ++++++----- 5 files changed, 21 insertions(+), 15 deletions(-) diff --git a/pkg/dashboard/api.go b/pkg/dashboard/api.go index ac93b4e..e2b2624 100644 --- a/pkg/dashboard/api.go +++ b/pkg/dashboard/api.go @@ -73,7 +73,7 @@ func configureRoutes(abortWeb utils.ControlChan, data *subproc.DataLayer, api *g api.GET("/status", func(c *gin.Context) { c.Header("X-Application-Name", "Helm Dashboard by Komodor.io") // to identify ourselves by ourselves - c.IndentedJSON(http.StatusOK, data.VersionInfo) + c.IndentedJSON(http.StatusOK, data.StatusInfo) }) configureHelms(api.Group("/api/helm"), data) diff --git a/pkg/dashboard/server.go b/pkg/dashboard/server.go index e550f27..2402072 100644 --- a/pkg/dashboard/server.go +++ b/pkg/dashboard/server.go @@ -26,11 +26,12 @@ func StartServer(version string, port int, ns string, debug bool, noTracking boo os.Exit(1) // TODO: propagate error instead? } - data.VersionInfo = &subproc.VersionInfo{ - CurVer: version, - Analytics: !noTracking, + data.StatusInfo = &subproc.StatusInfo{ + CurVer: version, + Analytics: !noTracking, + LimitedToNamespace: ns, } - go checkUpgrade(data.VersionInfo) + go checkUpgrade(data.StatusInfo) discoverScanners(&data) @@ -102,7 +103,7 @@ func discoverScanners(data *subproc.DataLayer) { } } -func checkUpgrade(d *subproc.VersionInfo) { +func checkUpgrade(d *subproc.StatusInfo) { url := "https://api.github.com/repos/komodorio/helm-dashboard/releases/latest" type GHRelease struct { Name string `json:"name"` diff --git a/pkg/dashboard/static/index.html b/pkg/dashboard/static/index.html index 3cbd699..826fbc2 100644 --- a/pkg/dashboard/static/index.html +++ b/pkg/dashboard/static/index.html @@ -90,7 +90,8 @@ -

+

REPOSITORY

name-of-repo

@@ -120,6 +121,7 @@ +