Skip to content

Commit 2b8d600

Browse files
authored
fix(events-v2): Add error/csp conditions to tabs (#13697)
This adds the error/csp filtering to those tabs. Previously the data on these two tabs was exactly the same.
1 parent 15d7ea9 commit 2b8d600

File tree

3 files changed

+22
-0
lines changed

3 files changed

+22
-0
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ export const ALL_VIEWS = deepFreeze([
4040
fields: ['error', 'event_count', 'user_count', 'project', 'last_seen'],
4141
groupby: ['issue.id', 'project.id'],
4242
orderby: ['-last_seen', '-issue.id'],
43+
query: 'event.type:error',
4344
},
4445
tags: ['error.type', 'project.name'],
4546
},
@@ -50,6 +51,7 @@ export const ALL_VIEWS = deepFreeze([
5051
fields: ['csp', 'event_count', 'user_count', 'project', 'last_seen'],
5152
groupby: ['issue.id', 'project.id'],
5253
orderby: ['-last_seen', '-issue.id'],
54+
query: 'event.type:csp',
5355
},
5456
tags: [
5557
'project.name',

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,14 @@ export function getQuery(view, location) {
5555
data.groupby = groupby;
5656
data.orderby = view.data.orderby;
5757
data.per_page = DEFAULT_PER_PAGE;
58+
59+
if (view.data.query) {
60+
if (data.query) {
61+
data.query = `${data.query} ${view.data.query}`;
62+
} else {
63+
data.query = view.data.query;
64+
}
65+
}
5866
return data;
5967
}
6068

tests/js/spec/views/organizationEventsV2/utils.spec.jsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,18 @@ describe('getQuery()', function() {
4040
'issue.id',
4141
]);
4242
});
43+
44+
it('appends any additional conditions defined for view', function() {
45+
const view = {
46+
id: 'test',
47+
name: 'test view',
48+
data: {fields: ['id'], query: 'event.type:csp'},
49+
tags: [],
50+
};
51+
52+
expect(getQuery(view, {}).query).toEqual('event.type:csp');
53+
expect(getQuery(view, {query: {query: 'test'}}).query).toEqual('test event.type:csp');
54+
});
4355
});
4456

4557
describe('eventTagSearchUrl()', function() {

0 commit comments

Comments
 (0)