Skip to content

Conversation

@Raubzeug
Copy link
Contributor

@Raubzeug Raubzeug commented Dec 2, 2025

closes #3157

Greptile Overview

Greptile Summary

This PR implements support for cluster_domain settings to enable cluster page redirects. The implementation adds a new optional setting that allows configuring redirect domains for clusters, which when present, will prepend the domain to cluster URLs and open links in new tabs.

Key Changes:

  • Added cluster_domain field to cluster settings schema and types
  • Created calculateClusterPath utility to centralize path calculation logic
  • Modified createHref to accept domain parameter for URL prefixing
  • Links open in new tab when clusterDomain is present
  • Feature gated behind uiFactory.useClusterDomain flag

Issues Found:

  • Critical logic issue: clusterDomain is ignored when useEmbeddedUi is true, meaning redirect won't work for embedded UI clusters

Confidence Score: 3/5

  • This PR has solid implementation but contains a logic bug that breaks redirect functionality for embedded UI clusters
  • The implementation is well-structured with proper typing and feature flagging. However, the logic bug in calculateClusterPath where clusterDomain is not applied to embedded UI paths means the redirect feature won't work for that use case. The rest of the code is clean and follows existing patterns.
  • Pay close attention to src/containers/Clusters/utils.ts - the redirect logic needs to handle embedded UI case

Important Files Changed

File Analysis

Filename Score Overview
src/containers/Clusters/utils.ts 5/5 New utility function to calculate cluster path with redirect domain support
src/containers/Clusters/columns.tsx 4/5 Refactored to use calculateClusterPath helper and conditionally opens links in new tab when clusterDomain is present
src/routes.ts 5/5 Added domain parameter support to createHref and getClusterPath for domain prefixing

Sequence Diagram

sequenceDiagram
    participant User
    participant ClustersPage
    participant calculateClusterPath
    participant getClusterPath
    participant createHref
    participant Browser

    User->>ClustersPage: Click cluster link
    ClustersPage->>calculateClusterPath: row data with clusterDomain
    
    alt useEmbeddedUi && backend
        calculateClusterPath->>calculateClusterPath: Return embedded UI path
        calculateClusterPath-->>ClustersPage: backend/monitoring
    else Standard UI
        calculateClusterPath->>getClusterPath: params, query, options, clusterDomain
        getClusterPath->>createHref: route, params, query, options, domain
        
        alt withBasename && basename
            createHref->>createHref: Normalize path with domain and basename
            createHref-->>getClusterPath: domain + basename + route
        else No basename
            createHref->>createHref: Prepend domain to route
            createHref-->>getClusterPath: domain + route
        end
        
        getClusterPath-->>calculateClusterPath: Full URL with domain
        calculateClusterPath-->>ClustersPage: Full path
    end
    
    alt clusterDomain present
        ClustersPage->>Browser: Open in new tab (_blank)
    else No clusterDomain
        ClustersPage->>Browser: Open in same tab
    end
Loading

CI Results

Test Status: ⚠️ FLAKY

📊 Full Report

Total Passed Failed Flaky Skipped
378 374 0 2 2
Test Changes Summary ⏭️2

⏭️ Skipped Tests (2)

  1. Scroll to row, get shareable link, navigate to URL and verify row is scrolled into view (tenant/diagnostics/tabs/queries.test.ts)
  2. Copy result button copies to clipboard (tenant/queryEditor/queryEditor.test.ts)

Bundle Size: ✅

Current: 62.33 MB | Main: 62.33 MB
Diff: +0.78 KB (0.00%)

✅ Bundle size unchanged.

ℹ️ CI Information
  • Test recordings for failed tests are available in the full report.
  • Bundle size is measured for the entire 'dist' directory.
  • 📊 indicates links to detailed reports.
  • 🔺 indicates increase, 🔽 decrease, and ✅ no change in bundle size.

Copilot AI review requested due to automatic review settings December 2, 2025 14:03
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

8 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile


const settingsSchema = z.object({
use_meta_proxy: z.boolean().optional(),
cluster_domain: z.string().optional(),
Copy link
Contributor

Choose a reason for hiding this comment

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

logic: Field naming mismatch: issue #3157 specifies redirectDomain but implementation uses cluster_domain

Suggested change
cluster_domain: z.string().optional(),
redirect_domain: z.string().optional(),
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/store/reducers/cluster/parseFields.ts
Line: 72:72

Comment:
**logic:** Field naming mismatch: issue #3157 specifies `redirectDomain` but implementation uses `cluster_domain`

```suggestion
    redirect_domain: z.string().optional(),
```

How can I resolve this? If you propose a fix, please make it concise.

Copilot finished reviewing on behalf of Raubzeug December 2, 2025 14:08
Copy link
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 adds support for cluster-specific domain configuration through a new cluster_domain setting in the meta API. The feature allows clusters to specify external domains that will be used in generated cluster links.

Key changes:

  • Adds cluster_domain field to cluster settings with validation
  • Introduces useClusterHost feature flag to control cluster domain usage
  • Updates routing to support host prefixes for external cluster domains
  • Modifies cluster table links to open in new tabs when cluster domain is set

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/uiFactory/types.ts Adds useClusterHost flag to gate cluster domain functionality
src/types/api/meta.ts Adds cluster_domain field to MetaClusterSettings interface
src/store/reducers/clusters/types.ts Adds clusterDomain field to PreparedCluster type
src/store/reducers/clusters/utils.ts Extracts and prepares clusterDomain from settings when feature flag is enabled
src/store/reducers/cluster/parseFields.ts Adds cluster_domain validation to settings Zod schema
src/routes.ts Adds host parameter to createHref and getClusterPath functions for domain prefixing
src/containers/Clusters/utils.ts Creates calculateClusterPath helper to centralize cluster path logic with domain support
src/containers/Clusters/columns.tsx Refactors cluster name and version links to use new helper and open in new tab for external domains

src/routes.ts Outdated
params?: Record<string, string | number | undefined>,
query: Query = {},
options: CreateHrefOptions = {},
host = '',
Copy link

Copilot AI Dec 2, 2025

Choose a reason for hiding this comment

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

The new host parameter lacks documentation. Consider adding a JSDoc comment to the function or inline documentation explaining what the host parameter is for (e.g., "Optional host/domain prefix to prepend to the generated URL").

Copilot uses AI. Check for mistakes.
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

8 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

@Raubzeug Raubzeug added this pull request to the merge queue Dec 2, 2025
Merged via the queue into main with commit bff31a0 Dec 2, 2025
9 checks passed
@Raubzeug Raubzeug deleted the cluster-domain branch December 2, 2025 15:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support cluster page redirects from cluster settings

3 participants