@@ -2,6 +2,7 @@ import {useCallback} from 'react';
2
2
import styled from '@emotion/styled' ;
3
3
4
4
import { Button } from 'sentry/components/core/button' ;
5
+ import { OurlogsDrawer } from 'sentry/components/events/ourlogs/ourlogsDrawer' ;
5
6
import useDrawer from 'sentry/components/globalDrawer' ;
6
7
import { IconChevron } from 'sentry/icons' ;
7
8
import { t } from 'sentry/locale' ;
@@ -14,37 +15,53 @@ import {LogsAnalyticsPageSource} from 'sentry/utils/analytics/logsAnalyticsEvent
14
15
import useOrganization from 'sentry/utils/useOrganization' ;
15
16
import {
16
17
LogsPageParamsProvider ,
17
- type LogsPageParamsProviderProps ,
18
+ useLogsSearch ,
18
19
} from 'sentry/views/explore/contexts/logs/logsPageParams' ;
19
20
import { TraceItemAttributeProvider } from 'sentry/views/explore/contexts/traceItemAttributeContext' ;
20
- import { LogsIssueDrawer } from 'sentry/views/explore/logs/logsIssueDrawer' ;
21
21
import { LogsTable } from 'sentry/views/explore/logs/logsTable' ;
22
- import {
23
- useExploreLogsTable ,
24
- type UseExploreLogsTableResult ,
25
- } from 'sentry/views/explore/logs/useLogsQuery' ;
22
+ import { useExploreLogsTable } from 'sentry/views/explore/logs/useLogsQuery' ;
26
23
import { TraceItemDataset } from 'sentry/views/explore/types' ;
27
24
import { SectionKey } from 'sentry/views/issueDetails/streamline/context' ;
28
25
import { InterimSection } from 'sentry/views/issueDetails/streamline/interimSection' ;
29
26
30
- export function LogsIssuesSection ( {
31
- initialCollapse,
32
- isOnEmbeddedView,
33
- limitToTraceId,
27
+ export function OurlogsSection ( {
34
28
event,
35
29
project,
36
30
group,
37
31
} : {
38
32
event : Event ;
39
33
group : Group ;
40
- initialCollapse : boolean ;
41
34
project : Project ;
42
- } & Omit < LogsPageParamsProviderProps , 'children' | 'analyticsPageSource' > ) {
35
+ } ) {
36
+ return (
37
+ < LogsPageParamsProvider
38
+ analyticsPageSource = { LogsAnalyticsPageSource . ISSUE_DETAILS }
39
+ isTableFrozen
40
+ blockRowExpanding
41
+ limitToTraceId = { event . contexts ?. trace ?. trace_id }
42
+ >
43
+ < OurlogsSectionContent event = { event } group = { group } project = { project } />
44
+ </ LogsPageParamsProvider >
45
+ ) ;
46
+ }
47
+
48
+ function OurlogsSectionContent ( {
49
+ event,
50
+ project,
51
+ group,
52
+ } : {
53
+ event : Event ;
54
+ group : Group ;
55
+ project : Project ;
56
+ } ) {
43
57
const organization = useOrganization ( ) ;
44
58
const feature = organization . features . includes ( 'ourlogs-enabled' ) ;
45
59
const tableData = useExploreLogsTable ( { enabled : feature , limit : 10 } ) ;
60
+ const logsSearch = useLogsSearch ( ) ;
61
+ const abbreviatedTableData = { ...tableData , data : ( tableData . data ?? [ ] ) . slice ( 0 , 5 ) } ;
46
62
const { openDrawer} = useDrawer ( ) ;
47
63
64
+ const limitToTraceId = event . contexts ?. trace ?. trace_id ;
48
65
const onOpenLogsDrawer = useCallback ( ( ) => {
49
66
trackAnalytics ( 'logs.issue_details.drawer_opened' , {
50
67
organization,
@@ -53,11 +70,11 @@ export function LogsIssuesSection({
53
70
( ) => (
54
71
< LogsPageParamsProvider
55
72
analyticsPageSource = { LogsAnalyticsPageSource . ISSUE_DETAILS }
56
- isOnEmbeddedView
73
+ isTableFrozen
57
74
limitToTraceId = { limitToTraceId }
58
75
>
59
76
< TraceItemAttributeProvider traceItemType = { TraceItemDataset . LOGS } enabled >
60
- < LogsIssueDrawer group = { group } event = { event } project = { project } />
77
+ < OurlogsDrawer group = { group } event = { event } project = { project } />
61
78
</ TraceItemAttributeProvider >
62
79
</ LogsPageParamsProvider >
63
80
) ,
@@ -75,7 +92,7 @@ export function LogsIssuesSection({
75
92
// We may change this in the future if we have a trace-group or we generate trace sids for these issue types.
76
93
return null ;
77
94
}
78
- if ( tableData ? .data ?. length === 0 ) {
95
+ if ( ! tableData || ( tableData . data ?. length === 0 && logsSearch . isEmpty ( ) ) ) {
79
96
// Like breadcrumbs, we don't show the logs section if there are no logs.
80
97
return null ;
81
98
}
@@ -85,52 +102,40 @@ export function LogsIssuesSection({
85
102
type = { SectionKey . LOGS }
86
103
title = { t ( 'Logs' ) }
87
104
data-test-id = "logs-data-section"
88
- initialCollapse = { initialCollapse }
89
105
>
90
- < LogsPageParamsProvider
91
- analyticsPageSource = { LogsAnalyticsPageSource . ISSUE_DETAILS }
92
- isOnEmbeddedView = { isOnEmbeddedView }
93
- limitToTraceId = { limitToTraceId }
94
- >
95
- < LogsSectionContent tableData = { tableData } openDrawer = { onOpenLogsDrawer } />
96
- </ LogsPageParamsProvider >
106
+ < LogContentWrapper onClick = { ( ) => onOpenLogsDrawer ( ) } >
107
+ < LogsTable
108
+ showHeader = { false }
109
+ allowPagination = { false }
110
+ tableData = { abbreviatedTableData }
111
+ />
112
+ { tableData . data ?. length > 5 ? (
113
+ < div >
114
+ < Button
115
+ icon = { < IconChevron direction = "right" /> }
116
+ aria-label = { t ( 'View more' ) }
117
+ size = "md"
118
+ onClick = { ( ) => onOpenLogsDrawer ( ) }
119
+ >
120
+ { t ( 'View more' ) }
121
+ </ Button >
122
+ </ div >
123
+ ) : null }
124
+ </ LogContentWrapper >
97
125
</ InterimSection >
98
126
) ;
99
127
}
100
128
101
- function LogsSectionContent ( {
102
- tableData,
103
- openDrawer,
104
- } : {
105
- openDrawer : ( ) => void ;
106
- tableData : UseExploreLogsTableResult ;
107
- } ) {
108
- const abbreviatedTableData = { ...tableData , data : ( tableData . data ?? [ ] ) . slice ( 0 , 5 ) } ;
109
- return (
110
- < LogContentWrapper >
111
- < LogsTable
112
- showHeader = { false }
113
- allowPagination = { false }
114
- tableData = { abbreviatedTableData }
115
- />
116
- { tableData . data ?. length > 5 ? (
117
- < div >
118
- < Button
119
- icon = { < IconChevron direction = "right" /> }
120
- aria-label = { t ( 'View more' ) }
121
- size = "md"
122
- onClick = { ( ) => openDrawer ( ) }
123
- >
124
- { t ( 'View more' ) }
125
- </ Button >
126
- </ div >
127
- ) : null }
128
- </ LogContentWrapper >
129
- ) ;
130
- }
131
-
132
- const LogContentWrapper = styled ( 'div' ) `
129
+ const LogContentWrapper = styled ( 'button' ) `
130
+ all: unset;
133
131
display: flex;
134
132
flex-direction: column;
135
133
gap: ${ space ( 1 ) } ;
134
+ pointer-events: auto;
135
+ cursor: pointer;
136
+
137
+ * {
138
+ pointer-events: none !important;
139
+ cursor: inherit !important;
140
+ }
136
141
` ;
0 commit comments