Skip to content

Commit 4b14820

Browse files
authored
feat(events-v2) Display the current event indicator (#13661)
Add the line mark for the current event to the grouped event chart. The custom icon still needs to be added in a subsequent pull request. Refs SEN-733
1 parent 0685ea6 commit 4b14820

File tree

3 files changed

+46
-9
lines changed

3 files changed

+46
-9
lines changed

src/sentry/static/sentry/app/views/organizationEventsV2/eventDetails.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class EventDetails extends AsyncComponent {
4848
let url = `/organizations/${organization.slug}/events/`;
4949
// latest / oldest have dedicated endpoints
5050
if (['latest', 'oldest'].includes(eventId)) {
51-
url += 'latest/';
51+
url += `${eventId}/`;
5252
} else {
5353
url += `${projectId}:${eventId}/`;
5454
}

src/sentry/static/sentry/app/views/organizationEventsV2/eventModalContent.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ const EventModalContent = props => {
9595
value: (
9696
<ModalLineGraph
9797
organization={organization}
98-
groupId={event.groupID}
98+
currentEvent={event}
9999
location={location}
100100
/>
101101
),

src/sentry/static/sentry/app/views/organizationEventsV2/modalLineGraph.jsx

Lines changed: 44 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,50 @@ import {getInterval, useShortInterval} from 'app/components/charts/utils';
77
import {getFormattedDate} from 'app/utils/dates';
88
import EventsRequest from 'app/views/organizationEvents/utils/eventsRequest';
99
import LineChart from 'app/components/charts/lineChart';
10+
import MarkLine from 'app/components/charts/components/markLine';
1011
import {Panel} from 'app/components/panels';
1112
import withApi from 'app/utils/withApi';
1213
import withGlobalSelection from 'app/utils/withGlobalSelection';
14+
import theme from 'app/utils/theme';
1315

1416
const defaultGetCategory = () => t('Events');
1517

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+
1652
const ModalLineGraph = props => {
17-
const {api, groupId, organization, location, selection} = props;
53+
const {api, organization, location, selection, currentEvent} = props;
1854

1955
const isUtc = selection.datetime.utc;
2056
const dateFormat = 'lll';
@@ -23,6 +59,7 @@ const ModalLineGraph = props => {
2359
const hasShortInterval = useShortInterval(selection.datetime);
2460

2561
const xAxisOptions = {
62+
type: 'time',
2663
axisLabel: {
2764
formatter: (value, index) => {
2865
const firstItem = index === 0;
@@ -53,21 +90,21 @@ const ModalLineGraph = props => {
5390
showLoading={true}
5491
query={location.query.query}
5592
includePrevious={false}
56-
groupId={groupId}
93+
groupId={currentEvent.groupID}
5794
>
5895
{({loading, reloading, timeseriesData}) => (
5996
<LineChart
6097
loading={loading}
6198
reloading={reloading}
62-
series={timeseriesData}
99+
series={[...timeseriesData, getCurrentEventMarker(currentEvent)]}
63100
seriesOptions={{
64101
showSymbol: false,
65102
}}
66103
tooltip={tooltip}
67104
xAxis={xAxisOptions}
68105
grid={{
69-
left: '30px',
70-
right: '18px',
106+
left: '20px',
107+
right: '10px',
71108
}}
72109
/>
73110
)}
@@ -77,9 +114,9 @@ const ModalLineGraph = props => {
77114
};
78115
ModalLineGraph.propTypes = {
79116
api: PropTypes.object.isRequired,
80-
organization: SentryTypes.Organization.isRequired,
81-
groupId: PropTypes.string.isRequired,
117+
currentEvent: SentryTypes.Event.isRequired,
82118
location: PropTypes.object.isRequired,
119+
organization: SentryTypes.Organization.isRequired,
83120
selection: PropTypes.object.isRequired,
84121
};
85122

0 commit comments

Comments
 (0)