Skip to content

fix(new-webui): Remove duplicate anchor element from log viewer link.#993

Merged
davemarco merged 3 commits into
y-scope:mainfrom
davemarco:fix2
Jun 10, 2025
Merged

fix(new-webui): Remove duplicate anchor element from log viewer link.#993
davemarco merged 3 commits into
y-scope:mainfrom
davemarco:fix2

Conversation

@davemarco

@davemarco davemarco commented Jun 9, 2025

Copy link
Copy Markdown
Contributor

Description

Browser console was giving error that there were two nested links. This was caused by wrapping reactor router link in antd link for theming purposes. I removed antd link and just passed in the correct blue from the global theme.

Checklist

  • The PR satisfies the contribution guidelines.
  • This is a breaking change and that has been indicated in the PR title, OR this isn't a
    breaking change.
  • Necessary docs have been updated, OR no docs need to be updated.

Validation performed

Error gone.

Summary by CodeRabbit

  • Style
    • Updated the appearance of log viewer links to better match the current theme, ensuring consistent link colouring across the interface.

@davemarco davemarco requested a review from a team as a code owner June 9, 2025 21:28
@coderabbitai

coderabbitai Bot commented Jun 9, 2025

Copy link
Copy Markdown
Contributor

Walkthrough

The LogViewerLink component was refactored to use an explicit function body and now applies the theme's link colour using Ant Design's theme.useToken(). The wrapper was changed from Typography.Link to Typography.Text, with the link's text colour set via an inline style. No changes were made to the component's signature.

Changes

File(s) Change Summary
components/log-viewer-webui/client/src/pages/SearchPage/SearchResults/SearchResultsTable/Message/LogViewerLink.tsx Refactored component to use explicit return, replaced Typography.Link with Typography.Text, applied theme link colour using theme.useToken().

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant LogViewerLink
    participant AntDesignTheme

    User ->> LogViewerLink: Render with props (filePath, logEventIdx, streamId)
    LogViewerLink ->> AntDesignTheme: Call theme.useToken()
    AntDesignTheme -->> LogViewerLink: Return theme tokens (including colorLink)
    LogViewerLink ->> User: Render link with style colour from theme token
Loading
✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@davemarco davemarco requested a review from junhaoliao June 9, 2025 21:28
@davemarco davemarco changed the title fix(new-webui): Remove duplicate link element from log viewer link. fix(new-webui): Remove duplicate anchor element from log viewer link. Jun 9, 2025
junhaoliao
junhaoliao previously approved these changes Jun 10, 2025

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 4

📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1c465e4 and 707a2c8.

📒 Files selected for processing (1)
  • components/log-viewer-webui/client/src/pages/SearchPage/SearchResults/SearchResultsTable/Message/LogViewerLink.tsx (2 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
`**/*.{cpp,hpp,java,js,jsx,tpp,ts,tsx}`: - Prefer `false == ` rather than `!`.

**/*.{cpp,hpp,java,js,jsx,tpp,ts,tsx}: - Prefer false == <expression> rather than !<expression>.

  • components/log-viewer-webui/client/src/pages/SearchPage/SearchResults/SearchResultsTable/Message/LogViewerLink.tsx
🔇 Additional comments (3)
components/log-viewer-webui/client/src/pages/SearchPage/SearchResults/SearchResultsTable/Message/LogViewerLink.tsx (3)

5-8: Skip import adjustments. The import of theme, Tooltip, and Typography from antd aligns with the component’s usage and is correctly tree-shaken.


33-34: Verify Ant Design version compatibility for theme.useToken(). The theme.useToken() hook is available only in Ant Design v5+. Please ensure the project dependency is on v5 or later to avoid runtime errors.


39-41:

Details

❌ Incorrect review comment

Ensure correct Link import source. Verify that Link is imported from "react-router-dom" rather than "react-router", or update the import path to match the routing library in use.


🏁 Script executed:

#!/bin/bash
rg "^import.*Link" -n components/log-viewer-webui/client/src/pages/SearchPage/SearchResults/SearchResultsTable/Message/LogViewerLink.tsx

Length of output: 225


No change needed for Link import
The Link component is correctly imported from "react-router" in line with our React Router v7.4.1 setup. You can safely ignore this suggestion.

Likely an incorrect or invalid review comment.

Comment on lines +44 to +49
pathname: "/streamFile",
search:
`?type=${encodeURIComponent(STREAM_TYPE)}` +
`&streamId=${encodeURIComponent(streamId)}` +
`&logEventIdx=${encodeURIComponent(logEventIdx)}`,
}}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Use URLSearchParams for query construction. Refactor the search string to use:

const params = new URLSearchParams({
  type: STREAM_TYPE,
  streamId,
  logEventIdx: String(logEventIdx),
}).toString();

This improves readability and maintainability.

🤖 Prompt for AI Agents
In
components/log-viewer-webui/client/src/pages/SearchPage/SearchResults/SearchResultsTable/Message/LogViewerLink.tsx
around lines 44 to 49, the query string for the search property is manually
constructed using string concatenation and encodeURIComponent calls. Refactor
this by creating a URLSearchParams instance with an object containing the keys
type, streamId, and logEventIdx (converted to string), then call toString() on
it to generate the query string. Replace the current search string with this
URLSearchParams-generated string to improve readability and maintainability.

Comment on lines +51 to +52
<LinkOutlined/>
{fileText}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Enhance icon accessibility. Add an aria-label to the <LinkOutlined /> icon (or set aria-hidden="true") to ensure screen readers skip decorative elements.

🤖 Prompt for AI Agents
In
components/log-viewer-webui/client/src/pages/SearchPage/SearchResults/SearchResultsTable/Message/LogViewerLink.tsx
at lines 51 to 52, the <LinkOutlined /> icon lacks accessibility attributes. Add
an aria-label describing the icon's purpose or set aria-hidden="true" on the
<LinkOutlined /> component to ensure screen readers skip this decorative
element, improving accessibility.

Comment on lines +42 to +43
target={"_blank"}
to={{

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Mitigate reverse tabnapping risk. Add rel="noopener noreferrer" alongside target="_blank" to prevent potential security vulnerabilities.

🤖 Prompt for AI Agents
In
components/log-viewer-webui/client/src/pages/SearchPage/SearchResults/SearchResultsTable/Message/LogViewerLink.tsx
around lines 42 to 43, the anchor element uses target="_blank" without
rel="noopener noreferrer", which exposes a reverse tabnapping security risk. Add
rel="noopener noreferrer" to the anchor or link element alongside
target="_blank" to mitigate this vulnerability.

Comment on lines +37 to +38
<Tooltip title={"Open file"}>
<Typography.Text>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Simplify JSX attribute. You can replace title={"Open file"} with title="Open file" for cleaner and more idiomatic JSX.

🤖 Prompt for AI Agents
In
components/log-viewer-webui/client/src/pages/SearchPage/SearchResults/SearchResultsTable/Message/LogViewerLink.tsx
at lines 37 to 38, simplify the JSX attribute by replacing title={"Open file"}
with title="Open file" to make the code cleaner and more idiomatic.

@davemarco davemarco requested a review from junhaoliao June 10, 2025 18:20
@davemarco davemarco merged commit 792c32f into y-scope:main Jun 10, 2025
8 checks passed
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.

2 participants