Browse Source

ref(sort): Remove trend sort frontend (#49279)

Remove the unused feature trend sort. Backend PR
[here](https://github.com/getsentry/sentry/pull/49280).
Colleen O'Rourke 1 year ago
parent
commit
16e5eacf18

+ 3 - 15
static/app/components/modals/savedSearchModal/createSavedSearchModal.tsx

@@ -26,20 +26,8 @@ const DEFAULT_SORT_OPTIONS = [
   IssueSortOptions.USER,
 ];
 
-function getSortOptions(organization: Organization) {
-  return organization?.features?.includes('issue-list-trend-sort')
-    ? [...DEFAULT_SORT_OPTIONS, IssueSortOptions.TREND]
-    : DEFAULT_SORT_OPTIONS;
-}
-
-function validateSortOption({
-  organization,
-  sort,
-}: {
-  organization: Organization;
-  sort?: string;
-}) {
-  if (getSortOptions(organization).find(option => option === sort)) {
+function validateSortOption({sort}: {sort?: string}) {
+  if (DEFAULT_SORT_OPTIONS.find(option => option === sort)) {
     return sort as string;
   }
 
@@ -61,7 +49,7 @@ export function CreateSavedSearchModal({
   const initialData = {
     name: '',
     query,
-    sort: validateSortOption({organization, sort}),
+    sort: validateSortOption({sort}),
     visibility: SavedSearchVisibility.Owner,
   };
 

+ 1 - 7
static/app/components/modals/savedSearchModal/savedSearchModalContent.tsx

@@ -24,16 +24,10 @@ const SELECT_FIELD_VISIBILITY_OPTIONS = [
   {value: SavedSearchVisibility.Organization, label: t('Users in my organization')},
 ];
 
-function getSortOptions(organization: Organization) {
-  return organization?.features?.includes('issue-list-trend-sort')
-    ? [...DEFAULT_SORT_OPTIONS, IssueSortOptions.TREND]
-    : DEFAULT_SORT_OPTIONS;
-}
-
 export function SavedSearchModalContent({organization}: SavedSearchModalContentProps) {
   const canChangeVisibility = organization.access.includes('org:write');
 
-  const selectFieldSortOptions = getSortOptions(organization).map(sortOption => ({
+  const selectFieldSortOptions = DEFAULT_SORT_OPTIONS.map(sortOption => ({
     value: sortOption,
     label: getSortLabel(sortOption),
   }));

+ 1 - 4
static/app/views/dashboards/datasetConfig/issues.tsx

@@ -72,11 +72,8 @@ function disableSortOptions(_widgetQuery: WidgetQuery) {
   };
 }
 
-function getTableSortOptions(organization: Organization, _widgetQuery: WidgetQuery) {
+function getTableSortOptions(_organization: Organization, _widgetQuery: WidgetQuery) {
   const sortOptions = [...ISSUE_WIDGET_SORT_OPTIONS];
-  if (organization.features.includes('issue-list-trend-sort')) {
-    sortOptions.push(IssueSortOptions.TREND);
-  }
   return sortOptions.map(sortOption => ({
     label: getSortLabel(sortOption),
     value: sortOption,

+ 1 - 6
static/app/views/dashboards/widgetBuilder/issueWidget/utils.tsx

@@ -34,13 +34,8 @@ export const ISSUE_WIDGET_SORT_OPTIONS = [
   IssueSortOptions.USER,
 ];
 
-export function generateIssueWidgetOrderOptions(
-  includeRelativeChange: boolean
-): SelectValue<string>[] {
+export function generateIssueWidgetOrderOptions(): SelectValue<string>[] {
   const sortOptions = [...ISSUE_WIDGET_SORT_OPTIONS];
-  if (includeRelativeChange) {
-    sortOptions.push(IssueSortOptions.TREND);
-  }
   return sortOptions.map(sortOption => ({
     label: getSortLabel(sortOption),
     value: sortOption,

+ 14 - 29
static/app/views/issueList/actions/sortOptions.tsx

@@ -1,4 +1,3 @@
-import Feature from 'sentry/components/acl/feature';
 import {CompactSelect} from 'sentry/components/compactSelect';
 import {IconSort} from 'sentry/icons/iconSort';
 import {t} from 'sentry/locale';
@@ -22,26 +21,12 @@ function getSortTooltip(key: IssueSortOptions) {
       return t('Number of events.');
     case IssueSortOptions.USER:
       return t('Number of users affected.');
-    case IssueSortOptions.TREND:
-      return t('% change in event count.');
     case IssueSortOptions.DATE:
     default:
       return t('Last time the issue occurred.');
   }
 }
 
-function getSortOptions(sortKeys: IssueSortOptions[], hasTrendSort = false) {
-  const combinedSortKeys = [
-    ...sortKeys,
-    ...(hasTrendSort ? [IssueSortOptions.TREND] : []),
-  ];
-  return combinedSortKeys.map(key => ({
-    value: key,
-    label: getSortLabel(key),
-    details: getSortTooltip(key),
-  }));
-}
-
 function IssueListSortOptions({onSelect, sort, query}: Props) {
   const sortKey = sort || IssueSortOptions.DATE;
   const sortKeys = [
@@ -54,20 +39,20 @@ function IssueListSortOptions({onSelect, sort, query}: Props) {
   ];
 
   return (
-    <Feature features={['issue-list-trend-sort']}>
-      {({hasFeature: hasTrendSort}) => (
-        <CompactSelect
-          size="sm"
-          onChange={opt => onSelect(opt.value)}
-          options={getSortOptions(sortKeys, hasTrendSort)}
-          value={sortKey}
-          triggerProps={{
-            size: 'xs',
-            icon: <IconSort size="xs" />,
-          }}
-        />
-      )}
-    </Feature>
+    <CompactSelect
+      size="sm"
+      onChange={opt => onSelect(opt.value)}
+      options={sortKeys.map(key => ({
+        value: key,
+        label: getSortLabel(key),
+        details: getSortTooltip(key),
+      }))}
+      value={sortKey}
+      triggerProps={{
+        size: 'xs',
+        icon: <IconSort size="xs" />,
+      }}
+    />
   );
 }
 

+ 0 - 3
static/app/views/issueList/overview.tsx

@@ -327,9 +327,6 @@ class IssueListOverview extends Component<Props, State> {
     let currentPeriod: string;
     if (typeof this.props.location.query?.groupStatsPeriod === 'string') {
       currentPeriod = this.props.location.query.groupStatsPeriod;
-    } else if (this.getSort() === IssueSortOptions.TREND) {
-      // Default to the larger graph when sorting by relative change
-      currentPeriod = 'auto';
     } else {
       currentPeriod = DEFAULT_GRAPH_STATS_PERIOD;
     }

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

@@ -165,7 +165,6 @@ export enum IssueSortOptions {
   PRIORITY = 'priority',
   FREQ = 'freq',
   USER = 'user',
-  TREND = 'trend',
   INBOX = 'inbox',
 }
 
@@ -185,8 +184,6 @@ export function getSortLabel(key: string) {
       return t('Events');
     case IssueSortOptions.USER:
       return t('Users');
-    case IssueSortOptions.TREND:
-      return t('Relative Change');
     case IssueSortOptions.INBOX:
       return t('Date Added');
     case IssueSortOptions.DATE: