LogLine: fix unwrapped unique labels
This commit is contained in:
@@ -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}`;
|
||||
|
||||
Reference in New Issue
Block a user