@@ -7,14 +7,50 @@ import {getInterval, useShortInterval} from 'app/components/charts/utils';
7
7
import { getFormattedDate } from 'app/utils/dates' ;
8
8
import EventsRequest from 'app/views/organizationEvents/utils/eventsRequest' ;
9
9
import LineChart from 'app/components/charts/lineChart' ;
10
+ import MarkLine from 'app/components/charts/components/markLine' ;
10
11
import { Panel } from 'app/components/panels' ;
11
12
import withApi from 'app/utils/withApi' ;
12
13
import withGlobalSelection from 'app/utils/withGlobalSelection' ;
14
+ import theme from 'app/utils/theme' ;
13
15
14
16
const defaultGetCategory = ( ) => t ( 'Events' ) ;
15
17
18
+ const getCurrentEventMarker = currentEvent => {
19
+ const title = t ( 'Current Event' ) ;
20
+ const eventTime = + new Date ( currentEvent . dateCreated ) ;
21
+
22
+ return {
23
+ type : 'line' ,
24
+ data : [ ] ,
25
+ markLine : MarkLine ( {
26
+ // TODO replace the diamond with a custom image.
27
+ symbol : [ 'diamond' , 'none' ] ,
28
+ lineStyle : {
29
+ normal : {
30
+ color : theme . red ,
31
+ type : 'dotted' ,
32
+ } ,
33
+ } ,
34
+ tooltip : {
35
+ formatter : ( { data} ) => {
36
+ return `<div>${ getFormattedDate ( eventTime , 'MMM D, YYYY LT' ) } </div>` ;
37
+ } ,
38
+ } ,
39
+ label : {
40
+ show : false ,
41
+ } ,
42
+ data : [
43
+ {
44
+ xAxis : eventTime ,
45
+ name : title ,
46
+ } ,
47
+ ] ,
48
+ } ) ,
49
+ } ;
50
+ } ;
51
+
16
52
const ModalLineGraph = props => {
17
- const { api, groupId , organization, location, selection} = props ;
53
+ const { api, organization, location, selection, currentEvent } = props ;
18
54
19
55
const isUtc = selection . datetime . utc ;
20
56
const dateFormat = 'lll' ;
@@ -23,6 +59,7 @@ const ModalLineGraph = props => {
23
59
const hasShortInterval = useShortInterval ( selection . datetime ) ;
24
60
25
61
const xAxisOptions = {
62
+ type : 'time' ,
26
63
axisLabel : {
27
64
formatter : ( value , index ) => {
28
65
const firstItem = index === 0 ;
@@ -53,21 +90,21 @@ const ModalLineGraph = props => {
53
90
showLoading = { true }
54
91
query = { location . query . query }
55
92
includePrevious = { false }
56
- groupId = { groupId }
93
+ groupId = { currentEvent . groupID }
57
94
>
58
95
{ ( { loading, reloading, timeseriesData} ) => (
59
96
< LineChart
60
97
loading = { loading }
61
98
reloading = { reloading }
62
- series = { timeseriesData }
99
+ series = { [ ... timeseriesData , getCurrentEventMarker ( currentEvent ) ] }
63
100
seriesOptions = { {
64
101
showSymbol : false ,
65
102
} }
66
103
tooltip = { tooltip }
67
104
xAxis = { xAxisOptions }
68
105
grid = { {
69
- left : '30px ' ,
70
- right : '18px ' ,
106
+ left : '20px ' ,
107
+ right : '10px ' ,
71
108
} }
72
109
/>
73
110
) }
@@ -77,9 +114,9 @@ const ModalLineGraph = props => {
77
114
} ;
78
115
ModalLineGraph . propTypes = {
79
116
api : PropTypes . object . isRequired ,
80
- organization : SentryTypes . Organization . isRequired ,
81
- groupId : PropTypes . string . isRequired ,
117
+ currentEvent : SentryTypes . Event . isRequired ,
82
118
location : PropTypes . object . isRequired ,
119
+ organization : SentryTypes . Organization . isRequired ,
83
120
selection : PropTypes . object . isRequired ,
84
121
} ;
85
122
0 commit comments