LogLine: fix unwrapped unique labels

This commit is contained in:
Matias Chomicki
2025-09-17 12:15:45 +02:00
parent c82311e74a
commit d57169fcea
2 changed files with 31 additions and 1 deletions
@@ -613,4 +613,34 @@ describe('getGridTemplateColumns', () => {
)
).toBe('23px 4px 4px 20px');
});
test('Gets the template columns with unique labels', () => {
expect(
getGridTemplateColumns(
[
{
field: 'timestamp',
width: 23,
},
{
field: 'level',
width: 4,
},
{
field: 'unique-labels',
width: 0,
},
{
field: 'field',
width: 4,
},
{
field: LOG_LINE_BODY_FIELD_NAME,
width: 20,
},
],
['field']
)
).toBe('23px 4px max-content 4px 20px');
});
});
@@ -451,7 +451,7 @@ const LogLineBody = ({ log, styles }: { log: LogListModel; styles: LogLineStyles
export function getGridTemplateColumns(dimensions: LogFieldDimension[], displayedFields: string[]) {
const columns = dimensions
.map((dimension) => (dimension.width > 0 ? `${dimension.width}px` : 'fit-content(50%)'))
.map((dimension) => (dimension.width > 0 ? `${dimension.width}px` : 'max-content'))
.join(' ');
const logLineWidth = displayedFields.length > 0 ? '' : ' 1fr';
return `${columns}${logLineWidth}`;