kloudlite / web

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

Add no logs and metrics banner when cluster is offline #317

Closed nxtCoder19 closed 1 month ago

nxtCoder19 commented 1 month ago

Summary by Sourcery

Add a feature to display a banner indicating the unavailability of logs and metrics when the application is not associated with a cluster or when the cluster is offline. Enhance the system by checking the cluster's status to conditionally render logs and metrics.

New Features:

Enhancements:

sourcery-ai[bot] commented 1 month ago

Reviewer's Guide by Sourcery

This pull request adds functionality to display a "No Logs and Metrics" banner when a cluster is offline or when dealing with template applications. The changes primarily affect the logs and metrics routes for both regular applications and managed services.

Sequence diagram for displaying No Logs and Metrics banner

sequenceDiagram
    participant User
    participant LogsAndMetrics
    participant NoLogsAndMetricsBanner
    User->>LogsAndMetrics: Access logs and metrics page
    alt Cluster is offline or template app
        LogsAndMetrics->>NoLogsAndMetricsBanner: Render banner
        NoLogsAndMetricsBanner-->>User: Display "No Logs and Metrics" message
    else Cluster is online
        LogsAndMetrics-->>User: Display logs and metrics
    end

Class diagram for NoLogsAndMetricsBanner component

classDiagram
    class NoLogsAndMetricsBanner {
        +NoLogsAndMetricsBanner(title: string, description: string)
    }
    NoLogsAndMetricsBanner --> motion: uses
    NoLogsAndMetricsBanner --> Pulsable: uses
    NoLogsAndMetricsBanner --> EmptyState: uses
    NoLogsAndMetricsBanner --> SmileySad: uses
    NoLogsAndMetricsBanner --> Wrapper: uses

File-Level Changes

Change Details Files
Implement cluster status check and conditional rendering of NoLogsAndMetricsBanner
  • Add useClusterStatusV3 hook to check cluster status
  • Implement conditional rendering based on cluster status
  • Add checks for template applications and offline clusters
  • Create and use NoLogsAndMetricsBanner component for displaying messages
src/apps/console/routes/_main+/$account+/env+/$environment+/app+/$app+/logs-n-metrics/route.tsx
src/apps/console/routes/_main+/$account+/msvc+/$msv+/logs-n-metrics/route.tsx
Create new NoLogsAndMetricsBanner component
  • Implement NoLogsAndMetricsBanner as a reusable component
  • Use Framer Motion for animation effects
  • Utilize existing EmptyState component for layout
src/apps/console/page-components/no-logs-banner.tsx
Update imports and add new dependencies
  • Import new hooks and components
  • Add ApexOptions type import
src/apps/console/routes/_main+/$account+/env+/$environment+/app+/$app+/logs-n-metrics/route.tsx
src/apps/console/routes/_main+/$account+/msvc+/$msv+/logs-n-metrics/route.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. - **Generate a pull request title:** Write `@sourcery-ai` anywhere in the pull request title to generate a title at any time. - **Generate a pull request summary:** Write `@sourcery-ai summary` anywhere in the pull request body to generate a PR summary at any time. You can also use this command to specify where the summary should be inserted. #### 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).