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:
commit
8227879f2a
1 changed files with 5 additions and 2 deletions
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue