fix: open log details on clicking on empty column cell too (#8618)

This commit is contained in:
Yunus M 2025-07-29 14:06:13 +05:30 committed by GitHub
parent 498d398ea3
commit fa936a7e0d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 9 deletions

View File

@ -23,6 +23,7 @@ interface TableRowProps {
index: number;
log: Record<string, unknown>;
handleSetActiveContextLog: (log: ILog) => void;
onShowLogDetails: (log: ILog) => void;
logs: ILog[];
hasActions: boolean;
fontSize: FontSize;
@ -33,6 +34,7 @@ export default function TableRow({
index,
log,
handleSetActiveContextLog,
onShowLogDetails,
logs,
hasActions,
fontSize,
@ -57,6 +59,11 @@ export default function TableRow({
[currentLog, handleSetActiveContextLog],
);
const handleShowLogDetails = useCallback(() => {
if (!onShowLogDetails || !currentLog) return;
onShowLogDetails(currentLog);
}, [currentLog, onShowLogDetails]);
const hasSingleColumn =
tableColumns.filter((column) => column.key !== 'state-indicator').length ===
1;
@ -89,6 +96,7 @@ export default function TableRow({
key={column.key}
fontSize={fontSize}
columnKey={column.key as string}
onClick={handleShowLogDetails}
>
{cloneElement(children, props)}
</TableCellStyled>

View File

@ -108,6 +108,7 @@ const InfinityTable = forwardRef<TableVirtuosoHandle, InfinityTableProps>(
logs={tableViewProps.logs}
hasActions
fontSize={tableViewProps.fontSize}
onShowLogDetails={onSetActiveLog}
/>
),
[
@ -115,6 +116,7 @@ const InfinityTable = forwardRef<TableVirtuosoHandle, InfinityTableProps>(
tableColumns,
tableViewProps.fontSize,
tableViewProps.logs,
onSetActiveLog,
],
);
@ -146,12 +148,6 @@ const InfinityTable = forwardRef<TableVirtuosoHandle, InfinityTableProps>(
[tableColumns, isDarkMode, tableViewProps?.fontSize],
);
const handleClickExpand = (index: number): void => {
if (!onSetActiveLog) return;
onSetActiveLog(tableViewProps.logs[index]);
};
return (
<>
<TableVirtuoso
@ -183,9 +179,6 @@ const InfinityTable = forwardRef<TableVirtuosoHandle, InfinityTableProps>(
{...(infitiyTableProps?.onEndReached
? { endReached: infitiyTableProps.onEndReached }
: {})}
onClick={(event: any): void => {
handleClickExpand(event.target.parentElement.parentElement.dataset.index);
}}
/>
{activeContextLog && (