Skip to content

Commit

Permalink
remove interactions while in full screen mode
Browse files Browse the repository at this point in the history
Signed-off-by: Adam Tackett <[email protected]>
  • Loading branch information
Adam Tackett committed Jan 29, 2025
1 parent bd3560f commit e45e5f4
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ export const RenderCustomDataGrid: React.FC<RenderCustomDataGridParams> = ({
);
const [isFullScreen, setIsFullScreen] = useState(fullScreen);

const disableInteractions = useMemo(() => isFullScreen, [isFullScreen]);

const toolbarControls = useMemo(
() => [
<EuiButtonEmpty
Expand Down Expand Up @@ -132,7 +134,12 @@ export const RenderCustomDataGrid: React.FC<RenderCustomDataGridParams> = ({
setVisibleColumns: setLocalVisibleColumns,
}}
rowCount={rowCount}
renderCellValue={renderCellValue}
renderCellValue={(props) =>
renderCellValue({
...props,
disableInteractions,
})
}
sorting={sorting}
toolbarVisibility={{
showColumnSelector: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,14 @@ const renderCommonCellValue = ({
items,
tableParams,
props,
disableInteractions,
}: {
rowIndex: number;
columnId: string;
items: any[];
tableParams: any;
props: SpanDetailTableProps;
disableInteractions: boolean;
}) => {
const adjustedRowIndex = rowIndex - tableParams.page * tableParams.size;
const item = items[adjustedRowIndex];
Expand All @@ -117,7 +119,9 @@ const renderCommonCellValue = ({
return value?.serviceName;
case 'spanId':
case 'spanID':
return (
return disableInteractions ? (
<span>{value}</span>
) : (
<EuiLink data-test-subj="spanId-link" onClick={() => props.openFlyout(value)}>
{value}
</EuiLink>
Expand Down Expand Up @@ -193,13 +197,14 @@ export function SpanDetailTable(props: SpanDetailTableProps) {
}, [total]);
const columns = useMemo(() => getColumns(props.mode), [props.mode]);
const renderCellValue = useCallback(
({ rowIndex, columnId }) =>
({ rowIndex, columnId, disableInteractions }) =>
renderCommonCellValue({
rowIndex,
columnId,
items,
tableParams,
props,
disableInteractions,
}),
[items, tableParams, props]
);
Expand Down Expand Up @@ -331,7 +336,7 @@ export function SpanDetailTableHierarchy(props: SpanDetailTableProps) {
};

const renderCellValue = useCallback(
({ rowIndex, columnId }) => {
({ rowIndex, columnId, disableInteractions }) => {
const item = flattenedItems[rowIndex];
const value = item[columnId];

Expand Down Expand Up @@ -360,14 +365,17 @@ export function SpanDetailTableHierarchy(props: SpanDetailTableProps) {
) : (
<EuiIcon type="empty" style={{ visibility: 'hidden', marginRight: 5 }} />
)}
<EuiButtonEmpty
size="xs"
onClick={() => openFlyout(value)}
color="primary"
data-test-subj="spanId-flyout-button"
>
{value}
</EuiButtonEmpty>
{disableInteractions ? (
<span>{value}</span>
) : (
<EuiLink
onClick={() => openFlyout(value)}
color="primary"
data-test-subj="spanId-flyout-button"
>
{value}
</EuiLink>
)}
</div>
);
}
Expand Down

0 comments on commit e45e5f4

Please sign in to comment.