Skip to content

Commit

Permalink
feat(filter): add ordering for filter values (#305)
Browse files Browse the repository at this point in the history
  • Loading branch information
MR2011 authored Oct 18, 2024
1 parent a11cd04 commit deb0512
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 4 deletions.
21 changes: 21 additions & 0 deletions internal/api/graphql/graph/model/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,27 @@ import (

// add custom models here

var AllSeverityValuesOrdered = []SeverityValues{
SeverityValuesCritical,
SeverityValuesHigh,
SeverityValuesMedium,
SeverityValuesLow,
SeverityValuesNone,
}

var AllIssueTypesOrdered = []IssueTypes{
IssueTypesPolicyViolation,
IssueTypesSecurityEvent,
IssueTypesVulnerability,
}

var AllIssueMatchStatusValuesOrdered = []IssueMatchStatusValues{
IssueMatchStatusValuesNew,
IssueMatchStatusValuesRiskAccepted,
IssueMatchStatusValuesFalsePositive,
IssueMatchStatusValuesMitigated,
}

func NewPageInfo(p *entity.PageInfo) *PageInfo {
if p == nil {
return nil
Expand Down
6 changes: 3 additions & 3 deletions internal/api/graphql/graph/resolver/query.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions internal/database/mariadb/component.go
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,7 @@ func (s *SqlDatabase) GetComponentNames(filter *entity.ComponentFilter) ([]strin
SELECT C.component_name FROM Component C
%s
%s
ORDER BY C.component_name
`

// Ensure the filter is initialized
Expand Down
1 change: 1 addition & 0 deletions internal/database/mariadb/component_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,7 @@ func (s *SqlDatabase) GetCcrn(filter *entity.ComponentInstanceFilter) ([]string,
SELECT CI.componentinstance_ccrn FROM ComponentInstance CI
%s
%s
ORDER BY CI.componentinstance_ccrn
`

// Ensure the filter is initialized
Expand Down
4 changes: 3 additions & 1 deletion internal/database/mariadb/issue.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ package mariadb

import (
"fmt"
"github.com/cloudoperators/heureka/internal/database"
"strings"

"github.com/cloudoperators/heureka/internal/database"

"github.com/cloudoperators/heureka/internal/entity"
"github.com/jmoiron/sqlx"
"github.com/sirupsen/logrus"
Expand Down Expand Up @@ -494,6 +495,7 @@ func (s *SqlDatabase) GetIssueNames(filter *entity.IssueFilter) ([]string, error
SELECT I.issue_primary_name FROM Issue I
%s
%s
ORDER BY I.issue_primary_name
`

// Ensure the filter is initialized
Expand Down
1 change: 1 addition & 0 deletions internal/database/mariadb/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,7 @@ func (s *SqlDatabase) GetServiceNames(filter *entity.ServiceFilter) ([]string, e
SELECT service_name FROM Service S
%s
%s
ORDER BY S.service_name
`

// Ensure the filter is initialized
Expand Down
1 change: 1 addition & 0 deletions internal/database/mariadb/support_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,7 @@ func (s *SqlDatabase) GetSupportGroupNames(filter *entity.SupportGroupFilter) ([
SELECT SG.supportgroup_name FROM SupportGroup SG
%s
%s
ORDER BY SG.supportgroup_name
`

// Ensure the filter is initialized
Expand Down
2 changes: 2 additions & 0 deletions internal/database/mariadb/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,7 @@ func (s *SqlDatabase) GetUserNames(filter *entity.UserFilter) ([]string, error)
SELECT U.user_name FROM User U
%s
%s
ORDER BY U.user_name
`

// Ensure the filter is initialized
Expand Down Expand Up @@ -344,6 +345,7 @@ func (s *SqlDatabase) GetUniqueUserIDs(filter *entity.UserFilter) ([]string, err
SELECT U.user_unique_user_id FROM User U
%s
%s
ORDER BY U.user_unique_user_id
`

// Ensure the filter is initialized
Expand Down

0 comments on commit deb0512

Please sign in to comment.