Browse Source

feat(browser-starfish): frontend project settings (#62131)

This PR complements the backend change here #62025, more work for #60482
This should be merged after

It adds to UI to enable/disable images from project settings.
Dominik Buszowiecki 1 year ago
parent
commit
6e420488e1

+ 6 - 0
static/app/views/settings/projectPerformance/projectPerformance.spec.tsx

@@ -75,6 +75,12 @@ describe('projectPerformance', function () {
       body: {},
       statusCode: 200,
     });
+    MockApiClient.addMockResponse({
+      url: '/projects/org-slug/project-slug/performance/configure/',
+      method: 'GET',
+      body: {},
+      statusCode: 200,
+    });
   });
 
   it('renders the fields', function () {

+ 32 - 3
static/app/views/settings/projectPerformance/projectPerformance.tsx

@@ -135,12 +135,22 @@ class ProjectPerformance extends DeprecatedAsyncView<Props, State> {
       ['project', `/projects/${organization.slug}/${projectId}/`],
     ];
 
-    const performanceIssuesEndpoint = [
+    const performanceIssuesEndpoint: ReturnType<
+      DeprecatedAsyncView['getEndpoints']
+    >[number] = [
       'performance_issue_settings',
       `/projects/${organization.slug}/${projectId}/performance-issues/configure/`,
-    ] as [string, string];
+    ];
+
+    const generalSettingsEndpoint: ReturnType<
+      DeprecatedAsyncView['getEndpoints']
+    >[number] = [
+      'general',
+      `/projects/${organization.slug}/${projectId}/performance/configure/`,
+    ];
 
     endpoints.push(performanceIssuesEndpoint);
+    endpoints.push(generalSettingsEndpoint);
 
     return endpoints;
   }
@@ -828,6 +838,25 @@ class ProjectPerformance extends DeprecatedAsyncView<Props, State> {
       <Fragment>
         <SettingsPageHeader title={t('Performance')} />
         <PermissionAlert project={project} />
+        <Feature features="organizations:starfish-browser-resource-module-image-view">
+          <Form
+            initialData={this.state.general}
+            saveOnBlur
+            apiEndpoint={`/projects/${organization.slug}/${project.slug}/performance/configure/`}
+          >
+            <JsonForm
+              fields={[
+                {
+                  name: 'enable_images',
+                  type: 'boolean',
+                  label: t('Images'),
+                  help: t('Enables images from real data to be displayed'),
+                },
+              ]}
+              title={t('General')}
+            />
+          </Form>
+        </Feature>
 
         <Form
           saveOnBlur
@@ -850,7 +879,7 @@ class ProjectPerformance extends DeprecatedAsyncView<Props, State> {
           <Access access={requiredScopes} project={project}>
             {({hasAccess}) => (
               <JsonForm
-                title={t('General')}
+                title={t('Threshold Settings')}
                 fields={this.formFields}
                 disabled={!hasAccess}
                 renderFooter={() => (