Skip to content

refactor: unify backend k8s objects handler for UI#517

Merged
AndrejsPon00 merged 1 commit into
k0rdent:mainfrom
AndrejsPon00:refactor-ui-backend
Sep 9, 2025
Merged

refactor: unify backend k8s objects handler for UI#517
AndrejsPon00 merged 1 commit into
k0rdent:mainfrom
AndrejsPon00:refactor-ui-backend

Conversation

@AndrejsPon00
Copy link
Copy Markdown
Contributor

Part of #76

Copilot AI review requested due to automatic review settings September 9, 2025 10:03
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors backend Kubernetes object handlers for the UI by creating a unified generic handler that eliminates code duplication across different API endpoints. The changes introduce a type-safe generic approach to handling Kubernetes object lists.

Key changes:

  • Introduces a generic K8sObjectsHandler that can handle any Kubernetes object list type
  • Replaces four specific handlers with a single parameterized handler
  • Adds a utility function GetObjectsList for type-safe Kubernetes object retrieval

Reviewed Changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.

File Description
kof-operator/internal/server/handlers/k8s_objects_handler.go New generic handler that processes any Kubernetes object list type and returns a unified response format
kof-operator/internal/k8s/objects.go New utility function using reflection to create and populate Kubernetes object lists in a type-safe manner
kof-operator/cmd/main.go Updated API route registrations to use the generic handler with specific type parameters for each endpoint

Comment thread kof-operator/internal/k8s/objects.go Outdated
Comment thread kof-operator/internal/server/handlers/k8s_objects_handler.go Outdated
@AndrejsPon00 AndrejsPon00 force-pushed the refactor-ui-backend branch 2 times, most recently from 08957e8 to 1875cab Compare September 9, 2025 12:49
gmlexx
gmlexx previously approved these changes Sep 9, 2025
denis-ryzhkov
denis-ryzhkov previously approved these changes Sep 9, 2025
Comment thread kof-operator/webapp/collector/src/components/pages/dashboards/DashboardList.tsx Outdated
@AndrejsPon00 AndrejsPon00 added this pull request to the merge queue Sep 9, 2025
Merged via the queue into k0rdent:main with commit fc37df0 Sep 9, 2025
5 checks passed
@github-project-automation github-project-automation Bot moved this to Done in k0rdent Sep 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

4 participants