Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@davemarco
Copy link
Contributor

@davemarco davemarco commented Jun 6, 2025

This PR should be merged after #967 , since there is new support for determining clp-s vs. clp in that PR

Description

Clp-s does not currently have file path stored, at least according to old webui. Instead we show placeholder "Original File". Previously text was blank. Now matches old webui
Screenshot 2025-06-06 at 4 46 15 PM

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

Text is rendered

Summary by CodeRabbit

  • Refactor

    • Renamed the prop from filePath to fileText in relevant components for improved clarity.
    • Updated display text for file links to use the new fileText prop.
  • Style

    • Adjusted how file information is shown in search results, with the displayed file text now varying based on storage engine settings.

@davemarco davemarco requested a review from a team as a code owner June 6, 2025 20:47
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jun 6, 2025

Walkthrough

The changes standardize the prop name from filePath to fileText across the LogViewerLink and Message components, updating interfaces, destructuring, and usage. Additionally, logic in the table column definition now conditionally sets fileText based on the storage engine, affecting how file information is displayed in the UI.

Changes

File(s) Change Summary
.../SearchPage/SearchResults/SearchResultsTable/Message/LogViewerLink.tsx Renamed filePath prop to fileText in interface, destructuring, JSDoc, and JSX rendering.
.../SearchPage/SearchResults/SearchResultsTable/Message/index.tsx Renamed filePath prop to fileText in interface, destructuring, JSDoc, and usage; updated prop passed to LogViewerLink.
.../SearchPage/SearchResults/SearchResultsTable/typings.tsx Updated Message usage: replaced filePath with fileText, conditionally set based on storage engine configuration.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant SearchResultsTable
    participant Message
    participant LogViewerLink

    User->>SearchResultsTable: View search results
    SearchResultsTable->>Message: Render Message with fileText (conditional value)
    Message->>LogViewerLink: Pass fileText prop
    LogViewerLink->>User: Render link with fileText as display text
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 6, 2025 20:47
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between c69d4cf and 239f929.

📒 Files selected for processing (4)
  • components/log-viewer-webui/client/src/config/index.ts (1 hunks)
  • components/log-viewer-webui/client/src/pages/SearchPage/SearchResults/SearchResultsTable/Message/LogViewerLink.tsx (2 hunks)
  • components/log-viewer-webui/client/src/pages/SearchPage/SearchResults/SearchResultsTable/Message/index.tsx (2 hunks)
  • components/log-viewer-webui/client/src/pages/SearchPage/SearchResults/SearchResultsTable/typings.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/index.tsx
  • components/log-viewer-webui/client/src/pages/SearchPage/SearchResults/SearchResultsTable/Message/LogViewerLink.tsx
  • components/log-viewer-webui/client/src/pages/SearchPage/SearchResults/SearchResultsTable/typings.tsx
  • components/log-viewer-webui/client/src/config/index.ts
🧬 Code Graph Analysis (1)
components/log-viewer-webui/client/src/pages/SearchPage/SearchResults/SearchResultsTable/typings.tsx (2)
components/log-viewer-webui/client/src/pages/SearchPage/SearchResults/SearchResultsTable/utils.ts (1)
  • getStreamId (28-28)
components/log-viewer-webui/client/src/config/index.ts (2)
  • CLP_STORAGE_ENGINES (22-22)
  • SETTINGS_STORAGE_ENGINE (23-23)
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: lint-check (ubuntu-latest)
  • GitHub Check: lint-check (macos-latest)
🔇 Additional comments (7)
components/log-viewer-webui/client/src/config/index.ts (2)

17-19: LGTM! Clean conditional logic.

The ternary operator correctly determines the stream type based on the storage engine. The logic is clear and follows the expected behaviour for different storage engines.


1-1:

✅ Verification successful

Verify the settings.json file structure.

The import assumes a specific structure in the settings.json file with a ClpStorageEngine property. Ensure this file exists and has the expected structure.


🏁 Script executed:

#!/bin/bash
# Description: Verify settings.json exists and contains ClpStorageEngine property
# Expected: Find settings.json file and check its structure

fd "settings.json" --type f --exec cat {}

Length of output: 1552


Confirmed: settings.json includes the expected ClpStorageEngine property.

  • The file at components/log-viewer-webui/client/settings.json exists and its public section contains "ClpStorageEngine": "clp", matching the import in config/index.ts.
components/log-viewer-webui/client/src/pages/SearchPage/SearchResults/SearchResultsTable/Message/LogViewerLink.tsx (1)

14-14: LGTM! Consistent prop renaming.

The prop renaming from filePath to fileText is consistently applied across the interface definition, JSDoc comments, parameter destructuring, and JSX rendering. The change aligns well with the new functionality where the text may not always represent a file path.

Also applies to: 23-23, 29-29, 47-47

components/log-viewer-webui/client/src/pages/SearchPage/SearchResults/SearchResultsTable/Message/index.tsx (1)

14-14: LGTM! Consistent prop renaming throughout the component.

The prop renaming is properly applied across all areas: interface definition, JSDoc documentation, parameter destructuring, and prop passing to the child component. The changes maintain consistency with the LogViewerLink component updates.

Also applies to: 24-24, 32-32, 50-50

components/log-viewer-webui/client/src/pages/SearchPage/SearchResults/SearchResultsTable/typings.tsx (3)

5-8: LGTM! Clean imports from the config module.

The imports correctly bring in the necessary constants from the configuration module to implement the conditional logic.


55-59: Verify the placeholder text matches the PR requirements.

The conditional logic correctly distinguishes between storage engines, but the placeholder text " Original file" has a leading space. Ensure this spacing is intentional and matches the design requirements.

According to the PR objectives, the placeholder should display "Original File" (with capital 'F'). The current implementation shows " Original file" (with lowercase 'f' and leading space). Please confirm if this matches the intended design.


56-57: LGTM! Correct conditional logic implementation.

The conditional logic properly checks if the storage engine is CLP and uses the original file path when true, otherwise falls back to the placeholder text. This correctly implements the feature requirements.

CLP_S = "clp-s",
}

const SETTINGS_STORAGE_ENGINE = settings.ClpStorageEngine as CLP_STORAGE_ENGINES;
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Consider adding runtime validation for the type assertion.

The type assertion as CLP_STORAGE_ENGINES could fail at runtime if the settings file contains an invalid value. Consider adding validation to ensure the value is one of the enum members.

-const SETTINGS_STORAGE_ENGINE = settings.ClpStorageEngine as CLP_STORAGE_ENGINES;
+const SETTINGS_STORAGE_ENGINE = (() => {
+    const engine = settings.ClpStorageEngine;
+    if (false == Object.values(CLP_STORAGE_ENGINES).includes(engine as CLP_STORAGE_ENGINES)) {
+        throw new Error(`Invalid storage engine: ${engine}. Must be one of: ${Object.values(CLP_STORAGE_ENGINES).join(", ")}`);
+    }
+    return engine as CLP_STORAGE_ENGINES;
+})();
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const SETTINGS_STORAGE_ENGINE = settings.ClpStorageEngine as CLP_STORAGE_ENGINES;
// before:
// const SETTINGS_STORAGE_ENGINE = settings.ClpStorageEngine as CLP_STORAGE_ENGINES;
const SETTINGS_STORAGE_ENGINE = (() => {
const engine = settings.ClpStorageEngine;
if (false == Object.values(CLP_STORAGE_ENGINES).includes(engine as CLP_STORAGE_ENGINES)) {
throw new Error(
`Invalid storage engine: ${engine}. ` +
`Must be one of: ${Object.values(CLP_STORAGE_ENGINES).join(", ")}`
);
}
return engine as CLP_STORAGE_ENGINES;
})();
🤖 Prompt for AI Agents
In components/log-viewer-webui/client/src/config/index.ts at line 12, the type
assertion to CLP_STORAGE_ENGINES may cause runtime errors if the settings value
is invalid. Add a runtime check to verify that settings.ClpStorageEngine is a
valid member of the CLP_STORAGE_ENGINES enum before assigning it to
SETTINGS_STORAGE_ENGINE. If the value is invalid, handle the error
appropriately, such as by throwing an error or falling back to a default enum
value.

fileText={
CLP_STORAGE_ENGINES.CLP === SETTINGS_STORAGE_ENGINE ?
record.orig_file_path :
" Original file"
Copy link
Member

Choose a reason for hiding this comment

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

Is the leading space intended?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes it looks better with it. I tried both

Copy link
Member

@junhaoliao junhaoliao left a comment

Choose a reason for hiding this comment

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

left one question

also i believe this depends on #967 so let's merge 967 first

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 239f929 and 332090b.

📒 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
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: build (macos-latest)
  • GitHub Check: lint-check (macos-latest)
  • GitHub Check: lint-check (ubuntu-latest)
🔇 Additional comments (3)
components/log-viewer-webui/client/src/pages/SearchPage/SearchResults/SearchResultsTable/Message/LogViewerLink.tsx (3)

13-17: Consistent prop renaming – looks good.

The interface now correctly uses fileText instead of the old filePath, matching the higher-level component updates. No other adjustments are needed here.


28-32: Destructuring update is correct.

The component signature now pulls in fileText instead of filePath. This matches the interface and downstream usage.


46-48: Rendering the placeholder text – approved.

The placeholder fileText is now displayed alongside the icon, aligning with the old UI behaviour for clp-s.

Comment on lines 19 to 27
/**
* Render a link to the log viewer with open file.
* Render a link to the log viewer.
*
* @param props
* @param props.filePath
* @param props.fileText
* @param props.logEventIdx
* @param props.streamId
* @return
*/
Copy link
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

JSDoc @param missing description.

You’ve updated the tag to @param props.fileText, but there’s no accompanying description. Consider adding a brief note to explain what fileText represents (e.g. the link label).

🤖 Prompt for AI Agents
In
components/log-viewer-webui/client/src/pages/SearchPage/SearchResults/SearchResultsTable/Message/LogViewerLink.tsx
around lines 19 to 27, the JSDoc @param tag for props.fileText lacks a
description. Add a concise explanation for fileText, such as "the link label
text," to clarify its purpose in the component's documentation.

@davemarco davemarco merged commit 2fdc551 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