aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAleksandr Nogikh <nogikh@google.com>2023-03-21 18:49:17 +0100
committerAleksandr Nogikh <wp32pw@gmail.com>2023-03-22 10:43:53 +0100
commitd846e076df452686ea70faccf1d6128afc127d4b (patch)
tree6a4db774ca20972ef14129f74958e6ff20a7591a
parent8b4eb097b2e5a6f78a8d0b1ae48de4bbaa4c45a1 (diff)
dashboard: provide correct coverage URLs for the Admin page
For the Admin page, we query all managers from all namespaces. That was not supported by queryLatestManagerAssets, so we always returned the fallback coverage URLs. Make queryLatestManagerAssets support ns="".
-rw-r--r--dashboard/app/asset_storage.go8
-rw-r--r--dashboard/app/index.yaml5
2 files changed, 10 insertions, 3 deletions
diff --git a/dashboard/app/asset_storage.go b/dashboard/app/asset_storage.go
index a8492a3e8..10926dfa2 100644
--- a/dashboard/app/asset_storage.go
+++ b/dashboard/app/asset_storage.go
@@ -473,9 +473,11 @@ func queryLatestManagerAssets(c context.Context, ns string, assetType dashapi.As
period time.Duration) (map[string]Asset, error) {
var builds []*Build
startTime := timeNow(c).Add(-period)
- _, err := db.NewQuery("Build").
- Filter("Namespace=", ns).
- Filter("Assets.Type=", assetType).
+ query := db.NewQuery("Build")
+ if ns != "" {
+ query = query.Filter("Namespace=", ns)
+ }
+ _, err := query.Filter("Assets.Type=", assetType).
Filter("Assets.CreateDate>", startTime).
Order("Assets.CreateDate").
GetAll(c, &builds)
diff --git a/dashboard/app/index.yaml b/dashboard/app/index.yaml
index bcadc37e8..813a82df9 100644
--- a/dashboard/app/index.yaml
+++ b/dashboard/app/index.yaml
@@ -146,6 +146,11 @@ indexes:
- kind: Build
properties:
+ - name: Assets.Type
+ - name: Assets.CreateDate
+
+- kind: Build
+ properties:
- name: Namespace
- name: AssetsLastCheck