Skip to content

Commit cf8c0ac

Browse files
committed
add a new prop, finagle things a bit more
1 parent 43eef0e commit cf8c0ac

File tree

5 files changed

+41
-18
lines changed

5 files changed

+41
-18
lines changed

static/app/components/events/breadcrumbs/combinedBreadcrumbsAndLogsSection.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ export function CombinedBreadcrumbsAndLogsSection({
2626
return (
2727
<LogsPageParamsProvider
2828
isTableFrozen
29+
blockRowExpanding
2930
limitToTraceId={event.contexts?.trace?.trace_id}
3031
analyticsPageSource={LogsAnalyticsPageSource.ISSUE_DETAILS}
3132
>

static/app/views/explore/contexts/logs/logsPageParams.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ export const LOGS_FIELDS_KEY = 'logsFields';
3131

3232
interface LogsPageParams {
3333
readonly analyticsPageSource: LogsAnalyticsPageSource;
34+
readonly blockRowExpanding: boolean | undefined;
3435
readonly cursor: string;
3536
readonly fields: string[];
3637
readonly isTableFrozen: boolean | undefined;
@@ -57,6 +58,7 @@ const [_LogsPageParamsProvider, _useLogsPageParams, LogsPageParamsContext] =
5758
export interface LogsPageParamsProviderProps {
5859
analyticsPageSource: LogsAnalyticsPageSource;
5960
children: React.ReactNode;
61+
blockRowExpanding?: boolean;
6062
isTableFrozen?: boolean;
6163
limitToProjectIds?: number[];
6264
limitToSpanId?: string;
@@ -68,6 +70,7 @@ export function LogsPageParamsProvider({
6870
limitToTraceId,
6971
limitToSpanId,
7072
limitToProjectIds,
73+
blockRowExpanding,
7174
isTableFrozen,
7275
analyticsPageSource,
7376
}: LogsPageParamsProviderProps) {
@@ -103,6 +106,7 @@ export function LogsPageParamsProvider({
103106
sortBys,
104107
cursor,
105108
isTableFrozen,
109+
blockRowExpanding,
106110
baseSearch,
107111
projectIds,
108112
analyticsPageSource,
@@ -202,7 +206,12 @@ export function useSetLogsSearch() {
202206

203207
export function useLogsIsTableFrozen() {
204208
const {isTableFrozen} = useLogsPageParams();
205-
return isTableFrozen;
209+
return !!isTableFrozen;
210+
}
211+
212+
export function useLogsBlockRowExpanding() {
213+
const {blockRowExpanding} = useLogsPageParams();
214+
return !!blockRowExpanding;
206215
}
207216

208217
export function usePersistedLogsPageParams() {

static/app/views/explore/logs/logsIssuesSection.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ export function LogsIssuesSection({
8989
<LogsPageParamsProvider
9090
analyticsPageSource={LogsAnalyticsPageSource.ISSUE_DETAILS}
9191
isTableFrozen
92+
blockRowExpanding
9293
limitToTraceId={limitToTraceId}
9394
>
9495
<LogsSectionContent tableData={tableData} openDrawer={onOpenLogsDrawer} />

static/app/views/explore/logs/logsTableRow.tsx

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type {SyntheticEvent} from 'react';
1+
import type {ComponentProps, SyntheticEvent} from 'react';
22
import {Fragment, useCallback, useState} from 'react';
33
import {useTheme} from '@emotion/react';
44

@@ -20,6 +20,7 @@ import type {TableColumn} from 'sentry/views/discover/table/types';
2020
import {AttributesTree} from 'sentry/views/explore/components/traceItemAttributes/attributesTree';
2121
import {
2222
useLogsAnalyticsPageSource,
23+
useLogsBlockRowExpanding,
2324
useLogsFields,
2425
useLogsIsTableFrozen,
2526
useLogsSearch,
@@ -94,6 +95,7 @@ export function LogRowContent({
9495
const search = useLogsSearch();
9596
const setLogsSearch = useSetLogsSearch();
9697
const isTableFrozen = useLogsIsTableFrozen();
98+
const blockRowExpanding = useLogsBlockRowExpanding();
9799

98100
function toggleExpanded() {
99101
setExpanded(e => !e);
@@ -165,24 +167,30 @@ export function LogRowContent({
165167
projectSlug,
166168
};
167169

170+
const rowInteractProps: ComponentProps<typeof LogTableRow> = blockRowExpanding
171+
? {}
172+
: {
173+
...hoverProps,
174+
onPointerUp,
175+
onTouchEnd: onPointerUp,
176+
isClickable: true,
177+
};
178+
168179
return (
169180
<Fragment>
170-
<LogTableRow
171-
data-test-id="log-table-row"
172-
onPointerUp={onPointerUp}
173-
onTouchEnd={onPointerUp}
174-
{...hoverProps}
175-
>
181+
<LogTableRow data-test-id="log-table-row" {...rowInteractProps}>
176182
<LogsTableBodyFirstCell key={'first'}>
177183
<LogFirstCellContent>
178-
<StyledChevronButton
179-
icon={<IconChevron size="xs" direction={expanded ? 'down' : 'right'} />}
180-
aria-label={t('Toggle trace details')}
181-
aria-expanded={expanded}
182-
size="zero"
183-
borderless
184-
onClick={() => toggleExpanded()}
185-
/>
184+
{blockRowExpanding ? null : (
185+
<StyledChevronButton
186+
icon={<IconChevron size="xs" direction={expanded ? 'down' : 'right'} />}
187+
aria-label={t('Toggle trace details')}
188+
aria-expanded={expanded}
189+
size="zero"
190+
borderless
191+
onClick={() => toggleExpanded()}
192+
/>
193+
)}
186194
<SeverityCircleRenderer extra={rendererExtra} meta={meta} />
187195
</LogFirstCellContent>
188196
</LogsTableBodyFirstCell>

static/app/views/explore/logs/styles.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,13 @@ const StyledPanel = styled(Panel)`
1919
margin-bottom: 0;
2020
`;
2121

22-
export const LogTableRow = styled(TableRow)`
22+
interface LogTableRowProps {
23+
isClickable?: boolean;
24+
}
25+
26+
export const LogTableRow = styled(TableRow)<LogTableRowProps>`
2327
&:not(thead > &) {
24-
cursor: pointer;
28+
cursor: ${p => (p.isClickable ? 'pointer' : 'default')};
2529
2630
&:hover {
2731
background-color: ${p => p.theme.backgroundSecondary};

0 commit comments

Comments
 (0)