-
Notifications
You must be signed in to change notification settings - Fork 35
flux: Define all resource classes that extend KubeObject, refactor to use useGet and useList methods #400
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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 the Flux plugin to define all resource classes as KubeObject extensions in a centralized Resources.tsx file and standardizes the use of useGet and useList methods throughout the codebase.
- Replaces function-based resource class creation with KubeObject class extensions for better type safety and consistency
- Consolidates all resource definitions into a single Resources.tsx file for improved maintainability
- Simplifies component code by using the standardized useGet and useList methods instead of custom state management
Reviewed Changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
flux/src/common/Resources.tsx | Defines all Flux resource classes extending KubeObject with proper static properties |
flux/src/sources/SourceSingle.tsx | Refactors to use getSourceClassByPluralName helper function |
flux/src/sources/SourceList.tsx | Removes function-based class definitions and uses imported resource classes |
flux/src/sources/Source.tsx | Simplifies useSource hook to use useGet method and removes GetSource component |
flux/src/overview/index.tsx | Refactors to use direct useList calls with resource classes and helper functions |
flux/src/notifications/NotificationSingle.tsx | Updates to use imported resource classes and useGet method |
flux/src/notifications/NotificationList.tsx | Removes function-based definitions and uses imported classes with useList |
flux/src/mapView.tsx | Updates resource class imports and adds weight properties to nodes |
flux/src/kustomizations/KustomizationSingle.tsx | Simplifies to use Kustomization class and useGet method |
flux/src/kustomizations/KustomizationList.tsx | Removes function-based definition and uses imported Kustomization class |
flux/src/image-automation/ImageAutomationSingle.tsx | Updates to use imported resource classes |
flux/src/image-automation/ImageAutomationList.tsx | Removes function-based definitions and uses imported classes |
flux/src/helpers/index.tsx | Adds gridTemplate properties to table columns |
flux/src/helm-releases/HelmReleaseSingle.tsx | Simplifies to use HelmRelease class and useGet method |
flux/src/helm-releases/HelmReleaseList.tsx | Removes function-based definition and uses imported HelmRelease class |
flux/src/actions/index.tsx | Updates SyncWithSourceAction to use useSource hook |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Signed-off-by: Oleksandr Dubenko <[email protected]>
Signed-off-by: Oleksandr Dubenko <[email protected]>
Signed-off-by: Oleksandr Dubenko <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please provide a PR description/steps to test/issue link?
I've noticed that in the development mode flux page becomes unresponsive and hangs.
This PR refactors how resource classes are created and used. Instead of recreating classes on each rerender it now defines all classes in Resources.tsx
And in all pages it now uses Class.useList and Class.useGet functions instead of old ones
Testing
Click through all flux-registered pages and verify that lists are still displayed as usual