mirror of
https://github.com/SigNoz/signoz.git
synced 2025-12-17 23:47:12 +00:00
fix: open log details on clicking on empty column cell too (#8618)
This commit is contained in:
parent
498d398ea3
commit
fa936a7e0d
@ -23,6 +23,7 @@ interface TableRowProps {
|
|||||||
index: number;
|
index: number;
|
||||||
log: Record<string, unknown>;
|
log: Record<string, unknown>;
|
||||||
handleSetActiveContextLog: (log: ILog) => void;
|
handleSetActiveContextLog: (log: ILog) => void;
|
||||||
|
onShowLogDetails: (log: ILog) => void;
|
||||||
logs: ILog[];
|
logs: ILog[];
|
||||||
hasActions: boolean;
|
hasActions: boolean;
|
||||||
fontSize: FontSize;
|
fontSize: FontSize;
|
||||||
@ -33,6 +34,7 @@ export default function TableRow({
|
|||||||
index,
|
index,
|
||||||
log,
|
log,
|
||||||
handleSetActiveContextLog,
|
handleSetActiveContextLog,
|
||||||
|
onShowLogDetails,
|
||||||
logs,
|
logs,
|
||||||
hasActions,
|
hasActions,
|
||||||
fontSize,
|
fontSize,
|
||||||
@ -57,6 +59,11 @@ export default function TableRow({
|
|||||||
[currentLog, handleSetActiveContextLog],
|
[currentLog, handleSetActiveContextLog],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const handleShowLogDetails = useCallback(() => {
|
||||||
|
if (!onShowLogDetails || !currentLog) return;
|
||||||
|
onShowLogDetails(currentLog);
|
||||||
|
}, [currentLog, onShowLogDetails]);
|
||||||
|
|
||||||
const hasSingleColumn =
|
const hasSingleColumn =
|
||||||
tableColumns.filter((column) => column.key !== 'state-indicator').length ===
|
tableColumns.filter((column) => column.key !== 'state-indicator').length ===
|
||||||
1;
|
1;
|
||||||
@ -89,6 +96,7 @@ export default function TableRow({
|
|||||||
key={column.key}
|
key={column.key}
|
||||||
fontSize={fontSize}
|
fontSize={fontSize}
|
||||||
columnKey={column.key as string}
|
columnKey={column.key as string}
|
||||||
|
onClick={handleShowLogDetails}
|
||||||
>
|
>
|
||||||
{cloneElement(children, props)}
|
{cloneElement(children, props)}
|
||||||
</TableCellStyled>
|
</TableCellStyled>
|
||||||
|
|||||||
@ -108,6 +108,7 @@ const InfinityTable = forwardRef<TableVirtuosoHandle, InfinityTableProps>(
|
|||||||
logs={tableViewProps.logs}
|
logs={tableViewProps.logs}
|
||||||
hasActions
|
hasActions
|
||||||
fontSize={tableViewProps.fontSize}
|
fontSize={tableViewProps.fontSize}
|
||||||
|
onShowLogDetails={onSetActiveLog}
|
||||||
/>
|
/>
|
||||||
),
|
),
|
||||||
[
|
[
|
||||||
@ -115,6 +116,7 @@ const InfinityTable = forwardRef<TableVirtuosoHandle, InfinityTableProps>(
|
|||||||
tableColumns,
|
tableColumns,
|
||||||
tableViewProps.fontSize,
|
tableViewProps.fontSize,
|
||||||
tableViewProps.logs,
|
tableViewProps.logs,
|
||||||
|
onSetActiveLog,
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -146,12 +148,6 @@ const InfinityTable = forwardRef<TableVirtuosoHandle, InfinityTableProps>(
|
|||||||
[tableColumns, isDarkMode, tableViewProps?.fontSize],
|
[tableColumns, isDarkMode, tableViewProps?.fontSize],
|
||||||
);
|
);
|
||||||
|
|
||||||
const handleClickExpand = (index: number): void => {
|
|
||||||
if (!onSetActiveLog) return;
|
|
||||||
|
|
||||||
onSetActiveLog(tableViewProps.logs[index]);
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<TableVirtuoso
|
<TableVirtuoso
|
||||||
@ -183,9 +179,6 @@ const InfinityTable = forwardRef<TableVirtuosoHandle, InfinityTableProps>(
|
|||||||
{...(infitiyTableProps?.onEndReached
|
{...(infitiyTableProps?.onEndReached
|
||||||
? { endReached: infitiyTableProps.onEndReached }
|
? { endReached: infitiyTableProps.onEndReached }
|
||||||
: {})}
|
: {})}
|
||||||
onClick={(event: any): void => {
|
|
||||||
handleClickExpand(event.target.parentElement.parentElement.dataset.index);
|
|
||||||
}}
|
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{activeContextLog && (
|
{activeContextLog && (
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user