Skip to content

Conversation

@LDrago27
Copy link
Collaborator

Description

This PR restricts Explore to support only Time based Datasets.
image

Changes:

  • The dataset selector filters out non time based Datasets
  • The view dataset button shows a banner explaining what datasets have been filter with a link back to Dataset page for creating a new one.
  • The Create Dataset flow now does not provide user an option to not provide a timeStamp field while creating the Dataset.

Issues Resolved

Screenshot

Testing the changes

  • Create a Non Time stamp based Dataset
  • Navigate to Explore page
  • Validate that the Non time stamp based Dataset is unavailable in the dataset selection dropdown.

Changelog

  • feat: Restrict Explore to support only Time based Datasets

Check List

  • All tests pass
    • yarn test:jest
    • yarn test:jest_integration
  • New functionality includes testing.
  • New functionality has been documented.
  • Update CHANGELOG.md
  • Commits are signed per the DCO using --signoff

@coderabbitai
Copy link

coderabbitai bot commented Jan 21, 2026

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

  • 🔍 Trigger a full review
📝 Walkthrough

Walkthrough

This PR introduces filtering logic to exclude non-time-field datasets in specific contexts by adding a showNonTimeFieldDatasets prop that flows through the dataset selector component hierarchy. It includes a new TimeBasedDatasetDisclaimer UI component, updates test suites accordingly, and adds corresponding CSS styling.

Changes

Cohort / File(s) Summary
Test Suite Updates
cypress/integration/.../simple_dataset_select.spec.js, cypress/integration/.../table.spec.js
Removed no-time index pattern configuration and related dataset creation from test setup; added new test block validating non-time-field dataset filtering; simplified cleanup calls to remove references to time-less datasets.
Dataset Select Component
src/plugins/data/public/ui/dataset_select/_dataset_select.scss, src/plugins/data/public/ui/dataset_select/dataset_select.tsx
Added new showNonTimeFieldDatasets prop to control dataset filtering; introduced TimeBasedDatasetDisclaimer component with callout UI; enhanced dataset fetching logic to exclude non-time datasets when prop is false; updated imports and dependency arrays; added CSS styling for disclaimer element.
Dataset Selector Hierarchy
src/plugins/data/public/ui/dataset_selector/advanced_selector.tsx, src/plugins/data/public/ui/dataset_selector/configurator/configurator_v2.tsx
Added showNonTimeFieldDatasets prop to both components; propagated prop through component tree; wrapped non-time field options in ConfiguratorV2 with conditional rendering based on prop value.
Explore Plugin Integration
src/plugins/explore/public/components/query_panel/query_panel_widgets/dataset_select/dataset_select.tsx
Updated DatasetSelect component invocation to pass showNonTimeFieldDatasets={false} and removed appName="explore" prop.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: restricting the Explore feature to support only time-based datasets, which aligns with all file modifications.
Description check ✅ Passed The description provides adequate detail about changes and includes testing steps and a changelog entry, though the 'Issues Resolved' section is empty and the checklist items remain unchecked.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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.

opensearch-changeset-bot bot added a commit to LDrago27/OpenSearch-Dashboards that referenced this pull request Jan 21, 2026
@LDrago27 LDrago27 force-pushed the restrictDatset branch 2 times, most recently from 197bbc8 to fb561a5 Compare January 21, 2026 22:36
Copy link

@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

🤖 Fix all issues with AI agents
In `@src/plugins/data/public/ui/dataset_select/dataset_select.tsx`:
- Around line 434-437: The dropdown currently filters out datasets without a
time field but selection resolution still allows an already-selected dataset to
remain when showNonTimeFieldDatasets is false; update the selection logic in
updateSelectedDataset (and any resolver that reads currentQuery.dataset) to
perform the same check using detailedDataset.timeFieldName and
showNonTimeFieldDatasets, and if the selected dataset lacks a timeFieldName when
showNonTimeFieldDatasets is false, clear currentQuery.dataset (or pick the
nearest valid dataset) and trigger the existing selection flow so the UI and
deep links cannot bypass the restriction.
🧹 Nitpick comments (1)
src/plugins/data/public/ui/dataset_select/dataset_select.tsx (1)

235-239: Thread showNonTimeFieldDatasets through to ViewDatasetsModal and conditionally render the disclaimer.

The TimeBasedDatasetDisclaimer is rendered unconditionally in the modal, but the showNonTimeFieldDatasets flag exists in DatasetSelect to control whether non-time-based datasets are allowed. The flag is not currently passed to ViewDatasetsModal, causing the disclaimer to appear even in contexts where non-time datasets are valid. In Explore (which sets showNonTimeFieldDatasets={false}), this is particularly misleading.

♻️ Suggested wiring
 interface ViewDatasetsModalProps {
   datasets: DetailedDataset[];
   isLoading: boolean;
   onClose: () => void;
   services: IDataPluginServices;
+  showNonTimeFieldDatasets?: boolean;
 }

 const ViewDatasetsModal: React.FC<ViewDatasetsModalProps> = ({
   datasets,
   isLoading,
   onClose,
   services,
+  showNonTimeFieldDatasets = true,
 }) => {
   ...
   return (
     <EuiModal onClose={onClose} maxWidth="800px">
       <EuiModalHeader>
         ...
       </EuiModalHeader>
       <EuiModalBody>
-        <TimeBasedDatasetDisclaimer
-          onClick={() => {
-            onClose();
-            services.application?.navigateToApp('datasets');
-          }}
-        />
+        {!showNonTimeFieldDatasets && (
+          <TimeBasedDatasetDisclaimer
+            onClick={() => {
+              onClose();
+              services.application?.navigateToApp('datasets');
+            }}
+          />
+        )}
         <EuiFieldSearch ...
 <ViewDatasetsModal
   datasets={datasets}
   isLoading={isLoading}
   onClose={() => overlay?.close()}
   services={services}
+  showNonTimeFieldDatasets={showNonTimeFieldDatasets}
 />
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7329a87 and fb561a5.

📒 Files selected for processing (7)
  • cypress/integration/core_opensearch_dashboards/opensearch_dashboards/apps/explore/01/simple_dataset_select.spec.js
  • cypress/integration/core_opensearch_dashboards/opensearch_dashboards/apps/explore/03/table.spec.js
  • src/plugins/data/public/ui/dataset_select/_dataset_select.scss
  • src/plugins/data/public/ui/dataset_select/dataset_select.tsx
  • src/plugins/data/public/ui/dataset_selector/advanced_selector.tsx
  • src/plugins/data/public/ui/dataset_selector/configurator/configurator_v2.tsx
  • src/plugins/explore/public/components/query_panel/query_panel_widgets/dataset_select/dataset_select.tsx
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: LDrago27
Repo: opensearch-project/OpenSearch-Dashboards PR: 11138
File: cypress/utils/commands.osd.js:802-806
Timestamp: 2026-01-13T21:54:42.499Z
Learning: The `setExplorePage` command in `cypress/utils/commands.osd.js` (added in PR `#11138`) is currently unused and will be cleaned up in a subsequent PR. It has a syntax error (missing closing quote in the dataset URL construction) that should be fixed when the utility is either used or removed.
📚 Learning: 2026-01-13T21:54:42.499Z
Learnt from: LDrago27
Repo: opensearch-project/OpenSearch-Dashboards PR: 11138
File: cypress/utils/commands.osd.js:802-806
Timestamp: 2026-01-13T21:54:42.499Z
Learning: The `setExplorePage` command in `cypress/utils/commands.osd.js` (added in PR `#11138`) is currently unused and will be cleaned up in a subsequent PR. It has a syntax error (missing closing quote in the dataset URL construction) that should be fixed when the utility is either used or removed.

Applied to files:

  • cypress/integration/core_opensearch_dashboards/opensearch_dashboards/apps/explore/03/table.spec.js
🧬 Code graph analysis (2)
src/plugins/data/public/ui/dataset_select/dataset_select.tsx (3)
src/plugins/data/public/ui/dataset_select/index.tsx (2)
  • DatasetSelect (12-16)
  • DatasetSelectProps (19-19)
src/plugins/data/public/index.ts (1)
  • DatasetSelectProps (514-514)
src/plugins/data/public/ui/index.ts (1)
  • DatasetSelectProps (32-32)
cypress/integration/core_opensearch_dashboards/opensearch_dashboards/apps/explore/01/simple_dataset_select.spec.js (2)
cypress/utils/apps/explore/saved_queries.js (1)
  • config (141-141)
cypress/utils/apps/query_enhancements/saved_queries.js (1)
  • config (155-155)
⏰ 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). (5)
  • GitHub Check: lighthouse
  • GitHub Check: bundle-analyzer
  • GitHub Check: Build and Verify on Windows (ciGroup1)
  • GitHub Check: Build min release artifacts on macOS ARM64
  • GitHub Check: Build min release artifacts on macOS x64
🔇 Additional comments (15)
cypress/integration/core_opensearch_dashboards/opensearch_dashboards/apps/explore/03/table.spec.js (1)

70-72: Cleanup update looks consistent with the simplified setup.

src/plugins/data/public/ui/dataset_select/_dataset_select.scss (1)

131-134: Spacing for the time-based disclaimer looks good.

cypress/integration/core_opensearch_dashboards/opensearch_dashboards/apps/explore/01/simple_dataset_select.spec.js (2)

76-76: Test title update is clear and consistent.


106-122: Good coverage for filtering non‑time datasets in the selector.

src/plugins/explore/public/components/query_panel/query_panel_widgets/dataset_select/dataset_select.tsx (1)

248-253: Prop wiring cleanly enforces time‑based datasets in Explore.

src/plugins/data/public/ui/dataset_selector/advanced_selector.tsx (2)

40-58: Prop surface update is straightforward and consistent.


96-106: Forwarding the flag to the configurator is correctly wired.

src/plugins/data/public/ui/dataset_selector/configurator/configurator_v2.tsx (2)

32-50: Defaulting the new flag keeps behavior backward‑compatible.


205-216: Conditional non‑time option rendering matches the new restriction.

src/plugins/data/public/ui/dataset_select/dataset_select.tsx (6)

32-33: No concerns with the new EUI imports.


47-72: Clean, reusable disclaimer component.
Looks good as a focused UI helper.


84-84: No concerns with the new prop wiring here.


272-277: No concerns with the default prop value here.


497-506: No concerns with the updated dependency list.


796-796: No concerns with prop propagation here.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

Copy link

@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

🤖 Fix all issues with AI agents
In
`@cypress/integration/core_opensearch_dashboards/opensearch_dashboards/apps/explore/03/table.spec.js`:
- Around line 70-72: The cleanup call uses
cleanupWorkspaceAndDataSourceAndIndices but that helper only calls
deleteWorkspaceByNameUsingEndpoint and never deletes indices like
INDEX_WITH_TIME_1; update the helper (cleanupWorkspaceAndDataSourceAndIndices in
cypress/utils/commands.osd.js) to either accept an indices parameter or
explicitly delete INDEX_WITH_TIME_1 by calling the OpenSearch index delete
endpoint (or an existing cy.osd.deleteIndex helper) before invoking
deleteWorkspaceByNameUsingEndpoint, and ensure tests that call it pass the index
name so indices are removed when workspace deletion does not cascade.
🧹 Nitpick comments (2)
src/plugins/data/public/ui/dataset_select/_dataset_select.scss (1)

131-134: Minor: Redundant margin declaration.

Setting margin: 0 and then margin-bottom: 2px can be simplified to a single declaration.

♻️ Suggested simplification
  &__timeBasedDisclaimer {
-   margin: 0;
-   margin-bottom: 2px;
+   margin: 0 0 2px 0;
  }
src/plugins/data/public/ui/dataset_select/dataset_select.tsx (1)

234-240: Consider making the disclaimer conditional.

The TimeBasedDatasetDisclaimer is always rendered in the ViewDatasetsModal, but its purpose is to explain why some datasets were filtered out. Consider showing it only when showNonTimeFieldDatasets is false, since the disclaimer message ("Only time-based Datasets are supported") may confuse users when all datasets are actually shown.

Please verify if this disclaimer should always be shown or only when non-time-field datasets are being filtered. If conditional, the modal would need to receive the showNonTimeFieldDatasets prop.

📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7329a87 and fb561a5.

📒 Files selected for processing (7)
  • cypress/integration/core_opensearch_dashboards/opensearch_dashboards/apps/explore/01/simple_dataset_select.spec.js
  • cypress/integration/core_opensearch_dashboards/opensearch_dashboards/apps/explore/03/table.spec.js
  • src/plugins/data/public/ui/dataset_select/_dataset_select.scss
  • src/plugins/data/public/ui/dataset_select/dataset_select.tsx
  • src/plugins/data/public/ui/dataset_selector/advanced_selector.tsx
  • src/plugins/data/public/ui/dataset_selector/configurator/configurator_v2.tsx
  • src/plugins/explore/public/components/query_panel/query_panel_widgets/dataset_select/dataset_select.tsx
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: LDrago27
Repo: opensearch-project/OpenSearch-Dashboards PR: 11138
File: cypress/utils/commands.osd.js:802-806
Timestamp: 2026-01-13T21:54:42.499Z
Learning: The `setExplorePage` command in `cypress/utils/commands.osd.js` (added in PR `#11138`) is currently unused and will be cleaned up in a subsequent PR. It has a syntax error (missing closing quote in the dataset URL construction) that should be fixed when the utility is either used or removed.
📚 Learning: 2026-01-13T21:54:42.499Z
Learnt from: LDrago27
Repo: opensearch-project/OpenSearch-Dashboards PR: 11138
File: cypress/utils/commands.osd.js:802-806
Timestamp: 2026-01-13T21:54:42.499Z
Learning: The `setExplorePage` command in `cypress/utils/commands.osd.js` (added in PR `#11138`) is currently unused and will be cleaned up in a subsequent PR. It has a syntax error (missing closing quote in the dataset URL construction) that should be fixed when the utility is either used or removed.

Applied to files:

  • cypress/integration/core_opensearch_dashboards/opensearch_dashboards/apps/explore/03/table.spec.js
🧬 Code graph analysis (1)
cypress/integration/core_opensearch_dashboards/opensearch_dashboards/apps/explore/01/simple_dataset_select.spec.js (2)
cypress/utils/apps/explore/saved_queries.js (1)
  • config (141-141)
cypress/utils/apps/query_enhancements/saved_queries.js (1)
  • config (155-155)
⏰ 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). (22)
  • GitHub Check: lighthouse
  • GitHub Check: bundle-analyzer
  • GitHub Check: Run functional tests on Windows (ciGroup7)
  • GitHub Check: Run functional tests on Windows (ciGroup8)
  • GitHub Check: Run functional tests on Windows (ciGroup12)
  • GitHub Check: Run functional tests on Windows (ciGroup1)
  • GitHub Check: Run functional tests on Linux (ciGroup1)
  • GitHub Check: Run functional tests on Linux (ciGroup8)
  • GitHub Check: Run functional tests on Linux (ciGroup2)
  • GitHub Check: Run functional tests on Windows (ciGroup3)
  • GitHub Check: Run functional tests on Linux (ciGroup11)
  • GitHub Check: Build and Verify on Windows (ciGroup3)
  • GitHub Check: Build min release artifacts on Windows x64
  • GitHub Check: Build and Verify on Windows (ciGroup1)
  • GitHub Check: Build min release artifacts on Linux x64
  • GitHub Check: Lint and validate
  • GitHub Check: Build min release artifacts on Linux ARM64
  • GitHub Check: Build min release artifacts on macOS ARM64
  • GitHub Check: Build min release artifacts on macOS x64
  • GitHub Check: Run plugin functional tests on Windows
  • GitHub Check: Run plugin functional tests on Linux
  • GitHub Check: Run cypress tests (osd:ciGroup10Slow)
🔇 Additional comments (14)
cypress/integration/core_opensearch_dashboards/opensearch_dashboards/apps/explore/01/simple_dataset_select.spec.js (2)

70-104: LGTM!

The test configuration is correctly set up to only include the time-based index pattern, and the test properly validates the presence of the timestamp column when relevant.


106-122: LGTM! Good test coverage for the new filtering behavior.

The test correctly validates that non-time-based datasets are filtered out when enhancement mode is active. The assertions check both the count (exactly 1 option) and content (no options contain the non-time index pattern text).

src/plugins/explore/public/components/query_panel/query_panel_widgets/dataset_select/dataset_select.tsx (1)

248-254: LGTM!

This correctly sets showNonTimeFieldDatasets={false} for the Explore context, enforcing the time-based dataset restriction as intended by this PR.

src/plugins/data/public/ui/dataset_selector/advanced_selector.tsx (2)

40-58: LGTM!

The showNonTimeFieldDatasets prop is correctly added to the component's props interface and destructured for use.


96-116: LGTM!

The prop is correctly forwarded to ConfiguratorComponent (which is either ConfiguratorV2 or Configurator). DatasetExplorer doesn't need this prop as it handles browsing, not time field configuration.

src/plugins/data/public/ui/dataset_selector/configurator/configurator_v2.tsx (2)

32-50: LGTM!

The showNonTimeFieldDatasets prop is correctly added with a default value of true, maintaining backward compatibility for existing usages.


205-227: LGTM!

The conditional rendering correctly omits the "no time field" option when showNonTimeFieldDatasets is false. The existing onChange handler at line 220 already handles the noTimeFilter value correctly by setting timeFieldName to undefined.

src/plugins/data/public/ui/dataset_select/dataset_select.tsx (6)

47-72: LGTM!

The TimeBasedDatasetDisclaimer component is well-structured with clear props and appropriate i18n usage for the message and link text.


80-85: LGTM!

The showNonTimeFieldDatasets prop is correctly added to the public interface.


272-277: LGTM!

The default value true maintains backward compatibility for existing usages of this component.


434-438: LGTM!

The filtering logic correctly excludes datasets without a timeFieldName when showNonTimeFieldDatasets is false.


497-506: LGTM!

The showNonTimeFieldDatasets dependency is correctly added to the useCallback dependencies array, ensuring the filtering logic re-runs when this prop changes.


791-797: LGTM!

The showNonTimeFieldDatasets prop is correctly forwarded to the AdvancedSelector when creating a new dataset, ensuring consistent behavior between the dataset list filtering and the create flow.

cypress/integration/core_opensearch_dashboards/opensearch_dashboards/apps/explore/03/table.spec.js (1)

38-53: Test setup correctly aligns with PR objectives.

The test now focuses exclusively on time-based datasets (INDEX_WITH_TIME_1 with timestamp field), which correctly reflects the new restriction that Explore only supports time-based datasets.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

@codecov
Copy link

codecov bot commented Jan 21, 2026

Codecov Report

❌ Patch coverage is 60.00000% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 60.15%. Comparing base (5a4b914) to head (2aed3ed).
⚠️ Report is 11 commits behind head on main.

Files with missing lines Patch % Lines
...s/data/public/ui/dataset_select/dataset_select.tsx 62.50% 3 Missing ⚠️
.../dataset_selector/configurator/configurator_v2.tsx 50.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main   #11207   +/-   ##
=======================================
  Coverage   60.14%   60.15%           
=======================================
  Files        4643     4646    +3     
  Lines      129179   129107   -72     
  Branches    21921    21916    -5     
=======================================
- Hits        77697    77665   -32     
+ Misses      45947    45921   -26     
+ Partials     5535     5521   -14     
Flag Coverage Δ
Linux_1 24.83% <0.00%> (-0.01%) ⬇️
Linux_2 38.25% <ø> (ø)
Linux_3 40.02% <60.00%> (+<0.01%) ⬆️
Linux_4 33.50% <0.00%> (-0.02%) ⬇️
Windows_1 24.85% <0.00%> (-0.01%) ⬇️
Windows_2 38.22% <ø> (ø)
Windows_3 40.02% <60.00%> (+<0.01%) ⬆️
Windows_4 33.50% <0.00%> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@LDrago27 LDrago27 force-pushed the restrictDatset branch 6 times, most recently from 4880026 to 29fef87 Compare January 23, 2026 21:57
ruchidh
ruchidh previously approved these changes Jan 26, 2026
@LDrago27 LDrago27 force-pushed the restrictDatset branch 2 times, most recently from 12bb016 to 0c155ab Compare January 26, 2026 23:35
Signed-off-by: Suchit Sahoo <[email protected]>
@LDrago27 LDrago27 merged commit cef93e8 into opensearch-project:main Jan 27, 2026
179 of 185 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants