Skip to content

Conversation

@davemarco
Copy link
Contributor

@davemarco davemarco commented Nov 19, 2025

Description

Moves the timestamp key selector into date picker. Previously the timestamp key selector was always rendered on guided page, moving into the date picker is not ideal since it is not always rendered, and required a change to the fetching logic. There is a new hook which is rendered on guided page which sets the timestamp key and does the fetching. The selector is now simpler and just does selection, and it not responsible for fetching or error hanlding.

Screenshot 2025-11-19 at 12 18 23 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

Loads timestamp keys

Summary by CodeRabbit

  • New Features

    • Timestamp key selection now integrated into the time range picker footer.
  • Refactor

    • Reorganized search control layout for improved guided query interface.

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


@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 19, 2025

Walkthrough

The refactoring relocates timestamp key selection from the GuidedControls component to a new TimeRangeFooter within TimeRangeInput, gated by Presto guided mode configuration. TimestampKey component removal is paired with extraction of initialization logic into a reusable useTimestampKeyInit hook and conversion of TimestampKeySelect to a dedicated component in the TimeRangeInput subtree.

Changes

Cohort / File(s) Summary
Removal of legacy TimestampKey component
components/webui/client/src/pages/SearchPage/SearchControls/Presto/GuidedControls/TimestampKey/index.tsx, components/webui/client/src/pages/SearchPage/SearchControls/Presto/GuidedControls/index.module.css
Deleted TimestampKey component and associated .timestampKey CSS class (width: 300px, flex display).
GuidedControls restructuring
components/webui/client/src/pages/SearchPage/SearchControls/Presto/GuidedControls/index.tsx
Converted from arrow function to function body with useTimestampKeyInit hook integration. Replaced inline TimestampKey/TimeRangeInput/SqlSearchButton group with new grid layout for Select, From, Where, OrderBy. Injected contextHolder at top level and moved QueryStatus to separate section.
TimeRangeFooter addition
components/webui/client/src/pages/SearchPage/SearchControls/TimeRangeInput/Presto/TimeRangeFooter/index.tsx, components/webui/client/src/pages/SearchPage/SearchControls/TimeRangeInput/Presto/TimeRangeFooter/index.module.css
Added new TimeRangeFooter component rendering "Timestamp key:" label with TimestampKeySelect. Added .footerContainer (flex centre, 8px padding/gap) and .footerSelect (flex: 1, min-width: 0) styles.
TimestampKeySelect component
components/webui/client/src/pages/SearchPage/SearchControls/TimeRangeInput/Presto/TimeRangeFooter/TimestampKeySelect/index.tsx
New Ant Design Select component fetching timestamp columns via React Query, enabling/disabling based on dataset presence and UI state, updating state on selection change, accepting external SelectProps.
TimeRangeInput integration
components/webui/client/src/pages/SearchPage/SearchControls/TimeRangeInput/index.tsx
Added isPrestoGuided flag (derived from SETTINGS_QUERY_ENGINE, CLP_QUERY_ENGINES.PRESTO, PRESTO_SQL_INTERFACE.GUIDED). Introduced memoized renderFooter callback returning TimeRangeFooter when isPrestoGuided is true, attached to DatePicker.RangePicker as renderExtraFooter.
Hook conversion and import updates
components/webui/client/src/pages/SearchState/Presto/useTimestampKeyInit/index.tsx, components/webui/client/src/pages/SearchState/Presto/useTimestampKeyInit/sql.ts
Converted default export from TimestampKeySelect component to useTimestampKeyInit hook returning {contextHolder}. Removed rendering, SelectProps handling, and UI state usage; retained fetch logic, auto-update on success, error/warning messaging, and dataset-change reset effect. Updated relative import paths in sql.ts.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Areas requiring extra attention:

  • State synchronization: Verify that useTimestampKeyInit hook correctly manages timestamp key state across the new hook/component split, especially dataset-change resets and auto-initialization logic.
  • Conditional rendering logic: Confirm that isPrestoGuided flag computation and its use in renderFooter callback work correctly in all Presto and non-Presto configurations.
  • CSS transitions: Ensure .footerContainer and .footerSelect styles integrate smoothly with TimeRangeInput's DatePicker layout and that removed .timestampKey class does not affect other components.
  • Hook side-effects: Review error/warning message flows in useTimestampKeyInit and ensure contextHolder is properly injected in GuidedControls.

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: moving the timestamp key selector from the guided controls into the date picker component, which aligns with the comprehensive refactoring across multiple files.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ 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.

@davemarco davemarco marked this pull request as ready for review November 19, 2025 18:35
@davemarco davemarco requested a review from a team as a code owner November 19, 2025 18:35
@davemarco davemarco requested a review from hoophalab November 19, 2025 18:35
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 514f69a and 8bb7b7d.

📒 Files selected for processing (10)
  • components/webui/client/src/pages/SearchPage/SearchControls/Presto/GuidedControls/TimestampKey/TimestampKeySelect.tsx (0 hunks)
  • components/webui/client/src/pages/SearchPage/SearchControls/Presto/GuidedControls/TimestampKey/index.tsx (0 hunks)
  • components/webui/client/src/pages/SearchPage/SearchControls/Presto/GuidedControls/index.module.css (0 hunks)
  • components/webui/client/src/pages/SearchPage/SearchControls/Presto/GuidedControls/index.tsx (2 hunks)
  • components/webui/client/src/pages/SearchPage/SearchControls/TimeRangeInput/Presto/TimeRangeFooter/TimestampKeySelect/index.tsx (1 hunks)
  • components/webui/client/src/pages/SearchPage/SearchControls/TimeRangeInput/Presto/TimeRangeFooter/index.module.css (1 hunks)
  • components/webui/client/src/pages/SearchPage/SearchControls/TimeRangeInput/Presto/TimeRangeFooter/index.tsx (1 hunks)
  • components/webui/client/src/pages/SearchPage/SearchControls/TimeRangeInput/index.tsx (4 hunks)
  • components/webui/client/src/pages/SearchPage/SearchState/Presto/useTimestampKeyInit/index.tsx (1 hunks)
  • components/webui/client/src/pages/SearchPage/SearchState/Presto/useTimestampKeyInit/sql.ts (1 hunks)
💤 Files with no reviewable changes (3)
  • components/webui/client/src/pages/SearchPage/SearchControls/Presto/GuidedControls/TimestampKey/index.tsx
  • components/webui/client/src/pages/SearchPage/SearchControls/Presto/GuidedControls/TimestampKey/TimestampKeySelect.tsx
  • components/webui/client/src/pages/SearchPage/SearchControls/Presto/GuidedControls/index.module.css
🧰 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/TimeRangeInput/index.tsx
  • components/webui/client/src/pages/SearchPage/SearchControls/TimeRangeInput/Presto/TimeRangeFooter/TimestampKeySelect/index.tsx
  • components/webui/client/src/pages/SearchPage/SearchControls/TimeRangeInput/Presto/TimeRangeFooter/index.tsx
  • components/webui/client/src/pages/SearchPage/SearchState/Presto/useTimestampKeyInit/index.tsx
  • components/webui/client/src/pages/SearchPage/SearchState/Presto/useTimestampKeyInit/sql.ts
  • components/webui/client/src/pages/SearchPage/SearchControls/Presto/GuidedControls/index.tsx
🧠 Learnings (3)
📓 Common learnings
Learnt from: haiqi96
Repo: y-scope/clp PR: 0
File: :0-0
Timestamp: 2025-07-29T14:04:13.769Z
Learning: User haiqi96 requested creating a GitHub issue to document a bug fix from PR #1136, which addressed MySQL compatibility issues with invalid SQL CAST operations in the WebUI component.
📚 Learning: 2025-07-18T20:00:50.288Z
Learnt from: hoophalab
Repo: y-scope/clp PR: 1108
File: components/webui/client/src/pages/SearchPage/SearchControls/Presto/SqlQueryInput/index.tsx:15-15
Timestamp: 2025-07-18T20:00:50.288Z
Learning: In the y-scope/clp React webui client codebase, for Zustand store usage: use `useStore.getState().method` for callbacks since the output is not reactive and doesn't need state as a dependency in the hook, and use `useStore((state) => state.property)` with proper selectors for reactive components that need to re-render when state changes.

Applied to files:

  • components/webui/client/src/pages/SearchPage/SearchControls/TimeRangeInput/index.tsx
📚 Learning: 2025-05-29T20:33:40.653Z
Learnt from: junhaoliao
Repo: y-scope/clp PR: 937
File: components/log-viewer-webui/client/src/AntdApp.tsx:16-24
Timestamp: 2025-05-29T20:33:40.653Z
Learning: In components/log-viewer-webui React codebase: Return type annotations (like `: JSX.Element`) are unnecessary and not preferred for React components in JSX/TSX files.

Applied to files:

  • components/webui/client/src/pages/SearchPage/SearchControls/TimeRangeInput/Presto/TimeRangeFooter/index.tsx
🧬 Code graph analysis (3)
components/webui/client/src/pages/SearchPage/SearchControls/TimeRangeInput/index.tsx (1)
components/webui/client/src/config/index.ts (1)
  • SETTINGS_QUERY_ENGINE (27-27)
components/webui/client/src/pages/SearchPage/SearchControls/TimeRangeInput/Presto/TimeRangeFooter/TimestampKeySelect/index.tsx (2)
components/webui/client/src/pages/SearchPage/SearchState/Presto/useTimestampKeyInit/sql.ts (1)
  • fetchTimestampColumns (50-50)
components/webui/client/src/pages/SearchPage/SearchState/typings.ts (1)
  • SEARCH_UI_STATE (31-31)
components/webui/client/src/pages/SearchPage/SearchState/Presto/useTimestampKeyInit/index.tsx (1)
components/webui/client/src/pages/SearchPage/SearchState/Presto/useTimestampKeyInit/sql.ts (1)
  • fetchTimestampColumns (50-50)
⏰ 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: lint-check (macos-15)
  • GitHub Check: lint-check (ubuntu-24.04)
🔇 Additional comments (3)
components/webui/client/src/pages/SearchPage/SearchControls/Presto/GuidedControls/index.tsx (3)

1-1: LGTM: Hook import aligns with PR objectives.

The import of useTimestampKeyInit correctly integrates the new hook that handles timestamp key initialization, replacing the previous inline timestamp key selector logic.


22-45: LGTM: Component structure is well-organized and aligns with PR objectives.

The refactored layout correctly:

  • Renders contextHolder at the top for Ant Design's message context
  • Maintains the existing button row with TimeRangeInput and SqlSearchButton
  • Introduces a clean grid-based layout for Select, From, Where, and OrderBy controls
  • Separates status display into its own section

The structural changes properly support moving the timestamp key selector into the date picker while maintaining a logical component hierarchy.


19-21: Verification complète — intégration du hook correcte et conforme.

L'inspection de la mise en œuvre du hook useTimestampKeyInit confirme que tous les scénarios d'initialisation sont correctement gérés :

  • Changements de dataset (ligne 76-83) : L'effet réinitialise timestampKey lors du changement de dataset
  • États d'erreur (ligne 52-61) : L'effet affiche un message d'erreur via messageApi.error() en cas d'échec de récupération
  • Auto-assignation (ligne 41-45) : Assigne automatiquement la première colonne de timestamp si aucune n'est sélectionnée

Le destructuring de contextHolder au sein du composant GuidedControls est approprié et conforme à l'API Ant Design message.useMessage(). L'intégration du hook est propre et fonctionnelle.

hoophalab
hoophalab previously approved these changes Nov 20, 2025
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

Validations: timestamp keys are shown in the selector. Changing the drop-down option changes the constructed query.

@davemarco
Copy link
Contributor Author

davemarco commented Nov 20, 2025

sorry i addressed a rabbit comment. I had to make a change to the old effect logic which worked but supposedly not idiomatic react. I found another change to the effect logic that also works, and the rabbit will be more content with.

hoophalab
hoophalab previously approved these changes Nov 21, 2025
junhaoliao
junhaoliao previously approved these changes Nov 21, 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 dismissed stale reviews from junhaoliao and hoophalab via ee90154 November 25, 2025 16:49
@davemarco davemarco requested a review from junhaoliao November 25, 2025 16:58
@davemarco
Copy link
Contributor Author

@junhaoliao can you approve this. Merging main created a lint error

@davemarco davemarco merged commit 479f58c into y-scope:main Nov 25, 2025
18 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