From 2db522e7e3d9bf702c36d4daa9389ad339d7f240 Mon Sep 17 00:00:00 2001 From: Miki Date: Fri, 2 Feb 2024 04:13:20 -0800 Subject: [PATCH] Use `ouiCodeFont` in Discover and reduce text size (#5783) Also: * Fix react `key` errors * vertically align source cells * Clamp the height of the cells * Make sure time-series column never grows Signed-off-by: Miki --- .../core_app/assets/legacy_dark_theme.css | 2 +- .../core_app/assets/legacy_light_theme.css | 2 +- .../data_grid/data_grid_table_cell_value.tsx | 2 +- .../default_discover_table/_doc_table.scss | 7 +++++ .../default_discover_table/_table_cell.scss | 25 +++++++++++++++- .../default_discover_table/table_header.tsx | 1 + .../default_discover_table/table_rows.tsx | 29 ++++++++++++++----- 7 files changed, 56 insertions(+), 12 deletions(-) diff --git a/src/core/server/core_app/assets/legacy_dark_theme.css b/src/core/server/core_app/assets/legacy_dark_theme.css index 4ef4c726e414..b56eeed717a1 100644 --- a/src/core/server/core_app/assets/legacy_dark_theme.css +++ b/src/core/server/core_app/assets/legacy_dark_theme.css @@ -802,7 +802,7 @@ width: 100%; max-width: 100%; margin-bottom: 20px; - font-size: 14px; + font-size: 12px; } .table thead { font-size: 12px; diff --git a/src/core/server/core_app/assets/legacy_light_theme.css b/src/core/server/core_app/assets/legacy_light_theme.css index 9f9a0dc118d1..d4f6d10e7022 100644 --- a/src/core/server/core_app/assets/legacy_light_theme.css +++ b/src/core/server/core_app/assets/legacy_light_theme.css @@ -802,7 +802,7 @@ width: 100%; max-width: 100%; margin-bottom: 20px; - font-size: 14px; + font-size: 12px; } .table thead { font-size: 12px; diff --git a/src/plugins/discover/public/application/components/data_grid/data_grid_table_cell_value.tsx b/src/plugins/discover/public/application/components/data_grid/data_grid_table_cell_value.tsx index 10911ab96a7e..7c4201f93127 100644 --- a/src/plugins/discover/public/application/components/data_grid/data_grid_table_cell_value.tsx +++ b/src/plugins/discover/public/application/components/data_grid/data_grid_table_cell_value.tsx @@ -30,7 +30,7 @@ export function fetchSourceTypeDataCell( const keys = Object.keys(formattedRow); return ( - + {keys.map((key, index) => ( diff --git a/src/plugins/discover/public/application/components/default_discover_table/_doc_table.scss b/src/plugins/discover/public/application/components/default_discover_table/_doc_table.scss index 86519fb5a46c..1e780a7e4d8a 100644 --- a/src/plugins/discover/public/application/components/default_discover_table/_doc_table.scss +++ b/src/plugins/discover/public/application/components/default_discover_table/_doc_table.scss @@ -42,6 +42,13 @@ doc-table { .osd-table, .osdDocTable { + @include ouiCodeFont; + + // To fight intruding styles that conflict with OUI's + & > tbody > tr > td { + line-height: inherit; + } + /** * Style OpenSearch document _source in table view
key:
value
* Use alpha so this will stand out against non-white backgrounds, e.g. the highlighted diff --git a/src/plugins/discover/public/application/components/default_discover_table/_table_cell.scss b/src/plugins/discover/public/application/components/default_discover_table/_table_cell.scss index 65dbcd73fba9..aefd9ebbfc05 100644 --- a/src/plugins/discover/public/application/components/default_discover_table/_table_cell.scss +++ b/src/plugins/discover/public/application/components/default_discover_table/_table_cell.scss @@ -1,4 +1,4 @@ -.osdDocTable_expandedRow { +.osdDocTable__detailsParent { border-top: none !important; } @@ -31,4 +31,27 @@ &:focus &__filterButton { opacity: 1; } + + .osdDescriptionListFieldTitle { + margin: 0 4px 0 0 !important; + } + + // stylelint-disable-next-line @osd/stylelint/no_modifying_global_selectors + &.eui-textNoWrap { + // To make sure the time-series column never stretches + width: 1%; + } +} + +.osdDocTableCell__source { + .truncate-by-height { + transform: translateY(-1.5px); + margin-bottom: -1.5px; + } + + dd, + dl, + dt { + font-size: inherit !important; + } } diff --git a/src/plugins/discover/public/application/components/default_discover_table/table_header.tsx b/src/plugins/discover/public/application/components/default_discover_table/table_header.tsx index 4d714228f3bc..6715910e8346 100644 --- a/src/plugins/discover/public/application/components/default_discover_table/table_header.tsx +++ b/src/plugins/discover/public/application/components/default_discover_table/table_header.tsx @@ -64,6 +64,7 @@ export function TableHeader({ return ( + @@ -71,8 +72,14 @@ export const TableRow = ({ if (fieldInfo?.type === '_source') { return ( - - {fetchSourceTypeDataCell(indexPattern, row, columnId, false)} + +
+ {fetchSourceTypeDataCell(indexPattern, row, columnId, false)} +
); } @@ -82,6 +89,7 @@ export const TableRow = ({ if (typeof formattedValue === 'undefined') { return ( @@ -95,18 +103,23 @@ export const TableRow = ({ if (!fieldInfo?.filterable) { return ( - {/* eslint-disable-next-line react/no-danger */} - +
+ {/* eslint-disable-next-line react/no-danger */} + +
); } return ( - - + + +