Skip to content

Conversation

@davemarco
Copy link
Contributor

@davemarco davemarco commented Sep 19, 2025

Description

Replaces editor with dataset selector

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

renders selector

Summary by CodeRabbit

  • New Features

    • Added a dataset selector to search controls and guided mode, enabling quick dataset selection.
    • Auto-selects the first available dataset when none is chosen.
    • Displays clear messages for errors and when no data is available.
    • Disables selection while queries are running to prevent inconsistent states.
  • Refactor

    • Centralized dataset selection into a reusable component for a more consistent, responsive experience across the search UI.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 19, 2025

Walkthrough

Introduces a new DatasetSelect React component that fetches dataset names and manages selection state and UI disabling. Replaces prior inline logic by using DatasetSelect in the Dataset index wrapper and in the Presto GuidedControls From component, removing previous SqlInput usage.

Changes

Cohort / File(s) Summary of changes
New DatasetSelect component
components/webui/client/src/pages/SearchPage/SearchControls/Dataset/DatasetSelect.tsx
Added DatasetSelect using react-query to fetch dataset names, auto-select first when none selected, handle errors/empty results with messages, disable based on query state, and update store on change. Exported as default.
Dataset wrapper integration
components/webui/client/src/pages/SearchPage/SearchControls/Dataset/index.tsx
Removed local fetching/state logic and replaced inner Select with DatasetSelect. Cleaned up related imports and effects; preserved layout/label.
Presto GuidedControls integration
components/webui/client/src/pages/SearchPage/SearchControls/Presto/GuidedControls/From.tsx
Replaced SqlInput with DatasetSelect; adjusted className composition; removed unused props/imports. Public API unchanged.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor User
  participant DatasetSelect
  participant react-query as react-query
  participant API as fetchDatasetNames
  participant Store as Search Store
  participant UI as AntD Select

  User->>DatasetSelect: Open/Focus control
  DatasetSelect->>react-query: useQuery("datasets")
  react-query->>API: fetch dataset names
  API-->>react-query: dataset list or error
  react-query-->>DatasetSelect: onSuccess/onError

  alt First load, no selection, data non-empty
    DatasetSelect->>Store: setDataset(firstItem)
  else Empty data
    DatasetSelect->>UI: show warning message
    DatasetSelect->>Store: setDataset(null)
  else Error
    DatasetSelect->>UI: show error message
  end

  Note over DatasetSelect,UI: Disable control when query state is pending/querying

  User->>UI: Change selection
  UI->>DatasetSelect: onChange(selected)
  DatasetSelect->>Store: setDataset(selected)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
Title Check ✅ Passed The title clearly and concisely describes the primary change in the pull request by stating that the guided Presto UI’s FROM input is being replaced with a dataset selector, which aligns exactly with the code modifications and objectives.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • 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.

@davemarco davemarco marked this pull request as ready for review September 23, 2025 16:49
@davemarco davemarco requested a review from a team as a code owner September 23, 2025 16:49
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: 9

📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 774a106 and e6c8d93.

📒 Files selected for processing (3)
  • components/webui/client/src/pages/SearchPage/SearchControls/Dataset/DatasetSelect.tsx (1 hunks)
  • components/webui/client/src/pages/SearchPage/SearchControls/Dataset/index.tsx (2 hunks)
  • components/webui/client/src/pages/SearchPage/SearchControls/Presto/GuidedControls/From.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/SearchPage/SearchControls/Dataset/index.tsx
  • components/webui/client/src/pages/SearchPage/SearchControls/Dataset/DatasetSelect.tsx
  • components/webui/client/src/pages/SearchPage/SearchControls/Presto/GuidedControls/From.tsx
🧬 Code graph analysis (1)
components/webui/client/src/pages/SearchPage/SearchControls/Dataset/DatasetSelect.tsx (2)
components/webui/client/src/pages/SearchPage/SearchControls/Dataset/sql.ts (1)
  • fetchDatasetNames (36-36)
components/webui/client/src/pages/SearchPage/SearchState/typings.ts (1)
  • SEARCH_UI_STATE (31-31)
⏰ 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). (2)
  • GitHub Check: package-image
  • GitHub Check: lint-check (macos-15)
🔇 Additional comments (3)
components/webui/client/src/pages/SearchPage/SearchControls/Dataset/index.tsx (1)

3-3: Good extraction and reuse of DatasetSelect.

Import path and encapsulation look correct.

components/webui/client/src/pages/SearchPage/SearchControls/Presto/GuidedControls/From.tsx (1)

2-2: LGTM on replacing SqlInput with DatasetSelect.

Pathing and usage look correct.

components/webui/client/src/pages/SearchPage/SearchControls/Dataset/DatasetSelect.tsx (1)

1-71: Verify multiple mounts don’t cause duplicate toasts.

Component now uses global message; confirm no duplicate toasts appear when DatasetSelect is mounted multiple times on the same screen (e.g. Dataset panel + Presto From) in the integrated UI. Automated search didn't locate usages in the repo — manual verification required.

Copy link
Contributor

@hoophalab hoophalab left a comment

Choose a reason for hiding this comment

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

lgtm. This PR simply extracts the selector from the clp-s dataset selector. The old page looks the same as before. The guided sql looks good.

@hoophalab
Copy link
Contributor

How about presto -> Presto

feat(webui): Replace FROM input on guided Presto UI with a dataset selector.

@davemarco davemarco changed the title feat(webui): Replace FROM input on guided presto UI with a dataset selector. feat(webui): Replace FROM input on guided Presto UI with a dataset selector. Sep 24, 2025
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.

deferring to @hoophalab 's review

@davemarco davemarco merged commit 761ec12 into y-scope:main Sep 25, 2025
19 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.

3 participants