1
0
Fork 0
mirror of https://github.com/kyverno/policy-reporter.git synced 2024-12-14 11:57:32 +00:00

Merge pull request #297 from kyverno/fix-status-count-query

Fix SQLite Query for StatusCount
This commit is contained in:
Frank Jogeleit 2023-04-06 23:32:24 +02:00 committed by GitHub
commit 8227879f2a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -822,7 +822,7 @@ func (s *policyReportStore) FetchNamespacedStatusCounts(filter api.Filter) ([]ap
statusCounts := make([]api.NamespacedStatusCount, 0, 5)
where, args := generateFilterWhere(filter, []string{"sources", "categories", "policies", "kinds", "filter_namespaces", "status", "severities"})
where, args := generateFilterWhere(filter, []string{"sources", "categories", "policies", "filter_kinds", "filter_namespaces", "status", "severities"})
if len(where) > 0 {
where = " AND " + where
}
@ -932,7 +932,7 @@ func (s *policyReportStore) FetchStatusCounts(filter api.Filter) ([]api.StatusCo
statusCounts := make([]api.StatusCount, 0, len(list))
where, args := generateFilterWhere(filter, []string{"sources", "categories", "policies", "kinds", "status", "severities"})
where, args := generateFilterWhere(filter, []string{"sources", "categories", "policies", "filter_kinds", "status", "severities"})
if len(where) > 0 {
where = " AND " + where
}
@ -1404,6 +1404,9 @@ func generateFilterWhere(filter api.Filter, active []string) (string, []interfac
if contains("filter_namespaces", active) {
argCounter, where, args = appendWhere(filter.Namespaces, "result.namespace", where, args, argCounter)
}
if contains("filter_kinds", active) {
argCounter, where, args = appendWhere(filter.Namespaces, "result.kind", where, args, argCounter)
}
if contains("policies", active) {
argCounter, where, args = appendWhere(filter.Policies, "result.policy", where, args, argCounter)
}