Skip to content

Commit

Permalink
Rename sectionId to segmentId in frontend nav segments
Browse files Browse the repository at this point in the history
  • Loading branch information
florkbr authored and Hyperkid123 committed Dec 3, 2024
1 parent 450d494 commit 06340d1
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion api/v1alpha1/frontend_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ type WidgetEntry struct {
}

type NavigationSegment struct {
SectionID string `json:"sectionId" yaml:"sectionId"`
SegmentID string `json:"segmentId" yaml:"segmentId"`
// Id of the bundle to which the segment should be injected
BundleID string `json:"bundleId" yaml:"bundleId"`
// A position of the segment within the bundle
Expand Down
4 changes: 2 additions & 2 deletions config/crd/bases/cloud.redhat.com_frontends.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -376,13 +376,13 @@ spec:
0 is the first position
The position "steps" should be at least 100 to make sure there is enough space in case some segments should be injected between existing ones
type: integer
sectionId:
segmentId:
type: string
required:
- bundleId
- navItems
- position
- sectionId
- segmentId
type: object
type: array
replicas:
Expand Down
6 changes: 3 additions & 3 deletions controllers/reconcile.go
Original file line number Diff line number Diff line change
Expand Up @@ -988,8 +988,8 @@ func setupServiceTilesData(feList *crd.FrontendList, feEnvironment crd.FrontendE
return categories, skippedTiles
}

func getNavItemPath(feName string, bundleID string, sectionID string) string {
return fmt.Sprintf("%s-%s-%s", feName, bundleID, sectionID)
func getNavItemPath(feName string, bundleID string, segmentID string) string {
return fmt.Sprintf("%s-%s-%s", feName, bundleID, segmentID)
}

func setupBundlesData(feList *crd.FrontendList, feEnvironment crd.FrontendEnvironment) ([]crd.FrontendBundlesGenerated, []string) {
Expand All @@ -1005,7 +1005,7 @@ func setupBundlesData(feList *crd.FrontendList, feEnvironment crd.FrontendEnviro
if frontend.Spec.FeoConfigEnabled && frontend.Spec.NavigationSegments != nil {
for _, navSegment := range frontend.Spec.NavigationSegments {
bundleNavSegmentMap[navSegment.BundleID] = append(bundleNavSegmentMap[navSegment.BundleID], *navSegment)
skippedNavItemsMap[navSegment.BundleID] = append(skippedNavItemsMap[navSegment.BundleID], getNavItemPath(frontend.Name, navSegment.BundleID, navSegment.SectionID))
skippedNavItemsMap[navSegment.BundleID] = append(skippedNavItemsMap[navSegment.BundleID], getNavItemPath(frontend.Name, navSegment.BundleID, navSegment.SegmentID))
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -797,13 +797,13 @@ objects:
there is enough space in case some segments should be injected
between existing ones'
type: integer
sectionId:
segmentId:
type: string
required:
- bundleId
- navItems
- position
- sectionId
- segmentId
type: object
type: array
replicas:
Expand Down
2 changes: 1 addition & 1 deletion examples/landing.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ spec:
icon: IAMIcon
isExternal: false
navigationSegments:
- sectionId: inventory-partial
- segmentId: inventory-partial
bundleId: insights
position: 100
navItems:
Expand Down
6 changes: 3 additions & 3 deletions tests/e2e/generate-bundles/01-create-resources.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ spec:
modules: []
moduleID: landing-page
navigationSegments:
- sectionId: inventory-partial-2
- segmentId: inventory-partial-2
bundleId: rhel
position: 200
navItems:
Expand All @@ -51,7 +51,7 @@ spec:
- id: baz2
title: Some new link
href: /baz
- sectionId: inventory-partial
- segmentId: inventory-partial
bundleId: rhel
position: 100
navItems:
Expand All @@ -68,7 +68,7 @@ spec:
- id: baz
title: Some new link
href: /baz
- sectionId: skipped-partial
- segmentId: skipped-partial
bundleId: skipped
position: 100
navItems:
Expand Down

0 comments on commit 06340d1

Please sign in to comment.