Repository navigation
feat(dashboard): add RestoreJob list, add page, and sidebar link - #2437
Conversation
Signed-off-by: Andrey Kolkov <[email protected]>
- 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]>
📝 WalkthroughWalkthroughThe 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
Sequence DiagramsequenceDiagram
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)
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
Summary of ChangesHello, 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
🧠 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 AssistThe 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
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 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
|
There was a problem hiding this comment.
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), |
There was a problem hiding this comment.
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.
| 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), |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
internal/controller/dashboard/static_refactored.go (1)
2068-2074: Optional: preservekind.apiGroup/namewhentargetApplicationRefis set.The current rendering drops back to "Same as backup" when
.spec.targetApplicationRef.nameis absent — good — but when the user actually fills the target application, they see only the name, losing thekind/apiGroupcontext thatplan-details,backupjob-details, andbackup-detailsdisplay for theirapplicationRefblocks. 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 twoparsedTextnodes inside aVisibilityContainerkeyed on.spec.targetApplicationRef.name), matching the pattern used forapplicationRefelsewhere 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
📒 Files selected for processing (2)
internal/controller/dashboard/sidebar.gointernal/controller/dashboard/static_refactored.go
|
previous stale pr here #2387 |
## 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 -->
What this PR does
RestoreJobin the dashboard controller.spec.targetApplicationRefon the details view instead of concatenating three missing-path fallbacks.stock-project-factory-*-detailssidebars (kube-*,plan,backupjob,backup,restorejob) as static so they pick up consistent managed-by labels.Release note
Test plan
Previous PR
#2387
Summary by CodeRabbit
Release Notes