From c8c3d6c3a337f308dc53328313bfb3eee0ad3606 Mon Sep 17 00:00:00 2001 From: illia-prokopchuk <78905712+illia-prokopchuk@users.noreply.github.com> Date: Fri, 1 Nov 2024 13:34:25 +0200 Subject: [PATCH] Fix [Monitor Jobs] results columns are too wide when result it long (#2851) --- .../DetailsResults/DetailsResults.js | 95 +++++++++++-------- src/utils/resultsTable.js | 2 + 2 files changed, 56 insertions(+), 41 deletions(-) diff --git a/src/components/DetailsResults/DetailsResults.js b/src/components/DetailsResults/DetailsResults.js index 88cf1f132..bc277d63c 100644 --- a/src/components/DetailsResults/DetailsResults.js +++ b/src/components/DetailsResults/DetailsResults.js @@ -52,36 +52,39 @@ const DetailsResults = ({ sortConfig: { allowSortBy, excludeSortBy, defaultSortBy, defaultDirection } }) - const getHeaderCellClasses = (headerId, isSortable) => + const getHeaderCellClasses = (headerId, isSortable, customClassName = '') => classNames( 'table-header__cell', isSortable && 'sortable-header-cell', - isSortable && selectedColumnName === headerId && 'sortable-header-cell_active' + isSortable && selectedColumnName === headerId && 'sortable-header-cell_active', + customClassName ) const getHeaderTemplate = () => { return ( - - - {sortedTableHeaders.map(({ headerLabel, headerId, isSortable, ...tableItem }) => { - return ( - sortTable(headerId) : null} - > - }> - - - {tableItem.tip && } - - ) - })} - - +
+
+ {sortedTableHeaders.map( + ({ headerLabel, headerId, isSortable, className, ...tableItem }) => { + return ( +
sortTable(headerId) : null} + > + }> + + + {tableItem.tip && } +
+ ) + } + )} +
+
) } @@ -90,13 +93,13 @@ const DetailsResults = ({ ) : (
- +
{job.iterationStats && job.iterationStats.length !== 0 ? ( <> {getHeaderTemplate()} -
+
{sortedTableContent.map((rowData, rowIndex) => ( -
+
{rowData.map((cellData, cellIndex) => { if ( job.results && @@ -104,9 +107,13 @@ const DetailsResults = ({ cellIndex === 0 ) { return ( -
+ ) } else { return ( - + ) } })} - + ))} - + ) : job.iterations?.length === 0 && Object.keys(job.results ?? {}).length !== 0 ? ( <> {getHeaderTemplate()} - +
{sortedTableContent.map((rowData, rowIndex) => ( -
+
{rowData.map((cellData, cellIndex) => ( -
+ ))} - + ))} - + ) : null} -
{cellData.value} - +
} > {roundFloats(cellData.value, 4)} -
+
} + template={} > {cellData.value} -
+
) } diff --git a/src/utils/resultsTable.js b/src/utils/resultsTable.js index d0642ca2a..1a6832147 100644 --- a/src/utils/resultsTable.js +++ b/src/utils/resultsTable.js @@ -46,11 +46,13 @@ export const generateResultsContent = job => { { headerId: 'name', headerLabel: 'Name', + className: 'table-cell-3', value: resultName }, { headerId: 'value', headerLabel: 'Value', + className: 'table-cell-8', value: String(resultValue ?? '') } ]