Skip to content

feat(webui): Initialize root directory on file lister mount (resolves #1780).#1786

Merged
junhaoliao merged 3 commits into
y-scope:mainfrom
junhaoliao:load-root-file-lister
Dec 16, 2025
Merged

feat(webui): Initialize root directory on file lister mount (resolves #1780).#1786
junhaoliao merged 3 commits into
y-scope:mainfrom
junhaoliao:load-root-file-lister

Conversation

@junhaoliao

@junhaoliao junhaoliao commented Dec 16, 2025

Copy link
Copy Markdown
Member

Description

This PR improves the UX of the PathsSelectFormItem component by automatically loading and expanding the root directory ("/") when the component mounts. Previously, users had to manually click on the root node to view its contents, which created unnecessary friction in the file browser workflow.

Changes:

  • Add a useEffect hook that calls loadPath(ROOT_PATH) on mount to pre-fetch the root directory contents.
  • Automatically expand the root node after loading so users immediately see the file tree.
  • Handle errors gracefully with console logging and user-facing error messages.

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

  1. task
  2. cd build/clp-package
  3. ./sbin/start-clp.sh
  4. Navigated to the webui: http://localhost:4000
  5. Observed that when clicking on the file lister, the root directory "/" should already be expanded showing its contents (e.g., /home, /var, /etc, etc.) without needing to click on it.
  6. ./sbin/stop-clp.sh then edited build/clp-package/etc/clp-config.yaml: set logs_input.directory: "/home/junhao/"
    1. Repeated steps 3-5 and observed that when clicking on the file lister, only /home is shown.

Summary by CodeRabbit

Release Notes

  • New Features

    • Root directory now automatically loads when accessing the file selection interface
    • Tree automatically expands to display the root path on initialization
  • Bug Fixes

    • Enhanced error handling for directory loading failures with user-facing notifications

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai

coderabbitai Bot commented Dec 16, 2025

Copy link
Copy Markdown
Contributor

Walkthrough

Modified PathsSelectFormItem component to eagerly load root directory contents on component mount using ROOT_PATH and expand the tree accordingly. Includes error handling with console logging and user-facing error message display.

Changes

Cohort / File(s) Summary
Root Directory Eager Loading
components/webui/client/src/pages/IngestPage/Compress/PathsSelectFormItem/index.tsx
Added initialization logic to load root directory on mount, tree expansion to ROOT_PATH, and error handling. Imported ROOT_PATH from ./typings.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Verify the useEffect dependency array is correct to avoid unintended re-renders
  • Confirm error handling appropriately surfaces failures to users
  • Check that ROOT_PATH import is correctly exported from ./typings module

Possibly related issues

  • y-scope/clp#1780: This PR directly implements the eager loading and initialization of the root directory on mount for PathsSelectFormItem that was proposed in this issue.

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat(webui): Initialize root directory on file lister mount (resolves #1780)' accurately reflects the main change: automatically loading and expanding the root directory when the PathsSelectFormItem component mounts.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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

Comment @coderabbitai help to get the list of available commands and usage tips.

@junhaoliao junhaoliao marked this pull request as ready for review December 16, 2025 05:31
@junhaoliao junhaoliao requested a review from a team as a code owner December 16, 2025 05:31
@junhaoliao junhaoliao requested a review from davemarco December 16, 2025 05:31

@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: 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 49c20df and 61e7532.

📒 Files selected for processing (1)
  • components/webui/client/src/pages/IngestPage/Compress/PathsSelectFormItem/index.tsx (2 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{cpp,hpp,java,js,jsx,tpp,ts,tsx}

⚙️ CodeRabbit configuration file

  • Prefer false == <expression> rather than !<expression>.

Files:

  • components/webui/client/src/pages/IngestPage/Compress/PathsSelectFormItem/index.tsx
🧬 Code graph analysis (1)
components/webui/client/src/pages/IngestPage/Compress/PathsSelectFormItem/index.tsx (2)
components/webui/client/src/pages/IngestPage/Compress/PathsSelectFormItem/typings.ts (1)
  • ROOT_PATH (28-28)
components/webui/client/src/pages/IngestPage/Compress/PathsSelectFormItem/utils.ts (1)
  • ROOT_PATH (104-104)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: package-image
  • GitHub Check: build (macos-15)
  • GitHub Check: build (ubuntu-24.04)
🔇 Additional comments (1)
components/webui/client/src/pages/IngestPage/Compress/PathsSelectFormItem/index.tsx (1)

20-20: LGTM!

The ROOT_PATH import is necessary for the initialization logic and is properly used in the new useEffect hook.

@davemarco davemarco 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.

lgtm

@junhaoliao junhaoliao merged commit 8a8beab into y-scope:main Dec 16, 2025
19 checks passed
@junhaoliao junhaoliao deleted the load-root-file-lister branch December 16, 2025 22:32
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