Просмотр исходного кода

feat(codecov-integration): GA frontend for codecov-stacktrace-integration (#46416)

GA the codecov stacktrace integration. This enables the frontend for the
V1 feature set.

Backend changes in https://github.com/getsentry/sentry/pull/46414
V2 features to follow.
Snigdha Sharma 1 год назад
Родитель
Сommit
83653397fd

+ 0 - 1
static/app/components/events/interfaces/frame/context.tsx

@@ -99,7 +99,6 @@ const Context = ({
         defined(organization) &&
         defined(project) &&
         !!organization.codecovAccess &&
-        organization.features.includes('codecov-stacktrace-integration') &&
         isExpanded,
     }
   );

+ 0 - 2
static/app/components/events/interfaces/frame/stacktraceLink.spec.tsx

@@ -203,7 +203,6 @@ describe('StacktraceLink', function () {
   it('renders the codecov link', async function () {
     const organization = {
       ...org,
-      features: ['codecov-stacktrace-integration'],
       codecovAccess: true,
     };
     MockApiClient.addMockResponse({
@@ -239,7 +238,6 @@ describe('StacktraceLink', function () {
   it('renders the missing coverage warning', async function () {
     const organization = {
       ...org,
-      features: ['codecov-stacktrace-integration'],
       codecovAccess: true,
     };
     MockApiClient.addMockResponse({

+ 3 - 5
static/app/components/events/interfaces/frame/stacktraceLink.tsx

@@ -116,14 +116,12 @@ function shouldShowCodecovFeatures(
   organization: Organization,
   match: StacktraceLinkResult
 ) {
-  const enabled =
-    organization.features.includes('codecov-stacktrace-integration') &&
-    organization.codecovAccess;
-
   const codecovStatus = match.codecov?.status;
   const validStatus = codecovStatus && codecovStatus !== CodecovStatusCode.NO_INTEGRATION;
 
-  return enabled && validStatus && match.config?.provider.key === 'github';
+  return (
+    organization.codecovAccess && validStatus && match.config?.provider.key === 'github'
+  );
 }
 
 function shouldShowCodecovPrompt(

+ 1 - 4
static/app/views/settings/organizationGeneralSettings/index.spec.tsx

@@ -60,10 +60,7 @@ describe('OrganizationGeneralSettings', function () {
   });
 
   it('can enable "codecov access"', async function () {
-    defaultProps.organization.features.push(
-      'codecov-stacktrace-integration',
-      'codecov-integration'
-    );
+    defaultProps.organization.features.push('codecov-integration');
     organization.codecovAccess = false;
     render(<OrganizationGeneralSettings {...defaultProps} />);
     const mock = MockApiClient.addMockResponse({

+ 1 - 1
static/app/views/settings/organizationGeneralSettings/organizationSettingsForm.spec.jsx

@@ -143,7 +143,7 @@ describe('OrganizationSettingsForm', function () {
       {
         organization: {
           ...organization,
-          features: ['codecov-stacktrace-integration', 'codecov-integration'],
+          features: ['codecov-integration'],
         },
       }
     );

+ 43 - 45
static/app/views/settings/organizationGeneralSettings/organizationSettingsForm.tsx

@@ -57,52 +57,50 @@ class OrganizationSettingsForm extends AsyncComponent<Props, State> {
     };
 
     const forms = cloneDeep(organizationSettingsFields);
-    if (organization.features.includes('codecov-stacktrace-integration')) {
-      forms[0].fields = [
-        ...forms[0].fields,
-        {
-          name: 'codecovAccess',
-          type: 'boolean',
-          disabled: !organization.features.includes('codecov-integration'),
-          label: (
-            <PoweredByCodecov>
-              {t('Enable Code Coverage Insights')}{' '}
-              <Feature
-                hookName="feature-disabled:codecov-integration-setting"
-                renderDisabled={p => (
-                  <Hovercard
-                    body={
-                      <FeatureDisabled
-                        features={p.features}
-                        hideHelpToggle
-                        featureName={t('Codecov Coverage')}
-                      />
-                    }
-                  >
-                    <Tag role="status" icon={<IconLock isSolid />}>
-                      {t('disabled')}
-                    </Tag>
-                  </Hovercard>
-                )}
-                features={['organizations:codecov-integration']}
-              >
-                {() => null}
-              </Feature>
-            </PoweredByCodecov>
-          ),
-          formatMessageValue: (value: boolean) => {
-            const onOff = value ? t('on') : t('off');
-            return t('Codecov access was turned %s', onOff);
-          },
-          help: (
-            <PoweredByCodecov>
-              {t('powered by')} <IconCodecov /> Codecov{' '}
-              <HookCodecovSettingsLink organization={organization} />
-            </PoweredByCodecov>
-          ),
+    forms[0].fields = [
+      ...forms[0].fields,
+      {
+        name: 'codecovAccess',
+        type: 'boolean',
+        disabled: !organization.features.includes('codecov-integration'),
+        label: (
+          <PoweredByCodecov>
+            {t('Enable Code Coverage Insights')}{' '}
+            <Feature
+              hookName="feature-disabled:codecov-integration-setting"
+              renderDisabled={p => (
+                <Hovercard
+                  body={
+                    <FeatureDisabled
+                      features={p.features}
+                      hideHelpToggle
+                      featureName={t('Codecov Coverage')}
+                    />
+                  }
+                >
+                  <Tag role="status" icon={<IconLock isSolid />}>
+                    {t('disabled')}
+                  </Tag>
+                </Hovercard>
+              )}
+              features={['organizations:codecov-integration']}
+            >
+              {() => null}
+            </Feature>
+          </PoweredByCodecov>
+        ),
+        formatMessageValue: (value: boolean) => {
+          const onOff = value ? t('on') : t('off');
+          return t('Codecov access was turned %s', onOff);
         },
-      ];
-    }
+        help: (
+          <PoweredByCodecov>
+            {t('powered by')} <IconCodecov /> Codecov{' '}
+            <HookCodecovSettingsLink organization={organization} />
+          </PoweredByCodecov>
+        ),
+      },
+    ];
 
     return (
       <Form