Browse Source

ref(ui): Restructure releases codebase (#29411)

Matej Minar 3 years ago
parent
commit
182759eddc

+ 6 - 2
static/app/routes.tsx

@@ -1108,12 +1108,16 @@ function buildRoutes() {
         />
         <Route
           path="commits/"
-          componentPromise={() => import('app/views/releases/detail/commits')}
+          componentPromise={() =>
+            import('app/views/releases/detail/commitsAndFiles/commits')
+          }
           component={SafeLazyLoad}
         />
         <Route
           path="files-changed/"
-          componentPromise={() => import('app/views/releases/detail/filesChanged')}
+          componentPromise={() =>
+            import('app/views/releases/detail/commitsAndFiles/filesChanged')
+          }
           component={SafeLazyLoad}
         />
         <Redirect from="new-events/" to="/organizations/:orgId/releases/:release/" />

+ 17 - 1
static/app/utils/sessions.tsx

@@ -9,13 +9,17 @@ import {
   SIXTY_DAYS,
   THIRTY_DAYS,
 } from 'app/components/charts/utils';
+import {IconCheckmark, IconFire, IconWarning} from 'app/icons';
 import {SessionApiResponse, SessionField, SessionStatus} from 'app/types';
 import {SeriesDataUnit} from 'app/types/echarts';
 import {defined, percent} from 'app/utils';
-import {Theme} from 'app/utils/theme';
+import {IconSize, Theme} from 'app/utils/theme';
 import {getCrashFreePercent, getSessionStatusPercent} from 'app/views/releases/utils';
 import {sessionTerm} from 'app/views/releases/utils/sessionTerm';
 
+const CRASH_FREE_DANGER_THRESHOLD = 98;
+const CRASH_FREE_WARNING_THRESHOLD = 99.5;
+
 export function getCount(groups: SessionApiResponse['groups'] = [], field: SessionField) {
   return groups.reduce((acc, group) => acc + group.totals[field], 0);
 }
@@ -343,3 +347,15 @@ export function filterSessionsInTimeWindow(
     groups,
   };
 }
+
+export function getCrashFreeIcon(crashFreePercent: number, iconSize: IconSize = 'sm') {
+  if (crashFreePercent < CRASH_FREE_DANGER_THRESHOLD) {
+    return <IconFire color="red300" size={iconSize} />;
+  }
+
+  if (crashFreePercent < CRASH_FREE_WARNING_THRESHOLD) {
+    return <IconWarning color="yellow300" size={iconSize} />;
+  }
+
+  return <IconCheckmark isCircled color="green300" size={iconSize} />;
+}

+ 1 - 1
static/app/views/projectDetail/missingFeatureButtons/missingReleasesButtons.tsx

@@ -6,7 +6,7 @@ import FeatureTourModal from 'app/components/modals/featureTourModal';
 import {t} from 'app/locale';
 import {Organization} from 'app/types';
 import {trackAnalyticsEvent} from 'app/utils/analytics';
-import {RELEASES_TOUR_STEPS} from 'app/views/releases/list/releasePromo';
+import {RELEASES_TOUR_STEPS} from 'app/views/releases/list/releasesPromo';
 
 const DOCS_URL = 'https://docs.sentry.io/product/releases/';
 const DOCS_HEALTH_URL = 'https://docs.sentry.io/product/releases/health/';

+ 1 - 1
static/app/views/projectDetail/projectLatestReleases.tsx

@@ -18,7 +18,7 @@ import overflowEllipsis from 'app/styles/overflowEllipsis';
 import space from 'app/styles/space';
 import {Organization, Release} from 'app/types';
 import {analytics} from 'app/utils/analytics';
-import {RELEASES_TOUR_STEPS} from 'app/views/releases/list/releasePromo';
+import {RELEASES_TOUR_STEPS} from 'app/views/releases/list/releasesPromo';
 
 import MissingReleasesButtons from './missingFeatureButtons/missingReleasesButtons';
 import {SectionHeadingLink, SectionHeadingWrapper, SidebarSection} from './styles';

+ 2 - 1
static/app/views/releases/detail/commits.tsx → static/app/views/releases/detail/commitsAndFiles/commits.tsx

@@ -13,9 +13,10 @@ import {formatVersion} from 'app/utils/formatters';
 import routeTitleGen from 'app/utils/routeTitle';
 import AsyncView from 'app/views/asyncView';
 
+import {getCommitsByRepository, getQuery, getReposToRender} from '../utils';
+
 import EmptyState from './emptyState';
 import RepositorySwitcher from './repositorySwitcher';
-import {getCommitsByRepository, getQuery, getReposToRender} from './utils';
 import withReleaseRepos from './withReleaseRepos';
 
 type Props = RouteComponentProps<{orgId: string; release: string}, {}> & {

+ 0 - 0
static/app/views/releases/detail/emptyState.tsx → static/app/views/releases/detail/commitsAndFiles/emptyState.tsx


+ 2 - 1
static/app/views/releases/detail/filesChanged.tsx → static/app/views/releases/detail/commitsAndFiles/filesChanged.tsx

@@ -14,9 +14,10 @@ import {formatVersion} from 'app/utils/formatters';
 import routeTitleGen from 'app/utils/routeTitle';
 import AsyncView from 'app/views/asyncView';
 
+import {getFilesByRepository, getQuery, getReposToRender} from '../utils';
+
 import EmptyState from './emptyState';
 import RepositorySwitcher from './repositorySwitcher';
-import {getFilesByRepository, getQuery, getReposToRender} from './utils';
 import withReleaseRepos from './withReleaseRepos';
 
 type Props = RouteComponentProps<{orgId: string; release: string}, {}> & {

+ 0 - 0
static/app/views/releases/detail/repositorySwitcher.tsx → static/app/views/releases/detail/commitsAndFiles/repositorySwitcher.tsx


+ 1 - 1
static/app/views/releases/detail/withReleaseRepos.tsx → static/app/views/releases/detail/commitsAndFiles/withReleaseRepos.tsx

@@ -17,7 +17,7 @@ import withOrganization from 'app/utils/withOrganization';
 import withRepositories from 'app/utils/withRepositories';
 import EmptyMessage from 'app/views/settings/components/emptyMessage';
 
-import {ReleaseContext} from '.';
+import {ReleaseContext} from '..';
 
 // These props are required when using this HoC
 type DependentProps = RouteComponentProps<{orgId: string; release: string}, {}>;

+ 1 - 1
static/app/views/releases/detail/releaseActions.tsx → static/app/views/releases/detail/header/releaseActions.tsx

@@ -21,7 +21,7 @@ import {Organization, Release, ReleaseMeta} from 'app/types';
 import {trackAnalyticsEvent} from 'app/utils/analytics';
 import {formatVersion} from 'app/utils/formatters';
 
-import {isReleaseArchived} from '../utils';
+import {isReleaseArchived} from '../../utils';
 
 type Props = {
   location: Location;

Some files were not shown because too many files changed in this diff