style(ui): improve duration column representation (#43)

This commit is contained in:
Mark Omarov 2023-09-29 15:43:33 +09:00 committed by GitHub
parent 1ec122c1be
commit e106b7577a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 11 deletions

View file

@ -0,0 +1,5 @@
---
'@hyperdx/app': patch
---
style(ui): improve duration column representation

View file

@ -27,8 +27,12 @@ import { useHotkeys } from 'react-hotkeys-hook';
type Row = Record<string, any> & { duration: number };
type AccessorFn = (row: Row, column: string) => any;
const SPECIAL_VALUES = {
not_available: 'NULL',
};
const ACCESSOR_MAP: Record<string, AccessorFn> = {
duration: row => (row.duration >= 0 ? row.duration : 'N/A'),
duration: row =>
row.duration >= 0 ? row.duration : SPECIAL_VALUES.not_available,
default: (row, column) => row[column],
};
@ -367,16 +371,18 @@ export const RawLogTable = memo(
...(displayedColumns.map(column => ({
accessorFn: curry(retrieveColumnValue)(column), // Columns can contain '.' and will not work with accessorKey
header: column,
cell: info => (
<span
// role="button"
// onClick={() =>
// onPropertySearchClick(column, info.getValue<string>())
// }
>
{info.getValue<string>()}
</span>
),
cell: info => {
const value = info.getValue<string>();
return (
<span
className={cx({
'text-muted': value === SPECIAL_VALUES.not_available,
})}
>
{value}
</span>
);
},
size: 150,
})) as ColumnDef<any>[]),
{