From c43dbafc167e13b59511629b438c9c08a4efae7e Mon Sep 17 00:00:00 2001 From: Stas Vilchik Date: Tue, 19 Sep 2017 17:28:23 +0200 Subject: SONAR-9842 align project, portfolio and application home pages --- .../src/main/js/apps/overview/meta/MetaSize.js | 20 ++++++++---------- .../main/js/apps/portfolio/components/Activity.tsx | 6 ++---- .../main/js/apps/portfolio/components/Report.tsx | 6 +----- .../main/js/apps/portfolio/components/Summary.tsx | 8 ++++---- .../__tests__/__snapshots__/Activity-test.tsx.snap | 14 ++++--------- .../__tests__/__snapshots__/Report-test.tsx.snap | 24 ++++++---------------- .../__tests__/__snapshots__/Summary-test.tsx.snap | 16 +++++++++++---- .../src/main/js/apps/portfolio/styles.css | 6 ++---- server/sonar-web/src/main/less/init/misc.less | 3 --- 9 files changed, 40 insertions(+), 63 deletions(-) (limited to 'server') diff --git a/server/sonar-web/src/main/js/apps/overview/meta/MetaSize.js b/server/sonar-web/src/main/js/apps/overview/meta/MetaSize.js index 7cd41c45753..3b7561ca16a 100644 --- a/server/sonar-web/src/main/js/apps/overview/meta/MetaSize.js +++ b/server/sonar-web/src/main/js/apps/overview/meta/MetaSize.js @@ -46,7 +46,7 @@ export default class MetaSize extends React.PureComponent { {formatMeasure(ncloc.value, 'SHORT_INT')} -
{getMetricName('ncloc')}
+
{getMetricName('ncloc')}
); @@ -55,8 +55,11 @@ export default class MetaSize extends React.PureComponent { measure => measure.metric.key === 'ncloc_language_distribution' ); + const className = + this.props.component.qualifier === 'TRK' ? 'overview-meta-size-lang-dist' : 'big-spacer-top'; + return languageDistribution ? ( -
+
) : null; @@ -66,16 +69,14 @@ export default class MetaSize extends React.PureComponent { const projects = this.props.measures.find(measure => measure.metric.key === 'projects'); return projects ? ( -
+
{formatMeasure(projects.value, 'SHORT_INT')} -
- {translate('metric.projects.name')} -
+
{translate('metric.projects.name')}
) : null; }; @@ -89,12 +90,9 @@ export default class MetaSize extends React.PureComponent { return (
+ {this.props.component.qualifier === 'APP' && this.renderProjects()} {this.renderLoC(ncloc)} - {this.props.component.qualifier === 'APP' ? ( - this.renderProjects() - ) : ( - this.renderLoCDistribution() - )} + {this.renderLoCDistribution()}
); } diff --git a/server/sonar-web/src/main/js/apps/portfolio/components/Activity.tsx b/server/sonar-web/src/main/js/apps/portfolio/components/Activity.tsx index 63ccdd7217c..66cef7e572d 100644 --- a/server/sonar-web/src/main/js/apps/portfolio/components/Activity.tsx +++ b/server/sonar-web/src/main/js/apps/portfolio/components/Activity.tsx @@ -97,10 +97,8 @@ export default class Activity extends React.PureComponent { render() { return ( -
-
-

{translate('project_activity.page')}

-
+
+

{translate('project_activity.page')}

{this.state.loading ? ( diff --git a/server/sonar-web/src/main/js/apps/portfolio/components/Report.tsx b/server/sonar-web/src/main/js/apps/portfolio/components/Report.tsx index 86bf16d5050..e552313cc40 100644 --- a/server/sonar-web/src/main/js/apps/portfolio/components/Report.tsx +++ b/server/sonar-web/src/main/js/apps/portfolio/components/Report.tsx @@ -59,11 +59,7 @@ export default class Report extends React.PureComponent { ); } - renderHeader = () => ( -
-

{translate('report.page')}

-
- ); + renderHeader = () =>

{translate('report.page')}

; render() { const { component } = this.props; diff --git a/server/sonar-web/src/main/js/apps/portfolio/components/Summary.tsx b/server/sonar-web/src/main/js/apps/portfolio/components/Summary.tsx index 5aecf73d70f..018940b3aa0 100644 --- a/server/sonar-web/src/main/js/apps/portfolio/components/Summary.tsx +++ b/server/sonar-web/src/main/js/apps/portfolio/components/Summary.tsx @@ -35,7 +35,7 @@ export default function Summary({ component, measures }: Props) { const nclocDistribution = measures['ncloc_language_distribution']; return ( -
+
{component.description &&
{component.description}
}
    @@ -47,7 +47,7 @@ export default function Summary({ component, measures }: Props) { />
- {translate('projects')} +
{translate('projects')}
  • @@ -55,12 +55,12 @@ export default function Summary({ component, measures }: Props) {
    - {translate('metric.ncloc.name')} +
    {translate('metric.ncloc.name')}
  • {nclocDistribution && ( -
    +
    )} diff --git a/server/sonar-web/src/main/js/apps/portfolio/components/__tests__/__snapshots__/Activity-test.tsx.snap b/server/sonar-web/src/main/js/apps/portfolio/components/__tests__/__snapshots__/Activity-test.tsx.snap index fa3361a98b5..2a0038daecb 100644 --- a/server/sonar-web/src/main/js/apps/portfolio/components/__tests__/__snapshots__/Activity-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/portfolio/components/__tests__/__snapshots__/Activity-test.tsx.snap @@ -2,17 +2,11 @@ exports[`renders 1`] = `
    -
    -

    - project_activity.page -

    -
    +

    + project_activity.page +

    -
    -

    - report.page -

    -
    +

    + report.page +

    @@ -19,15 +13,9 @@ exports[`renders 1`] = ` exports[`renders 2`] = `
    -
    -

    - report.page -

    -
    +

    + report.page +

    diff --git a/server/sonar-web/src/main/js/apps/portfolio/components/__tests__/__snapshots__/Summary-test.tsx.snap b/server/sonar-web/src/main/js/apps/portfolio/components/__tests__/__snapshots__/Summary-test.tsx.snap index db159a6947a..f8f2706777d 100644 --- a/server/sonar-web/src/main/js/apps/portfolio/components/__tests__/__snapshots__/Summary-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/portfolio/components/__tests__/__snapshots__/Summary-test.tsx.snap @@ -2,7 +2,7 @@ exports[`renders 1`] = `
    - projects +
    + projects +
  • - metric.ncloc.name +
    + metric.ncloc.name +