Browse Source

ref(merged-issues): Remove grouping related code (#26733)

Priscila Oliveira 3 years ago
parent
commit
40cb4f04c4

+ 0 - 1
static/app/actions/groupingActions.tsx

@@ -7,7 +7,6 @@ const GroupingActions = Reflux.createActions([
   'toggleUnmerge',
   'toggleMerge',
   'unmerge',
-  'split',
   'merge',
   'toggleCollapseFingerprint',
   'toggleCollapseFingerprints',

+ 9 - 55
static/app/stores/groupingStore.tsx

@@ -60,24 +60,24 @@ type ApiFingerprint = {
   childLabel?: string;
 };
 
+type ChildFingerprint = {
+  childId: string;
+  childLabel?: string;
+  eventCount?: number;
+  lastSeen?: string;
+  latestEvent?: Event;
+};
+
 export type Fingerprint = {
   id: string;
   latestEvent: Event;
   eventCount: number;
+  children: Array<ChildFingerprint>;
   state?: string;
   lastSeen?: string;
   parentId?: string;
   label?: string;
   parentLabel?: string;
-  children: Array<ChildFingerprint>;
-};
-
-export type ChildFingerprint = {
-  childId: string;
-  childLabel?: string;
-  eventCount?: number;
-  lastSeen?: string;
-  latestEvent?: Event;
 };
 
 type ResponseProcessors = {
@@ -135,12 +135,6 @@ type GroupingStoreInterface = Reflux.StoreDefinition & {
     successMessage?: string;
     errorMessage?: string;
   }) => void;
-  onSplit: (props: {
-    groupId: Group['id'];
-    loadingMessage?: string;
-    successMessage?: string;
-    errorMessage?: string;
-  }) => void;
   onMerge: (props: {
     params?: {
       orgId: Organization['id'];
@@ -497,46 +491,6 @@ const storeConfig: Reflux.StoreDefinition & Internals & GroupingStoreInterface =
     });
   },
 
-  onSplit({groupId, loadingMessage, successMessage, errorMessage}) {
-    const ids = Array.from(this.unmergeList.keys()) as Array<string>;
-
-    return new Promise(resolve => {
-      this.unmergeDisabled = true;
-      this.setStateForId(this.unmergeState, ids, {
-        checked: false,
-        busy: true,
-      });
-      this.triggerUnmergeState();
-      addLoadingMessage(loadingMessage);
-      this.api.request(`/issues/${groupId}/hashes/split/`, {
-        method: 'PUT',
-        query: {
-          id: ids,
-        },
-        success: () => {
-          addSuccessMessage(successMessage);
-
-          this.setStateForId(this.unmergeState, ids, {
-            checked: false,
-            busy: true,
-          });
-          this.unmergeList.clear();
-        },
-        error: () => {
-          addErrorMessage(errorMessage);
-          this.setStateForId(this.unmergeState, ids, {
-            checked: true,
-            busy: false,
-          });
-        },
-        complete: () => {
-          this.unmergeDisabled = false;
-          resolve(this.triggerUnmergeState());
-        },
-      });
-    });
-  },
-
   // For cross-project views, we need to pass projectId instead of
   // depending on router params (since we will only have orgId in that case)
   onMerge({params, query, projectId}) {

+ 1 - 18
static/app/views/organizationGroupDetails/groupMerged/index.tsx

@@ -75,16 +75,9 @@ class GroupMergedView extends Component<Props, State> {
   listener = GroupingStore.listen(this.onGroupingChange, undefined);
 
   getEndpoint() {
-    const {params, organization, location} = this.props;
+    const {params, location} = this.props;
     const {groupId} = params;
 
-    const hasGroupingTreeFeature = organization?.features?.includes('grouping-tree-ui');
-
-    if (hasGroupingTreeFeature) {
-      // TODO(markus): limits
-      return `/issues/${groupId}/hashes/split/`;
-    }
-
     const queryParams = {
       ...location.query,
       limit: 50,
@@ -113,15 +106,6 @@ class GroupMergedView extends Component<Props, State> {
     });
   };
 
-  handleSplit = () => {
-    GroupingActions.split({
-      groupId: this.props.params.groupId,
-      loadingMessage: t('Splitting fingerprints\u2026'),
-      successMessage: t('Fingerprints successfully queued for splitting.'),
-      errorMessage: t('Unable to queue fingerprints for splitting.'),
-    });
-  };
-
   render() {
     const {project, params} = this.props;
     const {groupId} = params;
@@ -152,7 +136,6 @@ class GroupMergedView extends Component<Props, State> {
             pageLinks={mergedLinks}
             groupId={groupId}
             onUnmerge={this.handleUnmerge}
-            onSplit={this.handleSplit}
             onToggleCollapse={GroupingActions.toggleCollapseFingerprints}
           />
         )}

+ 1 - 31
static/app/views/organizationGroupDetails/groupMerged/mergedItem.tsx

@@ -4,8 +4,6 @@ import styled from '@emotion/styled';
 import GroupingActions from 'app/actions/groupingActions';
 import Checkbox from 'app/components/checkbox';
 import EventOrGroupHeader from 'app/components/eventOrGroupHeader';
-import List from 'app/components/list';
-import ListItem from 'app/components/list/listItem';
 import Tooltip from 'app/components/tooltip';
 import {IconChevron} from 'app/icons';
 import GroupingStore, {Fingerprint} from 'app/stores/groupingStore';
@@ -96,7 +94,7 @@ class MergedItem extends React.Component<Props, State> {
 
   render() {
     const {fingerprint, organization} = this.props;
-    const {latestEvent, id, label, children} = fingerprint;
+    const {latestEvent, id, label} = fingerprint;
     const {collapsed, busy, checked} = this.state;
     const checkboxDisabled = busy;
 
@@ -137,28 +135,6 @@ class MergedItem extends React.Component<Props, State> {
                 />
               </EventDetails>
             )}
-
-            {!!children?.length && (
-              <ChildGroup>
-                {children.map(({childId, childLabel, latestEvent: childLatestEvent}) => (
-                  <ListItem key={childId}>
-                    <FingerprintLabel htmlFor={childId}>
-                      {this.renderFingerprint(childId, childLabel)}
-                    </FingerprintLabel>
-                    {childLatestEvent && (
-                      <EventDetails className="event-details">
-                        <EventOrGroupHeader
-                          data={childLatestEvent}
-                          organization={organization}
-                          hideIcons
-                          hideLevel
-                        />
-                      </EventDetails>
-                    )}
-                  </ListItem>
-                ))}
-              </ChildGroup>
-            )}
           </MergedEventList>
         )}
       </MergedGroup>
@@ -228,10 +204,4 @@ const EventDetails = styled('div')`
   }
 `;
 
-const ChildGroup = styled(List)`
-  list-style: none;
-  padding: ${space(0.5)} 0 0 ${space(4)};
-  border-top: 1px solid ${p => p.theme.innerBorder};
-`;
-
 export default MergedItem;

+ 0 - 3
static/app/views/organizationGroupDetails/groupMerged/mergedList.tsx

@@ -17,7 +17,6 @@ type Props = {
    * From GroupMergedView -> handleUnmerge
    */
   onUnmerge: () => void;
-  onSplit: () => void;
   /*
    * From GroupingActions.toggleCollapseFingerprints
    */
@@ -34,7 +33,6 @@ function MergedList({
   pageLinks,
   onToggleCollapse,
   onUnmerge,
-  onSplit,
   organization,
   groupId,
   project,
@@ -65,7 +63,6 @@ function MergedList({
         <MergedToolbar
           onToggleCollapse={onToggleCollapse}
           onUnmerge={onUnmerge}
-          onSplit={onSplit}
           orgId={organization.slug}
           project={project}
           groupId={groupId}

+ 3 - 22
static/app/views/organizationGroupDetails/groupMerged/mergedToolbar.tsx

@@ -10,15 +10,12 @@ import {t, tct} from 'app/locale';
 import GroupingStore from 'app/stores/groupingStore';
 import space from 'app/styles/space';
 import {Group, Organization, Project} from 'app/types';
-import withOrganization from 'app/utils/withOrganization';
 
 type Props = {
-  organization?: Organization;
   orgId: Organization['slug'];
   project: Project;
   groupId: Group['id'];
   onUnmerge: () => void;
-  onSplit: () => void;
   onToggleCollapse: () => void;
 };
 
@@ -94,8 +91,8 @@ class MergedToolbar extends React.Component<Props, State> {
   };
 
   render() {
-    const {onUnmerge, onSplit, onToggleCollapse, organization} = this.props;
-    const hasGroupingTreeFeature = organization?.features?.includes('grouping-tree-ui');
+    const {onUnmerge, onToggleCollapse} = this.props;
+
     const {
       unmergeList,
       unmergeLastCollapsed,
@@ -122,22 +119,6 @@ class MergedToolbar extends React.Component<Props, State> {
             </Button>
           </Confirm>
 
-          {hasGroupingTreeFeature && (
-            <Confirm
-              onConfirm={onSplit}
-              message={t(
-                'These events will be grouped into a new issue by more specific criteria (for instance more frames). Are you sure you want to split them out of the existing issue?'
-              )}
-            >
-              <Button
-                size="small"
-                title={tct('Splitting out [unmergeCount] events', {unmergeCount})}
-              >
-                {t('Split')} ({unmergeCount || 0})
-              </Button>
-            </Confirm>
-          )}
-
           <CompareButton
             size="small"
             disabled={!enableFingerprintCompare}
@@ -154,7 +135,7 @@ class MergedToolbar extends React.Component<Props, State> {
   }
 }
 
-export default withOrganization(MergedToolbar);
+export default MergedToolbar;
 
 const CompareButton = styled(Button)`
   margin-left: ${space(1)};