Skip to content

Commit

Permalink
feat(browser-starfish): frontend project settings (#62131)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
DominikB2014 authored Jan 9, 2024
1 parent 57107d8 commit 6e42048
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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
Expand All @@ -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={() => (
Expand Down

0 comments on commit 6e42048

Please sign in to comment.