diff --git a/app/javascript/components/miq-data-table/miq-table-cell.jsx b/app/javascript/components/miq-data-table/miq-table-cell.jsx index ed54f3e1202..43836e4cc3d 100644 --- a/app/javascript/components/miq-data-table/miq-table-cell.jsx +++ b/app/javascript/components/miq-data-table/miq-table-cell.jsx @@ -12,8 +12,18 @@ import { const MiqTableCell = ({ cell, onCellClick, row, truncate, }) => { - const truncateText = {cell.value}; - const truncateClass = ((cell.value).length > 40) && truncate ? 'truncate_cell' : ''; + const longText = truncate && ((cell.value).length > 40); + const veryLongText = truncate && ((cell.value).length > 300); + + const truncateClass = longText ? 'truncate_cell' : ''; + const wrapClass = longText ? 'white_space_normal' : ''; + const longerTextClass = veryLongText ? 'truncate_longer_text' : ''; + + const truncateText = ( + + {cell.value} + + ); const cellClass = classNames('cell', truncateClass, cell.data.style_class); const cellText = () => (
@@ -60,16 +70,21 @@ const MiqTableCell = ({ }; /** Fuction to render icon(s) in cell. */ - const renderIcon = (icon, style, showText) => ( -
- { - typeof (icon) === 'string' - ? - : icon.map((i, index) => ) - } - {showText && truncateText} -
- ); + const renderIcon = (icon, style, showText) => { + const hasBackground = Object.keys(style).includes('background'); + const styledIconClass = hasBackground ? 'styled_icon' : ''; + const longerTextClass = hasBackground && veryLongText ? 'styled_icon_margin' : ''; + return ( +
+ { + typeof (icon) === 'string' + ? + : icon.map((i, index) => ) + } + {showText && truncateText} +
+ ); + }; /** Fuction to render an icon in cell based on the 'type' in 'item'. */ const cellIcon = (item, showText) => { @@ -101,9 +116,9 @@ const MiqTableCell = ({ const cellButton = (item) => (