]> source.dussan.org Git - sonarqube.git/commitdiff
CODEFIX-204 Display the enablement on the Project Information page
authorDamien Urruty <damien.urruty@sonarsource.com>
Tue, 19 Nov 2024 15:22:37 +0000 (16:22 +0100)
committersonartech <sonartech@sonarsource.com>
Wed, 20 Nov 2024 20:02:47 +0000 (20:02 +0000)
server/sonar-web/src/main/js/apps/projectInformation/__tests__/ProjectInformationApp-it.tsx
server/sonar-web/src/main/js/apps/projectInformation/about/AboutProject.tsx
server/sonar-web/src/main/js/types/types.ts
sonar-core/src/main/resources/org/sonar/l10n/core.properties

index 0d7ba65ab3a9c01582efb7c092ef07d07d4e8121..833f0a76838331feb3cfaa9e060f837c3137d958 100644 (file)
@@ -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,
index cef354b5931141770167ad3725b6541540ec3111..27dd155c0fbf86134ee264ad8b8c2e340b0baa73 100644 (file)
@@ -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>
index 7192a7e83894c2d939f136c4497df2cd64ad6926..f0af608905fcd9fd362a35f4348e689b139f76fa 100644 (file)
@@ -78,6 +78,7 @@ export interface Component extends ComponentBase {
   canBrowseAllChildProjects?: boolean;
   configuration?: ComponentConfiguration;
   extensions?: Extension[];
+  isAiCodeFixEnabled?: boolean;
   needIssueSync?: boolean;
 }
 
index e19834083c22758bf2e5622472e3b104f470f688..94f23f8c2c50fe37fd1957c2addfa8a86a9c9e00 100644 (file)
@@ -2284,6 +2284,8 @@ overview.project_key.tooltip.TRK=Your project key is a unique identifier for you
 overview.project_key.tooltip.APP=Your application key is a unique identifier for your application.
 project.info.ai_code_assurance.title=AI Code Assurance
 project.info.quality_gate.ai_code_assurance.description=This project contains AI-generated code. It must use Sonar way Quality Gate to benefit from Sonar’s AI Code Assurance.
+project.info.ai_code_fix.title=AI CodeFix
+project.info.ai_code_fix.message=AI CodeFix is enabled for this project.
 
 
 #------------------------------------------------------------------------------