Skip to content

fix(discover): apply no-wrap styling to all date fields, not just the primary time field#12262

Open
amarkdotdev wants to merge 2 commits into
opensearch-project:mainfrom
amarkdotdev:fix/date-field-wrapping
Open

fix(discover): apply no-wrap styling to all date fields, not just the primary time field#12262
amarkdotdev wants to merge 2 commits into
opensearch-project:mainfrom
amarkdotdev:fix/date-field-wrapping

Conversation

@amarkdotdev

@amarkdotdev amarkdotdev commented Jun 21, 2026

Copy link
Copy Markdown

Description

The Discover table only applied eui-textNoWrap to the index pattern's primary timeFieldName. Other fields of type date (e.g. created_at, updated_at) would wrap across lines, making them harder to read.

Root cause

In table_row.tsx, the no-wrap condition checked indexPattern.timeFieldName === colName which only matches the single primary timestamp. The original fix in #8247 addressed this for the primary field but did not extend to all date-typed fields.

Fix

Replace indexPattern.timeFieldName === colName with fieldInfo?.type === 'date' in both:

  1. The non-filterable field path (inline className)
  2. The TableCell component's isTimeField prop

This ensures all fields with type date get consistent no-wrap styling.

Fixes #8441

@amarkdotdev amarkdotdev requested a review from FriedhelmWS as a code owner June 21, 2026 16:38
@amarkdotdev amarkdotdev force-pushed the fix/date-field-wrapping branch 2 times, most recently from 661f362 to be24c62 Compare June 21, 2026 18:37
… primary time field

The Discover table only applied eui-textNoWrap to the index pattern's
primary timeFieldName. Other fields of type "date" (e.g. created_at,
updated_at) would wrap, which looks inconsistent and makes date values
harder to read.

Check fieldInfo.type === 'date' instead of comparing against
indexPattern.timeFieldName so that all date-typed fields receive the
no-wrap styling consistently.

Fixes opensearch-project#8441

Signed-off-by: Aaron Mark <64331623+amarkdotdev@users.noreply.github.com>
@amarkdotdev amarkdotdev force-pushed the fix/date-field-wrapping branch from be24c62 to 6ad9a0b Compare June 21, 2026 18:38
@github-actions

Copy link
Copy Markdown
Contributor

🔗 Workflow run · commit 6ad9a0b78090731c360586b3c066f6b02f5dee44

❌ 2 Jest Test Failure(s)

📄 junit-jest-integration-Windows/TEST-Jest Integration Tests.xml

❌ applies filter function specified (0.009s)

Jest Integration Tests.src\dev\build\lib\integration_tests

Error: expect(received).toBeUndefined()

Received: "workspace-ds"
    at Object.<anonymous> (D:\a\OpenSearch-Dashboards\OpenSearch-Dashboards\src\plugins\workspace\server\saved_objects\integration_tests\workspace_ui_settings_wrapper.test.ts:85:7)
    at processTicksAndRejections (node:internal/process/task_queues:103:5)

❌ workspace ui settings saved object client wrapper should get and update global ui settings when currently not in a workspace [Attempt #2] (2.087s)

Jest Integration Tests.src\plugins\workspace\server\saved_objects\integration_tests

Error: expect(received).toBe(expected) // Object.is equality

Expected: "global-ds"
Received: "global-ds-new"
    at Object.<anonymous> (D:\a\OpenSearch-Dashboards\OpenSearch-Dashboards\src\plugins\workspace\server\saved_objects\integration_tests\workspace_ui_settings_wrapper.test.ts:106:90)
    at processTicksAndRejections (node:internal/process/task_queues:103:5)

2 failure(s) across 1 suite(s). Full XML reports are in the junit-jest-* artifacts.

@amarkdotdev

Copy link
Copy Markdown
Author

Retriggered CI with an empty commit (69737a89).

The previous Merge Gate failure looks unrelated to this change — it failed on Windows Jest integration tests in workspace_ui_settings_wrapper.test.ts (workspace UI settings), while this PR only touches discover date-field CSS styling. Happy to rebase if there's a fix on main, but I don't think these failures are caused by the no-wrap styling change.

Could a maintainer take a look when you have a moment? Thanks!

@amarkdotdev amarkdotdev force-pushed the fix/date-field-wrapping branch 2 times, most recently from aebca1a to 6ad9a0b Compare June 23, 2026 17:32
@codecov

codecov Bot commented Jun 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 0.00%. Comparing base (7782a80) to head (6ad9a0b).
⚠️ Report is 268 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff             @@
##             main   #12262       +/-   ##
===========================================
- Coverage   61.58%        0   -61.59%     
===========================================
  Files        4995        0     -4995     
  Lines      137542        0   -137542     
  Branches    23901        0    -23901     
===========================================
- Hits        84707        0    -84707     
+ Misses      46692        0    -46692     
+ Partials     6143        0     -6143     
Flag Coverage Δ
Linux_1 ?
Linux_2 ?
Linux_3 ?
Linux_4 ?
Linux_5 ?

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

☔ View full report in Codecov by Harness.
📢 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.

Signed-off-by: Aaron Mark <64331623+amarkdotdev@users.noreply.github.com>
@github-actions

Copy link
Copy Markdown
Contributor

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

🧪 No relevant tests
🔒 No security concerns identified
✅ No TODO sections
🔀 No multiple PR themes
⚡ No major issues detected

@github-actions

Copy link
Copy Markdown
Contributor

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
General
Separate date-type styling from time-field semantics

The prop is named isTimeField, but it is now being set for all date-typed fields
rather than the index pattern's primary time field. If TableCell uses isTimeField
for behavior beyond no-wrap styling (e.g., time-specific filter actions), this
change may produce incorrect behavior. Consider renaming the prop to reflect "is
date field" semantics or splitting into two props (isDateField for styling,
isTimeField for the primary time field).

src/plugins/discover/public/application/components/default_discover_table/table_row.tsx [131]

-isTimeField={fieldInfo?.type === 'date'}
+isTimeField={indexPattern.timeFieldName === colName}
+isDateField={fieldInfo?.type === 'date'}
Suggestion importance[1-10]: 6

__

Why: The suggestion raises a valid concern about semantic correctness: isTimeField previously identified the index pattern's primary time field, but now flags any date-typed field. If TableCell uses this prop for time-specific behavior beyond styling, it could cause regressions. However, without seeing TableCell usage, the impact is uncertain.

Low

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.

[BUG] Discover table wrapping fields that are type date

1 participant