diff options
author | Damien Urruty <damien.urruty@sonarsource.com> | 2024-11-19 16:22:37 +0100 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2024-11-20 20:02:47 +0000 |
commit | 76914764de8ac8599890ea257a30c2507e0479e4 (patch) | |
tree | 5ee14bef85219f77e056001b9dafdd708ef13735 /server | |
parent | 29de75089b79916fdb17837be37fe65175687b52 (diff) | |
download | sonarqube-76914764de8ac8599890ea257a30c2507e0479e4.tar.gz sonarqube-76914764de8ac8599890ea257a30c2507e0479e4.zip |
CODEFIX-204 Display the enablement on the Project Information page
Diffstat (limited to 'server')
3 files changed, 28 insertions, 0 deletions
diff --git a/server/sonar-web/src/main/js/apps/projectInformation/__tests__/ProjectInformationApp-it.tsx b/server/sonar-web/src/main/js/apps/projectInformation/__tests__/ProjectInformationApp-it.tsx index 0d7ba65ab3a..833f0a76838 100644 --- a/server/sonar-web/src/main/js/apps/projectInformation/__tests__/ProjectInformationApp-it.tsx +++ b/server/sonar-web/src/main/js/apps/projectInformation/__tests__/ProjectInformationApp-it.tsx @@ -164,6 +164,24 @@ it('should not display ai code assurence', async () => { expect(screen.queryByText('project.info.ai_code_assurance.title')).not.toBeInTheDocument(); }); +it('should display ai code fix section if enabled', async () => { + renderProjectInformationApp({ + isAiCodeFixEnabled: true, + }); + expect(await ui.projectPageTitle.find()).toBeInTheDocument(); + expect(screen.getByText('project.info.ai_code_fix.title')).toBeInTheDocument(); + expect(screen.getByText('project.info.ai_code_fix.message')).toBeInTheDocument(); +}); + +it('should not display ai code fix section if disabled', async () => { + renderProjectInformationApp({ + isAiCodeFixEnabled: false, + }); + expect(await ui.projectPageTitle.find()).toBeInTheDocument(); + expect(screen.queryByText('project.info.ai_code_fix.title')).not.toBeInTheDocument(); + expect(screen.queryByText('project.info.ai_code_fix.message')).not.toBeInTheDocument(); +}); + it('should not show field that is not configured', async () => { renderProjectInformationApp({ qualityGate: undefined, diff --git a/server/sonar-web/src/main/js/apps/projectInformation/about/AboutProject.tsx b/server/sonar-web/src/main/js/apps/projectInformation/about/AboutProject.tsx index cef354b5931..27dd155c0fb 100644 --- a/server/sonar-web/src/main/js/apps/projectInformation/about/AboutProject.tsx +++ b/server/sonar-web/src/main/js/apps/projectInformation/about/AboutProject.tsx @@ -95,6 +95,15 @@ export default function AboutProject(props: AboutProjectProps) { </ProjectInformationSection> )} + {component.isAiCodeFixEnabled === true && ( + <ProjectInformationSection> + <SubHeading>{translate('project.info.ai_code_fix.title')}</SubHeading> + <span> + <FormattedMessage id="project.info.ai_code_fix.message" /> + </span> + </ProjectInformationSection> + )} + <ProjectInformationSection> <MetaKey componentKey={component.key} qualifier={component.qualifier} /> </ProjectInformationSection> diff --git a/server/sonar-web/src/main/js/types/types.ts b/server/sonar-web/src/main/js/types/types.ts index 7192a7e8389..f0af608905f 100644 --- a/server/sonar-web/src/main/js/types/types.ts +++ b/server/sonar-web/src/main/js/types/types.ts @@ -78,6 +78,7 @@ export interface Component extends ComponentBase { canBrowseAllChildProjects?: boolean; configuration?: ComponentConfiguration; extensions?: Extension[]; + isAiCodeFixEnabled?: boolean; needIssueSync?: boolean; } |