Browse Source

chore(performance-detector-thresholds): Removing feature flag from front-end. (#58269)

Removed `organizations:project-performance-settings-admin` from the
frontend. It was set to true by default and I have ensured that we've
released to SH recently.

Corresponding BE pr: https://github.com/getsentry/sentry/pull/58270

---------

Co-authored-by: Abdullah Khan <abdullahkhan@PG9Y57YDXQ.local>
Abdkhan14 1 year ago
parent
commit
e523203841

+ 0 - 1
static/app/components/events/interfaces/performance/spanEvidence.spec.tsx

@@ -100,7 +100,6 @@ describe('spanEvidence', () => {
         },
         },
       ],
       ],
     });
     });
-    organization.features = ['project-performance-settings-admin'];
 
 
     render(
     render(
       <SpanEvidenceSection
       <SpanEvidenceSection

+ 1 - 3
static/app/components/events/interfaces/performance/spanEvidence.tsx

@@ -45,8 +45,6 @@ export function SpanEvidenceSection({event, organization, projectSlug}: Props) {
   const issueType = getIssueTypeFromOccurenceType(event.occurrence?.type);
   const issueType = getIssueTypeFromOccurenceType(event.occurrence?.type);
   const issueTitle = event.occurrence?.issueTitle;
   const issueTitle = event.occurrence?.issueTitle;
   const sanitizedIssueTitle = issueTitle && sanitizeQuerySelector(issueTitle);
   const sanitizedIssueTitle = issueTitle && sanitizeQuerySelector(issueTitle);
-  const hasConfigurableThresholds =
-    organization.features.includes('project-performance-settings-admin') && issueType;
 
 
   return (
   return (
     <EventDataSection
     <EventDataSection
@@ -56,7 +54,7 @@ export function SpanEvidenceSection({event, organization, projectSlug}: Props) {
         'Span Evidence identifies the root cause of this issue, found in other similar events within the same issue.'
         'Span Evidence identifies the root cause of this issue, found in other similar events within the same issue.'
       )}
       )}
       actions={
       actions={
-        hasConfigurableThresholds && (
+        issueType && (
           <LinkButton
           <LinkButton
             data-test-id="span-evidence-settings-btn"
             data-test-id="span-evidence-settings-btn"
             to={`/settings/projects/${projectSlug}/performance/?issueType=${issueType}#${sanitizedIssueTitle}`}
             to={`/settings/projects/${projectSlug}/performance/?issueType=${issueType}#${sanitizedIssueTitle}`}

+ 3 - 24
static/app/views/settings/projectPerformance/projectPerformance.spec.tsx

@@ -18,15 +18,11 @@ import ProjectPerformance, {
 
 
 describe('projectPerformance', function () {
 describe('projectPerformance', function () {
   const org = Organization({
   const org = Organization({
-    features: [
-      'performance-view',
-      'performance-issues-dev',
-      'project-performance-settings-admin',
-    ],
+    features: ['performance-view', 'performance-issues-dev'],
   });
   });
   const project = TestStubs.Project();
   const project = TestStubs.Project();
   const configUrl = '/projects/org-slug/project-slug/transaction-threshold/configure/';
   const configUrl = '/projects/org-slug/project-slug/transaction-threshold/configure/';
-  let getMock, postMock, deleteMock, performanceIssuesMock;
+  let getMock, postMock, deleteMock;
 
 
   const router = TestStubs.router();
   const router = TestStubs.router();
   const routerProps = {
   const routerProps = {
@@ -70,7 +66,7 @@ describe('projectPerformance', function () {
       body: {},
       body: {},
       statusCode: 200,
       statusCode: 200,
     });
     });
-    performanceIssuesMock = MockApiClient.addMockResponse({
+    MockApiClient.addMockResponse({
       url: '/projects/org-slug/project-slug/performance-issues/configure/',
       url: '/projects/org-slug/project-slug/performance-issues/configure/',
       method: 'GET',
       method: 'GET',
       body: {},
       body: {},
@@ -135,23 +131,6 @@ describe('projectPerformance', function () {
     expect(deleteMock).toHaveBeenCalled();
     expect(deleteMock).toHaveBeenCalled();
   });
   });
 
 
-  it('does not get performance issues settings without the feature flag', function () {
-    const orgWithoutPerfIssues = Organization({
-      features: ['performance-view', 'performance-issues-dev'],
-    });
-
-    render(
-      <ProjectPerformance
-        params={{projectId: project.slug}}
-        organization={orgWithoutPerfIssues}
-        project={project}
-        {...routerProps}
-      />
-    );
-
-    expect(performanceIssuesMock).not.toHaveBeenCalled();
-  });
-
   it('renders detector threshold configuration - admin ui', async function () {
   it('renders detector threshold configuration - admin ui', async function () {
     jest.spyOn(utils, 'isActiveSuperuser').mockReturnValue(true);
     jest.spyOn(utils, 'isActiveSuperuser').mockReturnValue(true);
     MockApiClient.addMockResponse({
     MockApiClient.addMockResponse({

+ 70 - 74
static/app/views/settings/projectPerformance/projectPerformance.tsx

@@ -134,14 +134,12 @@ class ProjectPerformance extends DeprecatedAsyncView<Props, State> {
       ['project', `/projects/${organization.slug}/${projectId}/`],
       ['project', `/projects/${organization.slug}/${projectId}/`],
     ];
     ];
 
 
-    if (organization.features.includes('project-performance-settings-admin')) {
-      const performanceIssuesEndpoint = [
-        'performance_issue_settings',
-        `/projects/${organization.slug}/${projectId}/performance-issues/configure/`,
-      ] as [string, string];
+    const performanceIssuesEndpoint = [
+      'performance_issue_settings',
+      `/projects/${organization.slug}/${projectId}/performance-issues/configure/`,
+    ] as [string, string];
 
 
-      endpoints.push(performanceIssuesEndpoint);
-    }
+    endpoints.push(performanceIssuesEndpoint);
 
 
     return endpoints;
     return endpoints;
   }
   }
@@ -924,81 +922,79 @@ class ProjectPerformance extends DeprecatedAsyncView<Props, State> {
               </Access>
               </Access>
             </Form>
             </Form>
           </Feature>
           </Feature>
-          <Feature features={['organizations:project-performance-settings-admin']}>
-            {isSuperUser && (
-              <Form
-                saveOnBlur
-                allowUndo
-                initialData={this.state.performance_issue_settings}
-                apiMethod="PUT"
-                onSubmitError={error => {
-                  if (error.status === 403) {
-                    addErrorMessage(
-                      t(
-                        'This action requires active super user access. Please re-authenticate to make changes.'
-                      )
-                    );
-                  }
-                }}
-                apiEndpoint={performanceIssuesEndpoint}
-              >
-                <JsonForm
-                  title={t(
-                    '### INTERNAL ONLY ### - Performance Issues Admin Detector Settings'
-                  )}
-                  fields={this.performanceIssueDetectorAdminFields}
-                  disabled={!isSuperUser}
-                />
-              </Form>
-            )}
+          {isSuperUser && (
             <Form
             <Form
+              saveOnBlur
               allowUndo
               allowUndo
               initialData={this.state.performance_issue_settings}
               initialData={this.state.performance_issue_settings}
               apiMethod="PUT"
               apiMethod="PUT"
-              apiEndpoint={performanceIssuesEndpoint}
-              saveOnBlur
-              onSubmitSuccess={(option: {[key: string]: number}) => {
-                const [threshold_key, threshold_value] = Object.entries(option)[0];
-
-                trackAnalytics(
-                  'performance_views.project_issue_detection_threshold_changed',
-                  {
-                    organization,
-                    project_slug: project.slug,
-                    threshold_key,
-                    threshold_value,
-                  }
-                );
+              onSubmitError={error => {
+                if (error.status === 403) {
+                  addErrorMessage(
+                    t(
+                      'This action requires active super user access. Please re-authenticate to make changes.'
+                    )
+                  );
+                }
               }}
               }}
+              apiEndpoint={performanceIssuesEndpoint}
             >
             >
-              <Access access={requiredScopes} project={project}>
-                {({hasAccess}) => (
-                  <div id={projectDetectorSettingsId}>
-                    <StyledPanelHeader>
-                      {t('Performance Issues - Detector Threshold Settings')}
-                    </StyledPanelHeader>
-                    <StyledJsonForm
-                      forms={this.project_owner_detector_settings(hasAccess)}
-                      collapsible
-                    />
-                    <StyledPanelFooter>
-                      <Actions>
-                        <Confirm
-                          message={t(
-                            'Are you sure you wish to reset all detector thresholds?'
-                          )}
-                          onConfirm={() => this.handleThresholdsReset()}
-                          disabled={!hasAccess || this.areAllConfigurationsDisabled}
-                        >
-                          <Button>{t('Reset All Thresholds')}</Button>
-                        </Confirm>
-                      </Actions>
-                    </StyledPanelFooter>
-                  </div>
+              <JsonForm
+                title={t(
+                  '### INTERNAL ONLY ### - Performance Issues Admin Detector Settings'
                 )}
                 )}
-              </Access>
+                fields={this.performanceIssueDetectorAdminFields}
+                disabled={!isSuperUser}
+              />
             </Form>
             </Form>
-          </Feature>
+          )}
+          <Form
+            allowUndo
+            initialData={this.state.performance_issue_settings}
+            apiMethod="PUT"
+            apiEndpoint={performanceIssuesEndpoint}
+            saveOnBlur
+            onSubmitSuccess={(option: {[key: string]: number}) => {
+              const [threshold_key, threshold_value] = Object.entries(option)[0];
+
+              trackAnalytics(
+                'performance_views.project_issue_detection_threshold_changed',
+                {
+                  organization,
+                  project_slug: project.slug,
+                  threshold_key,
+                  threshold_value,
+                }
+              );
+            }}
+          >
+            <Access access={requiredScopes} project={project}>
+              {({hasAccess}) => (
+                <div id={projectDetectorSettingsId}>
+                  <StyledPanelHeader>
+                    {t('Performance Issues - Detector Threshold Settings')}
+                  </StyledPanelHeader>
+                  <StyledJsonForm
+                    forms={this.project_owner_detector_settings(hasAccess)}
+                    collapsible
+                  />
+                  <StyledPanelFooter>
+                    <Actions>
+                      <Confirm
+                        message={t(
+                          'Are you sure you wish to reset all detector thresholds?'
+                        )}
+                        onConfirm={() => this.handleThresholdsReset()}
+                        disabled={!hasAccess || this.areAllConfigurationsDisabled}
+                      >
+                        <Button>{t('Reset All Thresholds')}</Button>
+                      </Confirm>
+                    </Actions>
+                  </StyledPanelFooter>
+                </div>
+              )}
+            </Access>
+          </Form>
         </Fragment>
         </Fragment>
       </Fragment>
       </Fragment>
     );
     );