Browse Source

ref(routes): Simplify stats routes (#66974)

Evan Purkhiser 1 year ago
parent
commit
d08ad76e35
1 changed files with 11 additions and 34 deletions
  1. 11 34
      static/app/routes.tsx

+ 11 - 34
static/app/routes.tsx

@@ -1455,54 +1455,31 @@ function buildRoutes() {
     />
     />
   );
   );
 
 
-  const statsChildRoutes = ({forCustomerDomain}: {forCustomerDomain: boolean}) => {
-    return (
-      <Fragment>
+  const statsRoutes = (
+    <Fragment>
+      <Route path="/stats/" withOrgPath>
         <IndexRoute component={make(() => import('sentry/views/organizationStats'))} />
         <IndexRoute component={make(() => import('sentry/views/organizationStats'))} />
         <Route
         <Route
-          path="issues/"
           component={make(() => import('sentry/views/organizationStats/teamInsights'))}
           component={make(() => import('sentry/views/organizationStats/teamInsights'))}
         >
         >
-          <IndexRoute
+          <Route
+            path="issues/"
             component={make(
             component={make(
               () => import('sentry/views/organizationStats/teamInsights/issues')
               () => import('sentry/views/organizationStats/teamInsights/issues')
             )}
             )}
           />
           />
-        </Route>
-        <Route
-          path="health/"
-          component={make(() => import('sentry/views/organizationStats/teamInsights'))}
-        >
-          <IndexRoute
+          <Route
+            path="health/"
             component={make(
             component={make(
               () => import('sentry/views/organizationStats/teamInsights/health')
               () => import('sentry/views/organizationStats/teamInsights/health')
             )}
             )}
           />
           />
         </Route>
         </Route>
-        {forCustomerDomain ? null : (
-          <Redirect from="team/" to="/organizations/:orgId/stats/issues/" />
-        )}
-      </Fragment>
-    );
-  };
-  const statsRoutes = (
-    <Fragment>
-      {USING_CUSTOMER_DOMAIN && (
-        <Route
-          path="/stats/"
-          component={withDomainRequired(NoOp)}
-          key="orgless-stats-route"
-        >
-          {statsChildRoutes({forCustomerDomain: true})}
-        </Route>
-      )}
-      <Route
-        path="/organizations/:orgId/stats/"
-        component={withDomainRedirect(NoOp)}
-        key="org-stats"
-      >
-        {statsChildRoutes({forCustomerDomain: false})}
       </Route>
       </Route>
+      <Redirect
+        from="/organizations/:orgId/stats/team/"
+        to="/organizations/:orgId/stats/issues/"
+      />
     </Fragment>
     </Fragment>
   );
   );