Просмотр исходного кода

feat(issue-priority): Add inbox tab for new search query (#65594)

The default query was already modified to include the new
`issue.priority`, this adds a tab for it.
Malachi Willey 1 год назад
Родитель
Сommit
de3adaf54c
2 измененных файлов с 24 добавлено и 25 удалено
  1. 14 25
      static/app/views/issueList/utils.spec.tsx
  2. 10 0
      static/app/views/issueList/utils.tsx

+ 14 - 25
static/app/views/issueList/utils.spec.tsx

@@ -3,34 +3,23 @@ import {OrganizationFixture} from 'sentry-fixture/organization';
 import {getTabs} from './utils';
 
 describe('getTabs', () => {
-  it('should enable/disable tabs for escalating-issues', () => {
-    expect(getTabs(OrganizationFixture({})).map(tab => tab[1].name)).toEqual([
-      'Unresolved',
-      'For Review',
-      'Regressed',
-      'Escalating',
-      'Archived',
-      'Custom',
-    ]);
-
-    expect(getTabs(OrganizationFixture({})).map(tab => tab[1].name)).toEqual([
-      'Unresolved',
-      'For Review',
-      'Regressed',
-      'Escalating',
-      'Archived',
-      'Custom',
+  it('displays the correct list of tabs', () => {
+    expect(getTabs(OrganizationFixture({})).filter(tab => !tab[1].hidden)).toEqual([
+      ['is:unresolved', expect.objectContaining({name: 'Unresolved'})],
+      [
+        'is:unresolved is:for_review assigned_or_suggested:[me, my_teams, none]',
+        expect.objectContaining({name: 'For Review'}),
+      ],
+      ['is:regressed', expect.objectContaining({name: 'Regressed'})],
+      ['is:escalating', expect.objectContaining({name: 'Escalating'})],
+      ['is:archived', expect.objectContaining({name: 'Archived'})],
     ]);
   });
 
-  it('should enable/disable my_teams filter in For Review tab', () => {
-    expect(getTabs(OrganizationFixture({features: []})).map(tab => tab[0])).toEqual([
-      'is:unresolved',
-      'is:unresolved is:for_review assigned_or_suggested:[me, my_teams, none]',
-      'is:regressed',
-      'is:escalating',
-      'is:archived',
-      '__custom__',
+  it('should add inbox tab for issue-priority-ui feature', () => {
+    expect(getTabs(OrganizationFixture({features: ['issue-priority-ui']}))[0]).toEqual([
+      'is:unresolved issue.priority:[high, medium]',
+      expect.objectContaining({name: 'Inbox'}),
     ]);
   });
 });

+ 10 - 0
static/app/views/issueList/utils.tsx

@@ -5,6 +5,7 @@ import type {Organization} from 'sentry/types';
 
 export enum Query {
   FOR_REVIEW = 'is:unresolved is:for_review assigned_or_suggested:[me, my_teams, none]',
+  INBOX = NEW_DEFAULT_QUERY,
   UNRESOLVED = 'is:unresolved',
   IGNORED = 'is:ignored',
   NEW = 'is:new',
@@ -46,6 +47,15 @@ type OverviewTab = {
  */
 export function getTabs(organization: Organization) {
   const tabs: Array<[string, OverviewTab]> = [
+    [
+      Query.INBOX,
+      {
+        name: t('Inbox'),
+        analyticsName: 'inbox',
+        count: true,
+        enabled: organization.features.includes('issue-priority-ui'),
+      },
+    ],
     [
       Query.UNRESOLVED,
       {