aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGrégoire Aubert <gregoire.aubert@sonarsource.com>2017-05-30 15:18:37 +0200
committerGrégoire Aubert <gregoire.aubert@sonarsource.com>2017-06-09 08:26:48 +0200
commit359a19c0ba3934c912c1429900a39585e3503882 (patch)
treeb60ceaa601486ad05d48f32506d3ac0796b51289
parent36a4866a99ec0f608f1af6a8897f9769a24f62c8 (diff)
downloadsonarqube-359a19c0ba3934c912c1429900a39585e3503882.tar.gz
sonarqube-359a19c0ba3934c912c1429900a39585e3503882.zip
SONAR-9254 Add last analysis on overall projects page
-rw-r--r--server/sonar-web/src/main/js/apps/projects/components/ProjectCard.js13
-rw-r--r--server/sonar-web/src/main/js/apps/projects/components/__tests__/ProjectCard-test.js7
-rw-r--r--server/sonar-web/src/main/js/apps/projects/components/__tests__/__snapshots__/ProjectCard-test.js.snap9
-rw-r--r--server/sonar-web/src/main/js/apps/projects/styles.css9
4 files changed, 27 insertions, 11 deletions
diff --git a/server/sonar-web/src/main/js/apps/projects/components/ProjectCard.js b/server/sonar-web/src/main/js/apps/projects/components/ProjectCard.js
index b4f3296f382..94c65bd4a6f 100644
--- a/server/sonar-web/src/main/js/apps/projects/components/ProjectCard.js
+++ b/server/sonar-web/src/main/js/apps/projects/components/ProjectCard.js
@@ -93,10 +93,10 @@ export default function ProjectCard({ measures, organization, project, type }: P
{isPrivate && <PrivateBadge className="spacer-left" tooltipPlacement="left" />}
{hasTags && <TagsList tags={project.tags} customClass="spacer-left" />}
</div>
- {isLeakView &&
- isProjectAnalyzed &&
+ {isProjectAnalyzed &&
<div className="project-card-dates note text-right pull-right">
- {hasLeakPeriodStart &&
+ {isLeakView &&
+ hasLeakPeriodStart &&
<span>
{translateWithParameters(
'projects.leak_period_x',
@@ -115,9 +115,10 @@ export default function ProjectCard({ measures, organization, project, type }: P
{isProjectAnalyzed
? <div className="boxed-group-inner">
- {areProjectMeasuresLoaded && isLeakView
- ? <ProjectCardLeakMeasures measures={measures} />
- : <ProjectCardOverallMeasures measures={measures} />}
+ {areProjectMeasuresLoaded &&
+ (isLeakView
+ ? <ProjectCardLeakMeasures measures={measures} />
+ : <ProjectCardOverallMeasures measures={measures} />)}
</div>
: <div className="boxed-group-inner">
<div className="note project-card-not-analyzed">
diff --git a/server/sonar-web/src/main/js/apps/projects/components/__tests__/ProjectCard-test.js b/server/sonar-web/src/main/js/apps/projects/components/__tests__/ProjectCard-test.js
index fca2a5926a9..a5e143fb5f0 100644
--- a/server/sonar-web/src/main/js/apps/projects/components/__tests__/ProjectCard-test.js
+++ b/server/sonar-web/src/main/js/apps/projects/components/__tests__/ProjectCard-test.js
@@ -41,9 +41,14 @@ jest.mock('moment', () => () => ({
}));
describe('overall status project card', () => {
- it('should never display analysis date', () => {
+ it('should display analysis date (and not leak period) when defined', () => {
expect(
shallow(<ProjectCard measures={{}} project={PROJECT} />).find('.project-card-dates').exists()
+ ).toBeTruthy();
+ expect(
+ shallow(<ProjectCard measures={{}} project={{ ...PROJECT, analysisDate: undefined }} />)
+ .find('.project-card-dates')
+ .exists()
).toBeFalsy();
});
diff --git a/server/sonar-web/src/main/js/apps/projects/components/__tests__/__snapshots__/ProjectCard-test.js.snap b/server/sonar-web/src/main/js/apps/projects/components/__tests__/__snapshots__/ProjectCard-test.js.snap
index 19805eb328a..322b86b25af 100644
--- a/server/sonar-web/src/main/js/apps/projects/components/__tests__/__snapshots__/ProjectCard-test.js.snap
+++ b/server/sonar-web/src/main/js/apps/projects/components/__tests__/__snapshots__/ProjectCard-test.js.snap
@@ -94,6 +94,15 @@ exports[`overall status project card should display the overall measures and qua
<div
className="pull-right text-right"
/>
+ <div
+ className="project-card-dates note text-right pull-right"
+ >
+ <span
+ className="big-spacer-left"
+ >
+ projects.last_analysis_on_x.March 1, 2017 9:36 AM
+ </span>
+ </div>
</div>
<div
className="boxed-group-inner"
diff --git a/server/sonar-web/src/main/js/apps/projects/styles.css b/server/sonar-web/src/main/js/apps/projects/styles.css
index afe6b79b614..5bb422126c2 100644
--- a/server/sonar-web/src/main/js/apps/projects/styles.css
+++ b/server/sonar-web/src/main/js/apps/projects/styles.css
@@ -83,6 +83,7 @@
}
.project-card-measures {
+ padding-top: 8px;
margin: 0 -15px;
}
@@ -101,7 +102,7 @@
}
.project-card-leak-measures .project-card-measure {
- width: 140px;
+ width: 144px;
box-sizing: border-box;
padding: 0 5px;
}
@@ -110,13 +111,13 @@
width: 90px;
}
-@media (max-width: 1130px) {
+@media (max-width: 1150px) {
.project-card-leak-measures .project-card-measure {
- width: 134px;
+ width: 136px;
padding: 0 2px;
}
.project-card-measure.smaller-card {
- width: 81px;
+ width: 80px;
}
}