Skip to content

feat(dashboard): add RestoreJob list, add page, and sidebar link - #2437

Merged
myasnikovdaniil merged 2 commits into
mainfrom
feat/dashboard-restores-review-fixes
Apr 21, 2026
Merged

myasnikovdaniil merged 2 commits into
mainfrom
feat/dashboard-restores-review-fixes

Conversation

@myasnikovdaniil

@myasnikovdaniil myasnikovdaniil commented Apr 21, 2026 •

Copy link
Copy Markdown
Contributor

What this PR does

  • Introduce list, details, create, and sidebar views for RestoreJob in the dashboard controller.
  • Auto-generate stable component IDs for sidebar entries and detail sub-blocks so upserts remain consistent across reconciles.
  • Render a single "Same as backup" fallback for an omitted spec.targetApplicationRef on the details view instead of concatenating three missing-path fallbacks.
  • Mark non-CRD-backed stock-project-factory-*-details sidebars (kube-*, plan, backupjob, backup, restorejob) as static so they pick up consistent managed-by labels.

Release note

[dashboard] Add RestoreJob views (list, details, create, sidebar link) to the dashboard controller.

Test plan

  • Deploy controller to dev stand and open the restore pages in the dashboard
  • Create a RestoreJob through the UI against an existing Backup; reconcile succeeds and the details view renders
  • CI green

Previous PR

#2387

Summary by CodeRabbit

Release Notes

  • New Features
    • Introduced comprehensive RestoreJobs dashboard interface enabling users to view and manage backup restoration operations.
    • New RestoreJobs section added to the Backups menu with dedicated details page and navigation.
    • Dashboard displays restore job status, phase, backup references, target applications, and operation timestamps for easy monitoring.

- Replace rename-only wording on spec.targetApplicationRef form labels so
  users discover that the field also supports restoring into a different
  application, not just renaming.
- Drop VMInstance-specific keys from the spec.options form label; the
  restore options are driver-specific, so hardcoding one driver's keys is
  misleading once other drivers land.
- Render a single "Same as backup" fallback for an omitted
  spec.targetApplicationRef on the details page instead of the noisy
  "-.-/-" produced by concatenating three missing path fallbacks.
- De-duplicate the time-block / time-icon / time-value component IDs
  within the restorejob-details factory by prefixing them with
  created-, started-at-, and completed-at-.
- Mark non-CRD-backed stock-project-factory-*-details sidebars (kube-*,
  plan, backupjob, backup, restorejob) as static in
  upsertMultipleSidebars so they pick up consistent managed-by labels
  instead of being left unmanaged.

Signed-off-by: Myasnikov Daniil <[email protected]>
@dosubot dosubot Bot added size/L This PR changes 100-499 lines, ignoring generated files kind/feature Categorizes issue or PR as related to a new feature labels Apr 21, 2026
@coderabbitai

coderabbitai Bot commented Apr 21, 2026 •

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

The PR adds dashboard support for the RestoreJob resource from the backups API. It introduces a new sidebar menu entry, custom columns and form overrides for listing and creating restore jobs, and a details page factory. Additionally, it refactors sidebar ownership logic to distinguish between static and dynamic detail sidebars.

Changes

Cohort / File(s) Summary
Sidebar Navigation & Ownership Logic
internal/controller/dashboard/sidebar.go
Added "RestoreJobs" entry to the Backups menu section. Introduced dynamicDetailsIDs collection to distinguish CRD-backed sidebar details from static ones, updating ownership and label application logic accordingly. Extended sidebar target ID set to include restore job details.
Dashboard UI Configuration
internal/controller/dashboard/static_refactored.go
Added comprehensive dashboard support for RestoreJob resource: custom columns override (Name, Phase, Backup, Created), custom form override with backup picker and target application fields, unified restorejob-details factory with Details tab, and helper function for backup listing. Registered factory in navigation mapping.

Sequence Diagram

sequenceDiagram
    actor User
    participant Dashboard as Dashboard UI
    participant Controller as Dashboard Controller
    participant CRD as RestoreJob CRD

    User->>Dashboard: Access Backups Menu
    Dashboard->>Controller: Request sidebar configuration
    Controller->>Controller: Check dynamicDetailsIDs
    Controller-->>Dashboard: Render RestoreJobs entry

    User->>Dashboard: Click RestoreJob or view list
    Dashboard->>Controller: Request columns/form config
    Controller->>Controller: Load CustomColumnsOverride
    Controller-->>Dashboard: Display RestoreJob list with Name, Phase, Backup, Created

    User->>Dashboard: Create new RestoreJob
    Dashboard->>Dashboard: Render form (name, namespace, backup picker, options)
    User->>Dashboard: Submit form with restore config
    Dashboard->>CRD: POST RestoreJob manifest
    CRD-->>Dashboard: Resource created
    Dashboard->>Controller: Request details page
    Controller->>Controller: Load restorejob-details factory
    Controller-->>Dashboard: Render Details tab (status, timestamps, target info)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 A RestoreJob hops into view,
With sidebars bright and dashboards new,
Backups dance in columns neat,
Restore forms make recovery complete!
From CRD to UI so fair,
Details bloom with tender care. 🌿

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: adding RestoreJob support to the dashboard with list, details page, and sidebar link.
Docstring Coverage ✅ Passed Docstring coverage is 85.71% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/dashboard-restores-review-fixes

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.

@gemini-code-assist

Copy link
Copy Markdown
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 extends the dashboard controller to fully support the RestoreJob resource. It introduces the necessary UI components for managing restore operations, including list and detail views, as well as a creation form. Additionally, it refines the sidebar management system to ensure that both dynamic and static sidebars are handled consistently across reconciliations.

Highlights

  • RestoreJob Dashboard Integration: Added full support for RestoreJob resources in the dashboard, including list views, detail pages, creation forms, and sidebar navigation.
  • Improved Sidebar Management: Implemented stable component IDs for sidebar entries and refactored the sidebar management logic to distinguish between dynamic CRD-backed sidebars and static ones, ensuring consistent labeling.
  • UI Enhancements: Simplified the details view for RestoreJob by rendering a 'Same as backup' fallback when the target application reference is omitted.

🧠 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.

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 (@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 (@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.

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. ↩

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

Copy link
Copy Markdown
Contributor

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 introduces comprehensive dashboard support for RestoreJob resources. Key changes include adding RestoreJobs to the sidebar, defining custom column layouts for resource listings, and implementing a detailed factory view for resource inspection. It also includes a form override for creating restore jobs with a backup selection dropdown. The sidebar controller was updated to better handle the distinction between dynamic and static sidebars, ensuring correct owner references. One minor feedback item suggests correcting the casing of an acronym in a JSONPath key to align with project naming conventions.

}),
antdFlexVertical("spec-options-keep-original-ip-mac-block", 4, []any{
antdText("options-keep-original-ip-mac-label", true, "Keep Original IP/MAC", nil),
parsedText("options-keep-original-ip-mac-value", "{reqsJsonPath[0]['.spec.options.keepOriginalIpAndMac']['-']}", nil),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

low

The JSONPath key keepOriginalIpAndMac uses a lowercase p in Ip. Following the project's convention (e.g., podIP in line 338, LoadBalancerIP in line 1143) and standard Go/Kubernetes naming for acronyms, this should likely be keepOriginalIPAndMac.

Suggested change
parsedText("options-keep-original-ip-mac-value", "{reqsJsonPath[0]['.spec.options.keepOriginalIpAndMac']['-']}", nil),
parsedText("options-keep-original-ip-mac-value", "{reqsJsonPath[0]['.spec.options.keepOriginalIPAndMac']['-']}", nil),

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
internal/controller/dashboard/static_refactored.go (1)

2068-2074: Optional: preserve kind.apiGroup/name when targetApplicationRef is set.

The current rendering drops back to "Same as backup" when .spec.targetApplicationRef.name is absent — good — but when the user actually fills the target application, they see only the name, losing the kind/apiGroup context that plan-details, backupjob-details, and backup-details display for their applicationRef blocks. If the template engine supports a combined expression, consider rendering the full identity when present and falling back to the friendly message otherwise (e.g. via two parsedText nodes inside a VisibilityContainer keyed on .spec.targetApplicationRef.name), matching the pattern used for applicationRef elsewhere in this file.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@internal/controller/dashboard/static_refactored.go` around lines 2068 - 2074,
The current parsedText in the antdFlexVertical block for targetApplicationRef
only shows a fallback ("Same as backup") and loses kind/apiGroup when a
targetApplicationRef is provided; update the UI to render the full identity when
.spec.targetApplicationRef.name exists by replacing the single parsedText with a
VisibilityContainer keyed on .spec.targetApplicationRef.name containing two
parsedText nodes: one visible when the name exists that composes
kind/apiGroup/name (matching the pattern used for applicationRef in
plan-details/backupjob-details/backup-details), and a second fallback parsedText
that renders "Same as backup" when the name is absent; keep the surrounding
antdFlexVertical and labels unchanged and reference parsedText,
VisibilityContainer, and targetApplicationRef in the change.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@internal/controller/dashboard/static_refactored.go`:
- Around line 2068-2074: The current parsedText in the antdFlexVertical block
for targetApplicationRef only shows a fallback ("Same as backup") and loses
kind/apiGroup when a targetApplicationRef is provided; update the UI to render
the full identity when .spec.targetApplicationRef.name exists by replacing the
single parsedText with a VisibilityContainer keyed on
.spec.targetApplicationRef.name containing two parsedText nodes: one visible
when the name exists that composes kind/apiGroup/name (matching the pattern used
for applicationRef in plan-details/backupjob-details/backup-details), and a
second fallback parsedText that renders "Same as backup" when the name is
absent; keep the surrounding antdFlexVertical and labels unchanged and reference
parsedText, VisibilityContainer, and targetApplicationRef in the change.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: dba607c2-f6c3-4328-85ca-1cf84549f4e9

📥 Commits

Reviewing files that changed from the base of the PR and between ee3a891 and 6105882.

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

@myasnikovdaniil

Copy link
Copy Markdown
Contributor Author

previous stale pr here #2387

@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label Apr 21, 2026
@myasnikovdaniil
myasnikovdaniil merged commit 358ac66 into main Apr 21, 2026
13 checks passed
@myasnikovdaniil
myasnikovdaniil deleted the feat/dashboard-restores-review-fixes branch April 21, 2026 15:28
myasnikovdaniil added a commit that referenced this pull request Apr 28, 2026
## What this PR does

- Adds a pre-commit hook and a dedicated GitHub Actions workflow that
run `make generate` at the repo root to catch drift in generated API
code (CRDs, DeepCopy, clients, RBAC) before it lands on main.
- Pre-commit hook is scoped to paths that actually affect codegen
(`api/`, `pkg/apis/`, `hack/update-codegen.sh`,
`hack/boilerplate.go.txt`) so unrelated commits are not slowed down.
- CI workflow (`.github/workflows/codegen-drift.yml`) installs Go from
`go.mod`, runs `make generate`, and fails on drift with an error
pointing contributors to the local fix.
- Includes one drift fix the check surfaced: `RestoreJobSpec.Options`
(added in #2437) had no `DeepCopyInto` handling — regenerated.

### Release note

```release-note
ci(api): add pre-commit hook and GitHub Actions workflow that verify generated API code (CRDs, deepcopy, clients, RBAC) is in sync with `make generate`.
```

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **Chores**
* Added a CI workflow that checks generated code during PRs and fails
the build if generated artifacts diverge.
* Added a pre-commit hook that runs generation checks locally to prevent
committing outdated generated files.
* Fixed deep-copy behavior for backup restore job specs so nested
options are correctly duplicated.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/feature Categorizes issue or PR as related to a new feature lgtm This PR has been approved by a maintainer size/L This PR changes 100-499 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants