Cosmetics

This commit is contained in:
Andrei Pohilko
2022-11-08 14:37:48 +00:00
parent 2454fcf47c
commit dadf2d1bde
6 changed files with 23 additions and 22 deletions

View File

@@ -15,7 +15,7 @@ pull: ; $(info $(M) Pulling source...) @
.PHONY: build
build: $(BIN) ; $(info $(M) Building executable...) @ ## Build program binary
$Q $(GO) build \
go build \
-ldflags '-X main.version=$(VERSION) -X main.buildDate=$(DATE)' \
-o bin/dashboard .

View File

@@ -39,6 +39,7 @@ func (h *KubeHandler) GetResourceInfo(c *gin.Context) {
return
}
// custom logic to provide most meaningful status for the resource
if res.Status.Phase == "Active" || res.Status.Phase == "Error" {
_ = res.Name + ""
} else if res.Status.Phase == "" && len(res.Status.Conditions) > 0 {

View File

@@ -71,18 +71,6 @@ function popUpUpgrade(elm, ns, name, verCur, lastRev) {
$("#upgradeModal .rel-ns").prop("disabled", false).val("")
}
$.getJSON("/api/kube/namespaces").fail(function (xhr) {
reportError("Failed to get namespaces", xhr)
}).done(function(res) {
const ns = res.items.map(i => i.metadata.name)
$.each(ns, function(i, item) {
$("#upgradeModal #ns-datalist").append($("<option>", {
value: item,
text: item
}))
})
})
$.getJSON("/api/helm/repo/search?name=" + elm.name).fail(function (xhr) {
reportError("Failed to find chart in repo", xhr)
}).done(function (vers) {

View File

@@ -14,6 +14,18 @@ $(function () {
initView(); // can only do it after loading cluster list
})
$.getJSON("/api/kube/namespaces").fail(function (xhr) {
reportError("Failed to get namespaces", xhr)
}).done(function(res) {
const ns = res.items.map(i => i.metadata.name)
$.each(ns, function(i, item) {
$("#upgradeModal #ns-datalist").append($("<option>", {
value: item,
text: item
}))
})
})
$.getJSON("/api/scanners").fail(function (xhr) {
reportError("Failed to get list of scanners", xhr)
}).done(function (data) {

View File

@@ -521,3 +521,11 @@ func GetDiff(text1 string, text2 string, name1 string, name2 string) string {
log.Debugf("The diff is: %s", diff)
return diff
}
type NamespaceElement struct {
Items []struct {
Metadata struct {
Name string `json:"name"`
} `json:"metadata"`
} `json:"items"`
}

View File

@@ -43,11 +43,3 @@ type RepositoryElement struct {
Name string `json:"name"`
URL string `json:"url"`
}
type NamespaceElement struct {
Items []struct {
Metadata struct {
Name string `json:"name"`
} `json:"metadata"`
} `json:"items"`
}