kloudlite / web

Kloudlite Web
http://kloudlite.io
GNU Affero General Public License v3.0
2 stars 1 forks source link

:zap: Improved cluster-status #310

Closed abdheshnayak closed 1 month ago

abdheshnayak commented 1 month ago

Summary by Sourcery

Improve cluster status fetching by introducing a new hook useClusterStatusV3 and a ClusterStatusProvider for better performance and real-time updates. This replaces the previous version and enhances the overall efficiency of cluster status management.

New Features:

Enhancements:

sourcery-ai[bot] commented 1 month ago

Reviewer's Guide by Sourcery

This pull request improves the cluster status fetching mechanism by introducing a new hook useClusterStatusV3 and updating the environment resources view to use this new implementation. The changes aim to enhance performance and provide more accurate cluster status information.

Sequence diagram for Cluster Status Fetching

sequenceDiagram
    actor User
    participant UI
    participant useClusterStatusV3
    participant API
    User->>UI: View Environment Resources
    UI->>useClusterStatusV3: Fetch Cluster Status
    useClusterStatusV3->>API: getClusterStatus(name)
    API-->>useClusterStatusV3: Return lastOnlineAt
    useClusterStatusV3-->>UI: Update Cluster Status
    UI-->>User: Display Updated Status

File-Level Changes

Change Details Files
Introduced a new cluster status fetching mechanism
  • Created a new hook useClusterStatusV3 for improved cluster status fetching
  • Implemented a new ClusterStatusProvider component
  • Added a new GraphQL query consoleGetClusterStatus for fetching individual cluster status
  • Updated the findClusterStatusv3 function to determine cluster online status
src/apps/console/hooks/use-cluster-status-v3.tsx
src/apps/console/server/gql/queries/cluster-queries.ts
gql-queries-generator/doc/queries.graphql
src/apps/console/hooks/use-cluster-status.tsx
Updated environment resources view to use the new cluster status mechanism
  • Replaced useClusterStatusV2 with useClusterStatusV3 in the ListView component
  • Updated the rendering logic for cluster status badges
  • Implemented debounced logging of cluster status for debugging purposes
src/apps/console/routes/_main+/$account+/environments/environment-resources-v2.tsx
Integrated the new ClusterStatusProvider into the application
  • Wrapped the application with ClusterStatusProvider in the root component
  • Updated imports to include the new ClusterStatusProvider
src/apps/console/root.tsx

Tips and commands #### Interacting with Sourcery - **Trigger a new review:** Comment `@sourcery-ai review` on the pull request. - **Continue discussions:** Reply directly to Sourcery's review comments. - **Generate a GitHub issue from a review comment:** Ask Sourcery to create an issue from a review comment by replying to it. #### Customizing Your Experience Access your [dashboard](https://app.sourcery.ai) to: - Enable or disable review features such as the Sourcery-generated pull request summary, the reviewer's guide, and others. - Change the review language. - Add, remove or edit custom review instructions. - Adjust other review settings. #### Getting Help - [Contact our support team](mailto:support@sourcery.ai) for questions or feedback. - Visit our [documentation](https://docs.sourcery.ai) for detailed guides and information. - Keep in touch with the Sourcery team by following us on [X/Twitter](https://x.com/SourceryAI), [LinkedIn](https://www.linkedin.com/company/sourcery-ai/) or [GitHub](https://github.com/sourcery-ai).