Skip to content

Commit

Permalink
[Discover] Prevent wrapping of time series cells
Browse files Browse the repository at this point in the history
Signed-off-by: Miki <[email protected]>
  • Loading branch information
AMoo-Miki committed Feb 2, 2024
1 parent 40e61ba commit 80bc149
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- [BUG][Discover] Fix advanced setting `discover:modifyColumnsOnSwitch` ([#5508](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/5508))
- [Discover] Fix missing index pattern field from breaking Discover [#5626](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/5626)
- [BUG] Remove duplicate sample data as id 90943e30-9a47-11e8-b64d-95841ca0b247 ([5668](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/5668))
- [Discover] Prevent wrapping of time series cells [#5779](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/5779)

### 🚞 Infrastructure

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { DocViewFilterFn } from '../../doc_views/doc_views_types';

export interface TableCellProps {
columnId: string;
isTimeField?: boolean;
onFilter: DocViewFilterFn;
filterable?: boolean;
fieldMapping?: any;
Expand All @@ -26,16 +27,14 @@ export interface TableCellProps {

export const TableCell = ({
columnId,
isTimeField,
onFilter,
fieldMapping,
sanitizedCellValue,
}: TableCellProps) => {
return (
// eslint-disable-next-line react/no-danger
<td
data-test-subj="docTableField"
className="osdDocTableCell eui-textBreakAll eui-textBreakWord"
>
const content = (
<>
{/* eslint-disable-next-line react/no-danger */}
<span dangerouslySetInnerHTML={{ __html: sanitizedCellValue }} />
<span className="osdDocTableCell__filter">
<EuiToolTip
Expand Down Expand Up @@ -69,6 +68,19 @@ export const TableCell = ({
/>
</EuiToolTip>
</span>
</>
);

return isTimeField ? (
<td data-test-subj="docTableField" className="osdDocTableCell eui-textNoWrap">
{content}
</td>
) : (
<td
data-test-subj="docTableField"
className="osdDocTableCell eui-textBreakAll eui-textBreakWord"
>
<div className="osdDocTable__limitedHeight">{content}</div>
</td>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ export const TableRow = ({
<TableCell
columnId={columnId}
onFilter={onFilter}
isTimeField={indexPattern.timeFieldName === columnId}
fieldMapping={fieldMapping}
sanitizedCellValue={sanitizedCellValue}
/>
Expand Down

0 comments on commit 80bc149

Please sign in to comment.