Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[dashboard] Fix broken backup menu links missing cluster context#2232

Open
sircthulhu wants to merge 1 commit intomaincozystack/cozystack:mainfrom
fix/dashboard-backup-menu-linkscozystack/cozystack:fix/dashboard-backup-menu-linksCopy head branch name to clipboard
Open

[dashboard] Fix broken backup menu links missing cluster context#2232
sircthulhu wants to merge 1 commit intomaincozystack/cozystack:mainfrom
fix/dashboard-backup-menu-linkscozystack/cozystack:fix/dashboard-backup-menu-linksCopy head branch name to clipboard

Conversation

@sircthulhu
Copy link
Contributor

@sircthulhu sircthulhu commented Mar 17, 2026

What this PR does

Adds missing baseFactoriesMapping entries for backup resources (plans, backupjobs, backups) to the static Navigation resource.

Backup resources are not ApplicationDefinitions, so ensureNavigation() never creates their navigation mappings. Without these mappings, the OpenUI frontend cannot resolve the {cluster} context for backup pages, producing broken sidebar links with an empty cluster segment (e.g. /openapi-ui//tenant-root/api-table/backups.cozystack.io/v1alpha1/plans instead of /openapi-ui/default/tenant-root/...).

Release note

[dashboard] Fix broken backup menu links by adding missing baseFactoriesMapping entries for backup resources

Summary by CodeRabbit

  • New Features
    • Backup resources are now integrated into dashboard navigation, providing quick access to backup plans, backup job monitoring, and detailed backup information for streamlined operations management.

Backup resources (plans, backupjobs, backups) are not
ApplicationDefinitions, so ensureNavigation() never adds their
baseFactoriesMapping entries. Without these mappings the OpenUI
frontend cannot resolve the {cluster} context for backup pages,
producing broken sidebar links with an empty cluster segment
(e.g. /openapi-ui//tenant-root/...).

Add the three missing entries to the static Navigation resource.

Assisted-By: Claude AI
Signed-off-by: Kirill Ilin <stitch14@yandex.ru>
@sircthulhu sircthulhu requested a review from kvaps as a code owner March 17, 2026 07:54
@sircthulhu sircthulhu added the backport Should change be backported on previus release label Mar 17, 2026
@sircthulhu sircthulhu added the backport Should change be backported on previus release label Mar 17, 2026
@dosubot dosubot bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Mar 17, 2026
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses a critical navigation issue within the dashboard where links to backup-related resources were malformed and non-functional. The problem stemmed from the system's inability to correctly map these resources, as they are not classified as ApplicationDefinitions, leading to an absence of necessary cluster context in their URLs. The changes introduce explicit mappings for these backup resources, thereby restoring proper navigation and ensuring a seamless user experience when interacting with backup plans, jobs, and backups.

Highlights

  • Fixes broken backup menu links: This pull request resolves an issue where navigation links for backup resources (plans, backupjobs, backups) in the dashboard were broken due to missing cluster context.
  • Adds missing navigation mappings: The fix involves explicitly adding baseFactoriesMapping entries for backup resources to the static Navigation resource, as these are not ApplicationDefinitions and thus were not automatically covered by ensureNavigation().
  • Ensures correct URL generation: By providing these mappings, the OpenUI frontend can now correctly resolve the {cluster} context for backup pages, preventing malformed URLs with empty cluster segments.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • internal/controller/dashboard/static_refactored.go
    • Added baseFactoriesMapping entries for backup plans, backup jobs, and backups.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@dosubot dosubot bot added the bug Something isn't working label Mar 17, 2026
@sircthulhu sircthulhu self-assigned this Mar 17, 2026
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 17, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 8ba9e35f-56e4-4d3e-8503-7121ca327ec8

📥 Commits

Reviewing files that changed from the base of the PR and between 9fb9354 and 398ca58.

📒 Files selected for processing (1)
  • internal/controller/dashboard/static_refactored.go

📝 Walkthrough

Walkthrough

Three new backup resource navigation entries are added to the baseFactoriesMapping in the dashboard controller's CreateAllNavigations function, expanding navigation coverage for plan-details, backupjob-details, and backup-details resources.

Changes

Cohort / File(s) Summary
Dashboard Navigation Configuration
internal/controller/dashboard/static_refactored.go
Added three new entries to baseFactoriesMapping to include backup resources (plan-details, backupjob-details, backup-details) in dashboard navigation.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

🐰 Three little backups, now in view,
Dancing in navigation anew!
Plan and job and backup too,
The dashboard shines with better clue. ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main fix: restoring broken backup menu links by addressing missing cluster context, which matches the core change of adding baseFactoriesMapping entries for backup resources.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/dashboard-backup-menu-links
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Tip

You can disable sequence diagrams in the walkthrough.

Disable the reviews.sequence_diagrams setting to disable sequence diagrams in the walkthrough.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds missing navigation mappings for backup resources. My review focuses on the maintainability of the new code. I have one suggestion to refactor the newly added entries to reduce code duplication by generating them programmatically. This is an optional improvement that could also be handled in a follow-up.

Comment on lines +1988 to +1991
// Backup resources (not ApplicationDefinitions, so ensureNavigation doesn't cover them)
"base-factory-namespaced-api-backups.cozystack.io-v1alpha1-plans": "plan-details",
"base-factory-namespaced-api-backups.cozystack.io-v1alpha1-backupjobs": "backupjob-details",
"base-factory-namespaced-api-backups.cozystack.io-v1alpha1-backups": "backup-details",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

While this change is correct, the three new entries for backup resources share a long common prefix, which leads to code duplication. To improve maintainability and readability, consider generating these entries programmatically.

This would involve removing these lines from the map literal and adding a small loop after the map is initialized. This makes it easier to manage backup-related navigation entries in the future.

Here is an example of how you could do it:

// Assuming `baseFactoriesMapping` is the name of the map variable
backupResources := []string{"plans", "backupjobs", "backups"}
const backupPrefix = "base-factory-namespaced-api-backups.cozystack.io/v1alpha1-"
for _, resource := range backupResources {
    key := backupPrefix + resource
    value := fmt.Sprintf("%s-details", strings.TrimSuffix(resource, "s"))
    baseFactoriesMapping[key] = value
}

This would require fmt and strings imports if they are not already present. Given this is a structural change, feel free to address this in a follow-up PR if you prefer to keep this fix minimal.

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Mar 17, 2026
@kvaps kvaps enabled auto-merge March 18, 2026 18:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport Should change be backported on previus release backport-previous bug Something isn't working lgtm This PR has been approved by a maintainer size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.