Skip to content

Conversation

@sniok
Copy link
Contributor

@sniok sniok commented Oct 2, 2025

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

@sniok sniok requested review from ashu8912 and Copilot October 3, 2025 13:30
Copy link

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

@sniok sniok force-pushed the refactor-flux branch 2 times, most recently from a8d8ad7 to a8c6abb Compare October 6, 2025 13:29
Copy link
Contributor

@illume illume left a 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?

@illume illume added the flux flux plugin related issues label Oct 7, 2025
Copy link
Member

@ashu8912 ashu8912 left a comment

Choose a reason for hiding this comment

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

Hii @sniok i was testing the PR, and realized that the helmreleases link in the sidebar is taking us to the custom resources page

@sniok
Copy link
Contributor Author

sniok commented Oct 13, 2025

Hii @sniok i was testing the PR, and realized that the helmreleases link in the sidebar is taking us to the custom resources page

oh, oops. That wasn't supposed to be there, I was just experimenting with something and left it there. Fixed

@illume
Copy link
Contributor

illume commented Oct 14, 2025

@sniok seems there's conflicts now from that other PR being merged.

Copy link
Contributor

@illume illume left a comment

Choose a reason for hiding this comment

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

🎉 thanks!

@illume illume merged commit f4447c4 into main Oct 17, 2025
7 checks passed
@illume illume deleted the refactor-flux branch October 17, 2025 21:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

flux flux plugin related issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants