Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(rn): add resource name to additional entities #291

Merged
merged 24 commits into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
8a23ac5
chore(refactor): update servicename to serviceccrn throughout repo
BlakePatterson Oct 10, 2024
74a5f49
chore(refactor): update component to use ccrn throughout repo
BlakePatterson Oct 10, 2024
4719633
chore(refactor): update supportgroup to use ccrn throughout repo
BlakePatterson Oct 11, 2024
0b4b386
chore(refactor): added ccrn field to component version
BlakePatterson Oct 15, 2024
4dd3b29
chore(refactor): revert changes to component version with ccrn
BlakePatterson Oct 22, 2024
65a6edc
chore(): merged with changes from main and updated them with new ccrn…
BlakePatterson Oct 22, 2024
8fc8e70
chore(): merged change from main
BlakePatterson Oct 22, 2024
f0ab738
Update tests.yaml (#323)
MR2011 Oct 23, 2024
c4e86bb
Update codeql.yaml (#325)
MR2011 Oct 24, 2024
8f6e5c0
chore: add sleeps to suppress potential racing conditions which make …
copyonwrite Oct 24, 2024
059521a
chore: increase license location threshold (#329)
MR2011 Oct 25, 2024
b0d1ac6
fix: Resolve the double port expose for Prometheus metrics (#333)
dimtas Oct 28, 2024
adc1e23
chore(doc):uploaded images for Prod. design doc. (#311)
lolaapenna Oct 28, 2024
929e222
chore: create setup job in codeql.yaml (#335)
MR2011 Oct 28, 2024
76faa8a
chore: remove generated code (#324)
MR2011 Oct 28, 2024
4563af6
chore: update build_query in codeql.yaml (#336)
MR2011 Oct 28, 2024
fabbfcb
chore(deps): bump github.com/brianvoe/gofakeit/v7 from 7.0.4 to 7.1.1…
dependabot[bot] Oct 28, 2024
3d03932
fix(test): added additonal readiness checks for DB (#334)
drochow Oct 28, 2024
a422d10
merge
MR2011 Oct 29, 2024
4db47d0
chore(refactor): update supportgroup to use ccrn throughout repo
BlakePatterson Oct 11, 2024
6de19f3
chore(refactor): added ccrn field to component version
BlakePatterson Oct 15, 2024
d2a0bdb
chore(refactor): revert changes to component version with ccrn
BlakePatterson Oct 22, 2024
c094a16
Merge branch 'main' into BlakePatterson/issue_241/add-ccrn-to-entities
MR2011 Oct 29, 2024
bfd433b
fix wrong function name
MR2011 Oct 29, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions internal/api/graphql/gqlgen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -203,29 +203,29 @@ models:
resolver: true
affectedService:
resolver: true
componentName:
componentCcrn:
resolver: true
supportGroupName:
supportGroupCcrn:
resolver: true
ServiceFilterValue:
fields:
serviceName:
serviceCcrn:
resolver: true
uniqueUserId:
resolver: true
userName:
resolver: true
supportGroupName:
supportGroupCcrn:
resolver: true
ComponentInstanceFilterValue:
fields:
serviceName:
serviceCcrn:
resolver: true
supportGroupName:
supportGroupCcrn:
resolver: true
ccrn:
resolver: true
ComponentFilterValue:
fields:
componentName:
componentCcrn:
resolver: true
2 changes: 1 addition & 1 deletion internal/api/graphql/graph/baseResolver/activity.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ func ActivityBaseResolver(app app.Heureka, ctx context.Context, filter *model.Ac

f := &entity.ActivityFilter{
Paginated: entity.Paginated{First: first, After: afterId},
ServiceName: filter.ServiceName,
ServiceCCRN: filter.ServiceCcrn,
ServiceId: sId,
IssueId: issueId,
}
Expand Down
16 changes: 8 additions & 8 deletions internal/api/graphql/graph/baseResolver/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,33 +14,33 @@ import (
)

var (
FilterDisplayServiceName string = "Service Name"
FilterDisplaySupportGroupName string = "Support Group Name"
FilterDisplayServiceCcrn string = "Service CCRN"
FilterDisplaySupportGroupCcrn string = "Support Group CCRN"
FilterDisplayUserName string = "User Name"
FilterDisplayUniqueUserId string = "Unique User ID"
FilterDisplayComponentName string = "Component Name"
FilterDisplayComponentCcrn string = "Component CCRN"
FilterDisplayIssueType string = "Issue Type"
FilterDisplayIssueMatchStatus string = "Issue Match Status"
FilterDisplayIssueMatchID string = "Issue Match ID"
FilterDisplayIssuePrimaryName string = "Issue Name"
FilterDisplayIssueSeverity string = "Severity"
FilterDisplayCcrn string = "CCRN"

ServiceFilterServiceName string = "serviceName"
ServiceFilterServiceCcrn string = "serviceCcrn"
ServiceFilterUniqueUserId string = "uniqueUserId"
ServiceFilterType string = "type"
ServiceFilterUserName string = "userName"
ServiceFilterSupportGroupName string = "supportGroupName"
ServiceFilterSupportGroupCcrn string = "supportGroupCcrn"

IssueMatchFilterPrimaryName string = "primaryName"
IssueMatchFilterComponentName string = "componentName"
IssueMatchFilterComponentCcrn string = "componentCcrn"
IssueMatchFilterIssueType string = "issueType"
IssueMatchFilterStatus string = "status"
IssueMatchFilterSeverity string = "severity"
IssueMatchFilterAffectedService string = "affectedService"
IssueMatchFilterSupportGroupName string = "supportGroupName"
IssueMatchFilterSupportGroupCcrn string = "supportGroupCcrn"

ComponentFilterComponentName string = "componentName"
ComponentFilterComponentCcrn string = "componentCcrn"
)

type ResolverError struct {
Expand Down
14 changes: 7 additions & 7 deletions internal/api/graphql/graph/baseResolver/component.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func ComponentBaseResolver(app app.Heureka, ctx context.Context, filter *model.C

f := &entity.ComponentFilter{
Paginated: entity.Paginated{First: first, After: afterId},
Name: filter.ComponentName,
CCRN: filter.ComponentCcrn,
}

opt := GetListOptions(requestedFields)
Expand Down Expand Up @@ -107,27 +107,27 @@ func ComponentBaseResolver(app app.Heureka, ctx context.Context, filter *model.C

}

func ComponentNameBaseResolver(app app.Heureka, ctx context.Context, filter *model.ComponentFilter) (*model.FilterItem, error) {
func ComponentCcrnBaseResolver(app app.Heureka, ctx context.Context, filter *model.ComponentFilter) (*model.FilterItem, error) {
requestedFields := GetPreloads(ctx)
logrus.WithFields(logrus.Fields{
"requestedFields": requestedFields,
}).Debug("Called ComponentNameBaseResolver")
}).Debug("Called ComponentCcrnBaseResolver")

if filter == nil {
filter = &model.ComponentFilter{}
}

f := &entity.ComponentFilter{
Paginated: entity.Paginated{},
Name: filter.ComponentName,
CCRN: filter.ComponentCcrn,
}

opt := GetListOptions(requestedFields)

names, err := app.ListComponentNames(f, opt)
names, err := app.ListComponentCcrns(f, opt)

if err != nil {
return nil, NewResolverError("ComponentNameBaseReolver", err.Error())
return nil, NewResolverError("ComponentCcrnBaseReolver", err.Error())
}

var pointerNames []*string
Expand All @@ -137,7 +137,7 @@ func ComponentNameBaseResolver(app app.Heureka, ctx context.Context, filter *mod
}

filterItem := model.FilterItem{
DisplayName: &FilterDisplayComponentName,
DisplayName: &FilterDisplayComponentCcrn,
Values: pointerNames,
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package baseResolver

import (
"context"

"github.com/cloudoperators/heureka/internal/api/graphql/graph/model"
"github.com/cloudoperators/heureka/internal/app"
"github.com/cloudoperators/heureka/internal/entity"
Expand Down Expand Up @@ -97,7 +98,7 @@ func ComponentVersionBaseResolver(app app.Heureka, ctx context.Context, filter *
Paginated: entity.Paginated{First: first, After: afterId},
IssueId: issueId,
ComponentId: componentId,
ComponentName: filter.ComponentName,
ComponentCCRN: filter.ComponentCcrn,
Version: filter.Version,
}

Expand Down
4 changes: 2 additions & 2 deletions internal/api/graphql/graph/baseResolver/issue.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ func IssueBaseResolver(app app.Heureka, ctx context.Context, filter *model.Issue

f := &entity.IssueFilter{
Paginated: entity.Paginated{First: first, After: afterId},
ServiceName: filter.AffectedService,
ServiceCCRN: filter.AffectedService,
ActivityId: activityId,
ComponentVersionId: cvId,
PrimaryName: filter.PrimaryName,
Expand Down Expand Up @@ -170,7 +170,7 @@ func IssueNameBaseResolver(app app.Heureka, ctx context.Context, filter *model.I

f := &entity.IssueFilter{
Paginated: entity.Paginated{},
ServiceName: filter.AffectedService,
ServiceCCRN: filter.AffectedService,
PrimaryName: filter.PrimaryName,
Type: lo.Map(filter.IssueType, func(item *model.IssueTypes, _ int) *string { return pointer.String(item.String()) }),
Search: filter.Search,
Expand Down
6 changes: 3 additions & 3 deletions internal/api/graphql/graph/baseResolver/issue_match.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,15 +105,15 @@ func IssueMatchBaseResolver(app app.Heureka, ctx context.Context, filter *model.
f := &entity.IssueMatchFilter{
Id: issue_match_ids,
Paginated: entity.Paginated{First: first, After: afterId},
AffectedServiceName: filter.AffectedService,
AffectedServiceCCRN: filter.AffectedService,
Status: lo.Map(filter.Status, func(item *model.IssueMatchStatusValues, _ int) *string { return pointer.String(item.String()) }),
SeverityValue: lo.Map(filter.Severity, func(item *model.SeverityValues, _ int) *string { return pointer.String(item.String()) }),
SupportGroupName: filter.SupportGroupName,
SupportGroupCCRN: filter.SupportGroupCcrn,
IssueId: issueId,
EvidenceId: eId,
ComponentInstanceId: ciId,
Search: filter.Search,
ComponentName: filter.ComponentName,
ComponentCCRN: filter.ComponentCcrn,
PrimaryName: filter.PrimaryName,
IssueType: lo.Map(filter.IssueType, func(item *model.IssueTypes, _ int) *string { return pointer.String(item.String()) }),
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func IssueRepositoryBaseResolver(app app.Heureka, ctx context.Context, filter *m
Paginated: entity.Paginated{First: first, After: afterId},
ServiceId: serviceId,
Name: filter.Name,
ServiceName: filter.ServiceName,
ServiceCCRN: filter.ServiceCcrn,
}

opt := GetListOptions(requestedFields)
Expand Down
18 changes: 9 additions & 9 deletions internal/api/graphql/graph/baseResolver/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ func ServiceBaseResolver(app app.Heureka, ctx context.Context, filter *model.Ser

f := &entity.ServiceFilter{
Paginated: entity.Paginated{First: first, After: afterId},
SupportGroupName: filter.SupportGroupName,
Name: filter.ServiceName,
SupportGroupCCRN: filter.SupportGroupCcrn,
CCRN: filter.ServiceCcrn,
OwnerName: filter.UserName,
OwnerId: ownerId,
ActivityId: activityId,
Expand Down Expand Up @@ -144,29 +144,29 @@ func ServiceBaseResolver(app app.Heureka, ctx context.Context, filter *model.Ser
return &connection, nil

}
func ServiceNameBaseResolver(app app.Heureka, ctx context.Context, filter *model.ServiceFilter) (*model.FilterItem, error) {
func ServiceCcrnBaseResolver(app app.Heureka, ctx context.Context, filter *model.ServiceFilter) (*model.FilterItem, error) {
requestedFields := GetPreloads(ctx)
logrus.WithFields(logrus.Fields{
"requestedFields": requestedFields,
}).Debug("Called ServiceNameBaseResolver")
}).Debug("Called ServiceCcrnBaseResolver")

if filter == nil {
filter = &model.ServiceFilter{}
}

f := &entity.ServiceFilter{
Paginated: entity.Paginated{},
SupportGroupName: filter.SupportGroupName,
Name: filter.ServiceName,
SupportGroupCCRN: filter.SupportGroupCcrn,
CCRN: filter.ServiceCcrn,
OwnerName: filter.UserName,
}

opt := GetListOptions(requestedFields)

names, err := app.ListServiceNames(f, opt)
names, err := app.ListServiceCcrns(f, opt)

if err != nil {
return nil, NewResolverError("ServiceNameBaseResolver", err.Error())
return nil, NewResolverError("ServiceCcrnBaseResolver", err.Error())
}

var pointerNames []*string
Expand All @@ -176,7 +176,7 @@ func ServiceNameBaseResolver(app app.Heureka, ctx context.Context, filter *model
}

filterItem := model.FilterItem{
DisplayName: &FilterDisplayServiceName,
DisplayName: &FilterDisplayServiceCcrn,
Values: pointerNames,
}

Expand Down
18 changes: 9 additions & 9 deletions internal/api/graphql/graph/baseResolver/support_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func SupportGroupBaseResolver(app app.Heureka, ctx context.Context, filter *mode
Paginated: entity.Paginated{First: first, After: afterId},
ServiceId: serviceId,
UserId: userId,
Name: filter.SupportGroupName,
CCRN: filter.SupportGroupCcrn,
}

opt := GetListOptions(requestedFields)
Expand Down Expand Up @@ -87,11 +87,11 @@ func SupportGroupBaseResolver(app app.Heureka, ctx context.Context, filter *mode
return &connection, nil
}

func SupportGroupNameBaseResolver(app app.Heureka, ctx context.Context, filter *model.SupportGroupFilter) (*model.FilterItem, error) {
func SupportGroupCcrnBaseResolver(app app.Heureka, ctx context.Context, filter *model.SupportGroupFilter) (*model.FilterItem, error) {
requestedFields := GetPreloads(ctx)
logrus.WithFields(logrus.Fields{
"requestedFields": requestedFields,
}).Debug("Called SupportGroupNameBaseResolver")
}).Debug("Called SupportGroupCcrnBaseResolver")
var err error

if filter == nil {
Expand All @@ -103,23 +103,23 @@ func SupportGroupNameBaseResolver(app app.Heureka, ctx context.Context, filter *
userIds, err = util.ConvertStrToIntSlice(filter.UserIds)

if err != nil {
logrus.WithField("Filter", filter).Error("SupportGroupNameBaseResolver: Error while parsing 'UserIds'")
return nil, NewResolverError("SupportGroupNameBaseResolver", "Bad Request - unable to parse 'UserIds'")
logrus.WithField("Filter", filter).Error("SupportGroupCcrnBaseResolver: Error while parsing 'UserIds'")
return nil, NewResolverError("SupportGroupCcrnBaseResolver", "Bad Request - unable to parse 'UserIds'")
}
}

f := &entity.SupportGroupFilter{
Paginated: entity.Paginated{},
UserId: userIds,
Name: filter.SupportGroupName,
CCRN: filter.SupportGroupCcrn,
}

opt := GetListOptions(requestedFields)

names, err := app.ListSupportGroupNames(f, opt)
names, err := app.ListSupportGroupCcrns(f, opt)

if err != nil {
return nil, NewResolverError("SupportGroupNameBaseResolver", err.Error())
return nil, NewResolverError("SupportGroupCcrnBaseResolver", err.Error())
}

var pointerNames []*string
Expand All @@ -129,7 +129,7 @@ func SupportGroupNameBaseResolver(app app.Heureka, ctx context.Context, filter *
}

filterItem := model.FilterItem{
DisplayName: &FilterDisplaySupportGroupName,
DisplayName: &FilterDisplaySupportGroupCcrn,
Values: pointerNames,
}

Expand Down
14 changes: 7 additions & 7 deletions internal/api/graphql/graph/model/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ func NewUserEntity(user *UserInput) entity.User {
func NewService(s *entity.Service) Service {
return Service{
ID: fmt.Sprintf("%d", s.Id),
Name: &s.Name,
Ccrn: &s.CCRN,
}
}

Expand All @@ -371,29 +371,29 @@ func NewServiceWithAggregations(service *entity.ServiceResult) Service {

return Service{
ID: fmt.Sprintf("%d", service.Id),
Name: &service.Name,
Ccrn: &service.CCRN,
Metadata: &metadata,
}
}

func NewServiceEntity(service *ServiceInput) entity.Service {
return entity.Service{
BaseService: entity.BaseService{
Name: lo.FromPtr(service.Name),
CCRN: lo.FromPtr(service.Ccrn),
},
}
}

func NewSupportGroup(supportGroup *entity.SupportGroup) SupportGroup {
return SupportGroup{
ID: fmt.Sprintf("%d", supportGroup.Id),
Name: &supportGroup.Name,
Ccrn: &supportGroup.CCRN,
}
}

func NewSupportGroupEntity(supportGroup *SupportGroupInput) entity.SupportGroup {
return entity.SupportGroup{
Name: lo.FromPtr(supportGroup.Name),
CCRN: lo.FromPtr(supportGroup.Ccrn),
}
}

Expand Down Expand Up @@ -452,7 +452,7 @@ func NewComponent(component *entity.Component) Component {
componentType, _ := ComponentTypeValue(component.Type)
return Component{
ID: fmt.Sprintf("%d", component.Id),
Name: &component.Name,
Ccrn: &component.CCRN,
Type: &componentType,
}
}
Expand All @@ -463,7 +463,7 @@ func NewComponentEntity(component *ComponentInput) entity.Component {
componentType = component.Type.String()
}
return entity.Component{
Name: lo.FromPtr(component.Name),
CCRN: lo.FromPtr(component.Ccrn),
Type: componentType,
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ mutation ($activityId: ID!, $serviceId: ID!) {
edges {
node {
id
name
ccrn
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ query ($filter: ActivityFilter, $first: Int, $after: String) {
edges {
node {
id
name
ccrn
}
cursor
}
Expand Down
Loading
Loading