Skip to content

feat(backups): add page for cluster administration#21

Open
Andrey Kolkov (androndo) wants to merge 2 commits into
mainfrom
feat/backup-class-page
Open

feat(backups): add page for cluster administration#21
Andrey Kolkov (androndo) wants to merge 2 commits into
mainfrom
feat/backup-class-page

Conversation

@androndo
Copy link
Copy Markdown
Contributor

Represent backups configuration for cluster admins:

  • system storage status and artifacts
  • configuration of a backup classes
image

@github-actions github-actions Bot added size/XL This PR changes 500-999 lines, ignoring generated files area/forms Issues or PRs related to RJSF schema forms and widgets (backup, external-ips, storage-class, etc.) kind/feature Categorizes issue or PR as related to a new feature labels May 28, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 28, 2026

Warning

Review limit reached

@androndo, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 58 minutes and 28 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 74a7512f-f1a9-4801-9059-0fa649f1a75d

📥 Commits

Reviewing files that changed from the base of the PR and between 4570d44 and 19c4a0f.

📒 Files selected for processing (13)
  • apps/console/src/components/SchemaForm.test.tsx
  • apps/console/src/components/SchemaForm.tsx
  • apps/console/src/hooks/useBackupClassAdminAccess.ts
  • apps/console/src/routes/BackupClassAdminGuard.test.tsx
  • apps/console/src/routes/BackupClassAdminGuard.tsx
  • apps/console/src/routes/BackupClassCreatePage.tsx
  • apps/console/src/routes/BackupClassDetailPage.tsx
  • apps/console/src/routes/BackupClassEditPage.tsx
  • apps/console/src/routes/BackupClassListPage.tsx
  • apps/console/src/routes/BackupResourceListPage.tsx
  • apps/console/src/routes/ConsolePage.tsx
  • apps/console/src/routes/sidebar-sections.test.tsx
  • apps/console/src/routes/sidebar-sections.tsx
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/backup-class-page

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.

Signed-off-by: Andrey Kolkov <androndo@gmail.com>
Copy link
Copy Markdown

@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 introduces administration capabilities for cluster-scoped Backup Classes, including pages for listing, creating, viewing, and editing backup classes, protected by a permission-based route guard. It also updates the SchemaForm component to recursively bind custom key/value editors to additionalProperties maps nested inside array items. The reviewer feedback highlights two issues in BackupClassListPage.tsx where API errors are not handled in SystemBackupBucketPanel and BackupArtifactsCountPanel, which could lead to misleading UI states (e.g., showing "Not configured" or a count of "0" instead of the actual error).

Comment on lines +15 to +37
const { data: bucket, isLoading } = useK8sGet<ApplicationInstance>({
apiGroup: "apps.cozystack.io",
apiVersion: "v1alpha1",
plural: "buckets",
name: "cozy-backups",
namespace: "tenant-root",
})
// Reuse the Bucket ApplicationDefinition's own icon (the same red S3
// glyph rendered on deployed-app cards) so the bucket here is visually
// recognisable as a Bucket app.
const { data: appDefs } = useApplicationDefinitions()
const bucketAd = appDefs?.items.find((d) => d.spec?.application.kind === "Bucket")
const bucketIcon = bucketAd ? iconDataUrl(bucketAd) : undefined

if (isLoading) {
return (
<Section className="h-full" bodyClassName="p-0">
<div className="flex h-full items-center gap-2 p-4 text-sm text-slate-500">
<Spinner /> Loading system backup bucket…
</div>
</Section>
)
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The SystemBackupBucketPanel component does not handle the error state returned by useK8sGet. If the API request fails (e.g., due to RBAC issues or network errors), bucket will be undefined, causing the component to incorrectly display that the bucket is "Not configured" or "Not deployed on this cluster". Handling the error state explicitly ensures the user is presented with the actual error message instead of a misleading status.

  const { data: bucket, isLoading, error } = useK8sGet<ApplicationInstance>({
    apiGroup: "apps.cozystack.io",
    apiVersion: "v1alpha1",
    plural: "buckets",
    name: "cozy-backups",
    namespace: "tenant-root",
  })
  // Reuse the Bucket ApplicationDefinition's own icon (the same red S3
  // glyph rendered on deployed-app cards) so the bucket here is visually
  // recognisable as a Bucket app.
  const { data: appDefs } = useApplicationDefinitions()
  const bucketAd = appDefs?.items.find((d) => d.spec?.application.kind === "Bucket")
  const bucketIcon = bucketAd ? iconDataUrl(bucketAd) : undefined

  if (isLoading) {
    return (
      <Section className="h-full" bodyClassName="p-0">
        <div className="flex h-full items-center gap-2 p-4 text-sm text-slate-500">
          <Spinner /> Loading system backup bucket…
        </div>
      </Section>
    )
  }

  if (error) {
    return (
      <Section className="h-full" bodyClassName="p-0">
        <div className="flex h-full items-center gap-2 p-4 text-sm text-red-600">
          Failed to load system backup bucket: {(error as Error).message}
        </div>
      </Section>
    )
  }

Comment on lines +101 to +116
function BackupArtifactsCountPanel() {
const { data, isLoading } = useK8sList<K8sResource>({
apiGroup: "backups.cozystack.io",
apiVersion: "v1alpha1",
plural: "backups",
})

if (isLoading) {
return (
<Section className="h-full" bodyClassName="p-0">
<div className="flex h-full items-center gap-2 p-4 text-sm text-slate-500">
<Spinner /> Loading backup artifacts…
</div>
</Section>
)
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The BackupArtifactsCountPanel component does not handle the error state returned by useK8sList. If the API request fails, the component will silently fall back to displaying 0 backup artifacts, which is misleading to the administrator. Handling the error state explicitly provides a clear indication of the failure.

function BackupArtifactsCountPanel() {
  const { data, isLoading, error } = useK8sList<K8sResource>({
    apiGroup: "backups.cozystack.io",
    apiVersion: "v1alpha1",
    plural: "backups",
  })

  if (isLoading) {
    return (
      <Section className="h-full" bodyClassName="p-0">
        <div className="flex h-full items-center gap-2 p-4 text-sm text-slate-500">
          <Spinner /> Loading backup artifacts…
        </div>
      </Section>
    )
  }

  if (error) {
    return (
      <Section className="h-full" bodyClassName="p-0">
        <div className="flex h-full items-center gap-2 p-4 text-sm text-red-600">
          Failed to load backup artifacts: {(error as Error).message}
        </div>
      </Section>
    )
  }

@github-actions github-actions Bot added size/XXL This PR changes 1000+ lines, ignoring generated files and removed size/XL This PR changes 500-999 lines, ignoring generated files labels May 29, 2026
Signed-off-by: Andrey Kolkov <androndo@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/forms Issues or PRs related to RJSF schema forms and widgets (backup, external-ips, storage-class, etc.) kind/feature Categorizes issue or PR as related to a new feature size/XXL This PR changes 1000+ lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant