From: Grégoire Aubert Date: Fri, 3 Aug 2018 10:33:18 +0000 (+0200) Subject: SONAR-11038 Add Configure Analysis button in projects page X-Git-Tag: 7.5~615 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=e01158776c6dddffa84ffaf5addc14c3b296cb8e;p=sonarqube.git SONAR-11038 Add Configure Analysis button in projects page --- diff --git a/server/sonar-web/src/main/js/apps/projects/components/ProjectCardLeak.tsx b/server/sonar-web/src/main/js/apps/projects/components/ProjectCardLeak.tsx index dd0670cb55f..bfade459220 100644 --- a/server/sonar-web/src/main/js/apps/projects/components/ProjectCardLeak.tsx +++ b/server/sonar-web/src/main/js/apps/projects/components/ProjectCardLeak.tsx @@ -28,8 +28,9 @@ import TagsList from '../../../components/tags/TagsList'; import PrivacyBadgeContainer from '../../../components/common/PrivacyBadgeContainer'; import { translate, translateWithParameters } from '../../../helpers/l10n'; import { Project } from '../types'; -import { Organization } from '../../../app/types'; import { formatDuration } from '../utils'; +import { Organization } from '../../../app/types'; +import { getProjectUrl } from '../../../helpers/urls'; interface Props { height: number; @@ -97,10 +98,17 @@ export default function ProjectCardLeak({ height, organization, project }: Props ) : (
-
- {project.analysisDate - ? translate('projects.no_new_code_period') - : translate('projects.not_analyzed')} +
+ + {project.analysisDate + ? translate('projects.no_new_code_period') + : translate('projects.not_analyzed')} + + {!project.analysisDate && ( + + {translate('projects.configure_analysis')} + + )}
)} diff --git a/server/sonar-web/src/main/js/apps/projects/components/ProjectCardOverall.tsx b/server/sonar-web/src/main/js/apps/projects/components/ProjectCardOverall.tsx index 859572fb80a..264ef83813c 100644 --- a/server/sonar-web/src/main/js/apps/projects/components/ProjectCardOverall.tsx +++ b/server/sonar-web/src/main/js/apps/projects/components/ProjectCardOverall.tsx @@ -29,6 +29,7 @@ import PrivacyBadgeContainer from '../../../components/common/PrivacyBadgeContai import { translate, translateWithParameters } from '../../../helpers/l10n'; import { Project } from '../types'; import { Organization } from '../../../app/types'; +import { getProjectUrl } from '../../../helpers/urls'; interface Props { height: number; @@ -57,7 +58,7 @@ export default function ProjectCardOverall({ height, organization, project }: Pr {!organization && ( )} - {project.name} + {project.name} {project.analysisDate && }
@@ -90,7 +91,12 @@ export default function ProjectCardOverall({ height, organization, project }: Pr
) : (
-
{translate('projects.not_analyzed')}
+
+ {translate('projects.not_analyzed')} + + {translate('projects.configure_analysis')} + +
)}
diff --git a/server/sonar-web/src/main/js/apps/projects/components/__tests__/ProjectCardLeak-test.tsx b/server/sonar-web/src/main/js/apps/projects/components/__tests__/ProjectCardLeak-test.tsx index 5a83961cca1..b83840aedde 100644 --- a/server/sonar-web/src/main/js/apps/projects/components/__tests__/ProjectCardLeak-test.tsx +++ b/server/sonar-web/src/main/js/apps/projects/components/__tests__/ProjectCardLeak-test.tsx @@ -76,3 +76,15 @@ it('should display the leak measures and quality gate', () => { shallow() ).toMatchSnapshot(); }); + +it('should display not analyzed yet', () => { + expect( + shallow( + + ) + ).toMatchSnapshot(); +}); diff --git a/server/sonar-web/src/main/js/apps/projects/components/__tests__/ProjectCardOverall-test.tsx b/server/sonar-web/src/main/js/apps/projects/components/__tests__/ProjectCardOverall-test.tsx index 4ed5e6753ab..f0c2736bde7 100644 --- a/server/sonar-web/src/main/js/apps/projects/components/__tests__/ProjectCardOverall-test.tsx +++ b/server/sonar-web/src/main/js/apps/projects/components/__tests__/ProjectCardOverall-test.tsx @@ -90,3 +90,15 @@ it('should display the overall measures and quality gate', () => { shallow() ).toMatchSnapshot(); }); + +it('should display not analyzed yet', () => { + expect( + shallow( + + ) + ).toMatchSnapshot(); +}); diff --git a/server/sonar-web/src/main/js/apps/projects/components/__tests__/__snapshots__/ProjectCardLeak-test.tsx.snap b/server/sonar-web/src/main/js/apps/projects/components/__tests__/__snapshots__/ProjectCardLeak-test.tsx.snap index bc672cd63b9..d3204d97486 100644 --- a/server/sonar-web/src/main/js/apps/projects/components/__tests__/__snapshots__/ProjectCardLeak-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/projects/components/__tests__/__snapshots__/ProjectCardLeak-test.tsx.snap @@ -1,5 +1,101 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`should display not analyzed yet 1`] = ` +
+
+
+

+ + + Foo + +

+
+ +
+
+
+
+
+ + projects.not_analyzed + + + projects.configure_analysis + +
+
+
+`; + exports[`should display the leak measures and quality gate 1`] = `
+
+
+

+ + + Foo + +

+
+ +
+
+
+
+
+ + projects.not_analyzed + + + projects.configure_analysis + +
+
+
+`; + exports[`should display the overall measures and quality gate 1`] = `