mirror of
https://github.com/komodorio/helm-dashboard.git
synced 2026-03-24 11:48:04 +00:00
Display forced namespace in UI
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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"`
|
||||
|
||||
@@ -90,7 +90,8 @@
|
||||
<button class="btn btn-sm btn-light bg-white border border-secondary btn-remove">
|
||||
<i class="bi-trash3"></i> Remove
|
||||
</button>
|
||||
<p class="my-3"><input class="form-control form-control-sm" type="text" placeholder="Filter..." id="inputSearch"></p>
|
||||
<p class="my-3"><input class="form-control form-control-sm" type="text" placeholder="Filter..."
|
||||
id="inputSearch"></p>
|
||||
</div>
|
||||
<div><span class="text-muted small fw-bold me-3">REPOSITORY</span></div>
|
||||
<h2 class="mb-3">name-of-repo</h2>
|
||||
@@ -120,6 +121,7 @@
|
||||
<ul class="list-unstyled" id="cluster">
|
||||
</ul>
|
||||
|
||||
<h4 id="limitNamespace" class="display-none">Forced Namespace: <span></span></h4>
|
||||
<!-- TODO
|
||||
<h4 class="mt-4">Namespaces</h4>
|
||||
<ul class="list-unstyled" id="namespaces">
|
||||
@@ -357,8 +359,8 @@
|
||||
</label>
|
||||
<label class="form-label me-4 text-dark">
|
||||
Namespace (optional):
|
||||
<input type="text" class="form-control rel-ns" list="ns-datalist"/>
|
||||
<datalist id="ns-datalist"></datalist>
|
||||
<input type="text" class="form-control rel-ns" list="ns-datalist"/>
|
||||
<datalist id="ns-datalist"></datalist>
|
||||
</label>
|
||||
<label class="form-label me-4 text-dark">
|
||||
Cluster: <span class="form-label rel-cluster"></span>
|
||||
@@ -391,7 +393,8 @@
|
||||
<div id="upgradeModalBody" class="small"></div>
|
||||
</form>
|
||||
<div class="modal-footer d-flex">
|
||||
<button type="button" class="btn btn-scan bg-white border-secondary display-none">Scan for Problems</button>
|
||||
<button type="button" class="btn btn-scan bg-white border-secondary display-none">Scan for Problems
|
||||
</button>
|
||||
<button type="button" class="btn btn-primary btn-confirm">Confirm</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -29,6 +29,7 @@ $(function () {
|
||||
reportError("Failed to get tool version", xhr)
|
||||
}).done(function (data) {
|
||||
fillToolVersion(data)
|
||||
$("#limitNamespace").show().find("span").text(data.LimitedToNamespace)
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
@@ -26,14 +26,15 @@ type DataLayer struct {
|
||||
Helm string
|
||||
Kubectl string
|
||||
Scanners []Scanner
|
||||
VersionInfo *VersionInfo
|
||||
StatusInfo *StatusInfo
|
||||
Namespace string
|
||||
}
|
||||
|
||||
type VersionInfo struct {
|
||||
CurVer string
|
||||
LatestVer string
|
||||
Analytics bool
|
||||
type StatusInfo struct {
|
||||
CurVer string
|
||||
LatestVer string
|
||||
Analytics bool
|
||||
LimitedToNamespace string
|
||||
}
|
||||
|
||||
func (d *DataLayer) runCommand(cmd ...string) (string, error) {
|
||||
|
||||
Reference in New Issue
Block a user