Browse Source

ref(source-maps): Cleanup after association rework (#57462)

* Apply all connected open TODOs

Relates to https://github.com/getsentry/sentry/issues/50232
ArthurKnaus 1 year ago
parent
commit
b9a22c3ea4

+ 0 - 2
fixtures/js-stubs/sourceMapsDebugIDBundles.ts

@@ -16,8 +16,6 @@ export function SourceMapsDebugIDBundles(
           dist: ['android', 'iOS'],
         },
       ],
-      release: null,
-      dist: null,
       fileCount: 39,
       dateModified: '2023-03-10T08:25:10Z',
       date: '2023-03-08T09:53:09Z',

+ 0 - 2
fixtures/js-stubs/sourceMapsDebugIDBundlesArtifacts.ts

@@ -5,8 +5,6 @@ export function SourceMapsDebugIDBundlesArtifacts(
 ): DebugIdBundleArtifact {
   return {
     bundleId: '7227e105-744e-4066-8c69-3e5e344723fc',
-    release: null,
-    dist: null,
     associations: [
       {
         release: 'v2.0',

+ 0 - 8
static/app/types/sourceMaps.ts

@@ -8,18 +8,12 @@ export type DebugIdBundle = {
   bundleId: string;
   date: string;
   dateModified: string;
-  // TODO(Pri): Remove this type once fully transitioned to associations.
-  dist: string | null;
   fileCount: number;
-  // TODO(Pri): Remove this type once fully transitioned to associations.
-  release: string | null;
 };
 
 export type DebugIdBundleArtifact = {
   associations: DebugIdBundleAssociation[];
   bundleId: string;
-  // TODO(Pri): Remove this type once fully transitioned to associations.
-  dist: string | null;
   files: {
     debugId: string;
     filePath: string;
@@ -28,6 +22,4 @@ export type DebugIdBundleArtifact = {
     id: string;
     sourcemap: string | null;
   }[];
-  // TODO(Pri): Remove this type once fully transitioned to associations.
-  release: string | null;
 };

+ 0 - 59
static/app/views/settings/projectSourceMaps/debugIdBundlesTags.tsx

@@ -1,59 +0,0 @@
-import {Fragment} from 'react';
-import styled from '@emotion/styled';
-
-import Placeholder from 'sentry/components/placeholder';
-import Tag from 'sentry/components/tag';
-import {tct} from 'sentry/locale';
-import {space} from 'sentry/styles/space';
-
-type Props = {
-  dist?: string | null;
-  loading?: boolean;
-  release?: string | null;
-};
-
-export function DebugIdBundlesTags({dist, release, loading}: Props) {
-  return (
-    <Tags>
-      {loading ? (
-        <Fragment>
-          <StyledPlaceholder width="60px" height="20px" />
-          <StyledPlaceholder width="40px" height="20px" />
-        </Fragment>
-      ) : (
-        <Fragment>
-          {dist && (
-            <Tag
-              tooltipText={tct('Associated with distribution "[distribution]"', {
-                distribution: dist,
-              })}
-              type="info"
-            >
-              {dist}
-            </Tag>
-          )}
-          {release && (
-            <Tag
-              tooltipText={tct('Associated with release "[releaseName]"', {
-                releaseName: release,
-              })}
-              type="info"
-            >
-              {release}
-            </Tag>
-          )}
-        </Fragment>
-      )}
-    </Tags>
-  );
-}
-
-const Tags = styled('div')`
-  display: flex;
-  flex-wrap: wrap;
-  gap: ${space(0.5)};
-`;
-
-const StyledPlaceholder = styled(Placeholder)`
-  background-color: ${p => p.theme.background};
-`;

+ 4 - 8
static/app/views/settings/projectSourceMaps/projectSourceMaps.tsx

@@ -33,7 +33,6 @@ import {normalizeUrl} from 'sentry/utils/withDomainRequired';
 import SettingsPageHeader from 'sentry/views/settings/components/settingsPageHeader';
 import TextBlock from 'sentry/views/settings/components/text/textBlock';
 import {Associations} from 'sentry/views/settings/projectSourceMaps/associations';
-import {DebugIdBundlesTags} from 'sentry/views/settings/projectSourceMaps/debugIdBundlesTags';
 
 enum SortBy {
   ASC_ADDED = 'date_added',
@@ -445,13 +444,10 @@ export function ProjectSourceMaps({location, router, project}: Props) {
                   project.slug
                 }/source-maps/artifact-bundles/${encodeURIComponent(data.bundleId)}`}
                 idColumnDetails={
-                  // TODO(Pri): Move the loading to the component once fully transitioned to associations.
-                  !debugIdBundlesLoading &&
-                  (data.associations ? (
-                    <Associations associations={data.associations} />
-                  ) : (
-                    <DebugIdBundlesTags dist={data.dist} release={data.release} />
-                  ))
+                  <Associations
+                    associations={data.associations}
+                    loading={debugIdBundlesLoading}
+                  />
                 }
               />
             ))

+ 3 - 4
static/app/views/settings/projectSourceMaps/projectSourceMapsArtifacts.spec.tsx

@@ -259,10 +259,9 @@ describe('ProjectSourceMapsArtifacts', function () {
         await screen.findByText('There are no artifacts in this bundle.')
       ).toBeInTheDocument();
 
-      // TODO(Pri): Uncomment once fully transitioned to associations.
-      // expect(
-      //   screen.getByText('No releases associated with this bundle')
-      // ).toBeInTheDocument();
+      expect(
+        screen.getByText('No releases associated with this bundle')
+      ).toBeInTheDocument();
     });
   });
 });

+ 6 - 12
static/app/views/settings/projectSourceMaps/projectSourceMapsArtifacts.tsx

@@ -23,7 +23,6 @@ import useOrganization from 'sentry/utils/useOrganization';
 import {normalizeUrl} from 'sentry/utils/withDomainRequired';
 import SettingsPageHeader from 'sentry/views/settings/components/settingsPageHeader';
 import {Associations} from 'sentry/views/settings/projectSourceMaps/associations';
-import {DebugIdBundlesTags} from 'sentry/views/settings/projectSourceMaps/debugIdBundlesTags';
 
 enum DebugIdBundleArtifactType {
   INVALID = 0,
@@ -184,17 +183,12 @@ export function ProjectSourceMapsArtifacts({params, location, router, project}:
         subtitle={
           <VersionAndDetails>
             {params.bundleId}
-            {tabDebugIdBundlesActive &&
-              // TODO(Pri): Move the loading to the component once fully transitioned to associations.
-              !debugIdBundlesArtifactsLoading &&
-              (debugIdBundlesArtifactsData?.associations ? (
-                <Associations associations={debugIdBundlesArtifactsData?.associations} />
-              ) : (
-                <DebugIdBundlesTags
-                  dist={debugIdBundlesArtifactsData?.dist}
-                  release={debugIdBundlesArtifactsData?.release}
-                />
-              ))}
+            {tabDebugIdBundlesActive && (
+              <Associations
+                associations={debugIdBundlesArtifactsData?.associations}
+                loading={debugIdBundlesArtifactsLoading}
+              />
+            )}
           </VersionAndDetails>
         }
       />