Browse Source

fix(discover): Add project filter if present in drilldown (#19349)

Tony 4 years ago
parent
commit
527d2644fa

+ 0 - 4
src/sentry/static/sentry/app/views/eventsV2/utils.tsx

@@ -403,10 +403,6 @@ function generateExpandedConditions(
     if (column.kind === 'function') {
       continue;
     }
-    // Skip project name
-    if (key === 'project' || key === 'project.name') {
-      continue;
-    }
     parsedQuery[key] = [conditions[key]];
   }
 

+ 22 - 0
tests/js/spec/views/eventsV2/utils.spec.jsx

@@ -414,6 +414,28 @@ describe('getExpandedResults()', function() {
     const result = getExpandedResults(view, {trace: 'abc123'}, event);
     expect(result.query).toEqual('event.type:error title:bogus trace:abc123');
   });
+
+  it('applies project as condition if present', () => {
+    const view = new EventView({
+      ...state,
+      query: '',
+      fields: [{field: 'project'}],
+    });
+    const event = {project: 'whoosh'};
+    const result = getExpandedResults(view, {}, event);
+    expect(result.query).toEqual('project:whoosh');
+  });
+
+  it('applies project name as condition if present', () => {
+    const view = new EventView({
+      ...state,
+      query: '',
+      fields: [{field: 'project.name'}],
+    });
+    const event = {'project.name': 'whoosh'};
+    const result = getExpandedResults(view, {}, event);
+    expect(result.query).toEqual('project.name:whoosh');
+  });
 });
 
 describe('getDiscoverLandingUrl', function() {