From 1dd4b644a11c9fbe100f357fe10d885e55bc95f8 Mon Sep 17 00:00:00 2001 From: Stas Vilchik Date: Wed, 25 Nov 2015 15:50:51 +0100 Subject: [PATCH] SONAR-6331 apply feedback --- .../components/domain-bubble-chart.js | 2 +- .../overview/components/domain-timeline.js | 2 +- .../overview/components/domain-treemap.js | 6 +++-- .../apps/overview/components/issue-measure.js | 2 +- .../apps/overview/domains/coverage-domain.js | 2 +- .../js/apps/overview/domains/debt-domain.js | 25 +++++++++++++------ .../overview/domains/duplications-domain.js | 2 +- .../js/apps/overview/domains/size-domain.js | 2 +- .../main/js/apps/overview/main/components.js | 12 +++------ .../main/js/apps/overview/main/coverage.js | 2 +- .../js/apps/overview/main/duplications.js | 7 ++++-- .../src/main/js/apps/overview/main/issues.js | 2 +- .../src/main/js/apps/overview/main/size.js | 9 +++---- .../sonar-web/src/main/js/helpers/measures.js | 8 +++++- .../resources/org/sonar/l10n/core.properties | 11 +++++--- 15 files changed, 57 insertions(+), 37 deletions(-) diff --git a/server/sonar-web/src/main/js/apps/overview/components/domain-bubble-chart.js b/server/sonar-web/src/main/js/apps/overview/components/domain-bubble-chart.js index 7dee684daaa..f67d5d02873 100644 --- a/server/sonar-web/src/main/js/apps/overview/components/domain-bubble-chart.js +++ b/server/sonar-web/src/main/js/apps/overview/components/domain-bubble-chart.js @@ -104,7 +104,7 @@ export class DomainBubbleChart extends React.Component { render () { return
-

Project Files

+

{window.t('overview.chart.files')}

  • X: {this.state.xMetric.name}
  • Y: {this.state.yMetric.name}
  • diff --git a/server/sonar-web/src/main/js/apps/overview/components/domain-timeline.js b/server/sonar-web/src/main/js/apps/overview/components/domain-timeline.js index f58e536ddaf..336268b9c35 100644 --- a/server/sonar-web/src/main/js/apps/overview/components/domain-timeline.js +++ b/server/sonar-web/src/main/js/apps/overview/components/domain-timeline.js @@ -190,7 +190,7 @@ export const DomainTimeline = React.createClass({ return
    -

    Timeline

    +

    {window.t('overview.chart.history')}

    {this.renderTimelineMetricSelect()}
    {this.renderComparisonMetricSelect()} diff --git a/server/sonar-web/src/main/js/apps/overview/components/domain-treemap.js b/server/sonar-web/src/main/js/apps/overview/components/domain-treemap.js index 59ee367e312..d153b98ef1e 100644 --- a/server/sonar-web/src/main/js/apps/overview/components/domain-treemap.js +++ b/server/sonar-web/src/main/js/apps/overview/components/domain-treemap.js @@ -48,7 +48,9 @@ export class DomainTreemap extends React.Component { `${this.state.sizeMetric.name}: ${formatMeasure(component.measures[this.props.sizeMetric], this.state.sizeMetric.type)}` ]; if (this.state.colorMetric) { - inner.push(`${this.state.colorMetric.name}: ${formatMeasure(component.measures[this.props.colorMetric], this.state.colorMetric.type)}`); + let measure = component.measures[this.props.colorMetric], + formatted = measure != null ? formatMeasure(measure, this.state.colorMetric.type) : '—'; + inner.push(`${this.state.colorMetric.name}: ${formatted}`); } inner = inner.join('
    '); return `
    ${inner}
    `; @@ -82,7 +84,7 @@ export class DomainTreemap extends React.Component { let color = this.props.colorMetric ?
  • Color: {this.state.colorMetric.name}
  • : null; return
    -

    Treemap

    +

    {window.t('overview.chart.components')}

    • Size: {this.state.sizeMetric.name}
    • {color} diff --git a/server/sonar-web/src/main/js/apps/overview/components/issue-measure.js b/server/sonar-web/src/main/js/apps/overview/components/issue-measure.js index b32c770cadc..9fe4fc032fd 100644 --- a/server/sonar-web/src/main/js/apps/overview/components/issue-measure.js +++ b/server/sonar-web/src/main/js/apps/overview/components/issue-measure.js @@ -223,7 +223,7 @@ export const SeverityMeasure = React.createClass({ return null; } - let leak = this.props.leak[this.getMetric()]; + let leak = this.props.leak[this.getMetric()] || 0; let added = this.props.leak[this.getNewMetric()] || 0; let removed = added - leak; diff --git a/server/sonar-web/src/main/js/apps/overview/domains/coverage-domain.js b/server/sonar-web/src/main/js/apps/overview/domains/coverage-domain.js index 7d2ab65d8b7..79a45f63408 100644 --- a/server/sonar-web/src/main/js/apps/overview/domains/coverage-domain.js +++ b/server/sonar-web/src/main/js/apps/overview/domains/coverage-domain.js @@ -93,7 +93,7 @@ export const CoverageMain = React.createClass({
      -
      Coverage Overview
      +
      {window.t('overview.domain.coverage')}
      {this.renderLegend()}
      diff --git a/server/sonar-web/src/main/js/apps/overview/domains/debt-domain.js b/server/sonar-web/src/main/js/apps/overview/domains/debt-domain.js index db6f40655cc..bf521c4b69c 100644 --- a/server/sonar-web/src/main/js/apps/overview/domains/debt-domain.js +++ b/server/sonar-web/src/main/js/apps/overview/domains/debt-domain.js @@ -15,7 +15,7 @@ import { CHART_COLORS_RANGE_PERCENT } from '../../../helpers/constants'; import { AddedRemovedMeasure, AddedRemovedDebt, OnNewCodeMeasure, SeverityMeasure } from './../components/issue-measure'; import { IssuesTags } from './../components/issues-tags'; import Assignees from './../components/issues-assignees'; -import { getFacets, extractAssignees } from '../../../api/issues'; +import { getFacet, extractAssignees } from '../../../api/issues'; import StatusHelper from '../../../components/shared/status-helper'; import { Rating } from '../../../components/shared/rating'; import { DrilldownLink } from '../../../components/shared/drilldown-link'; @@ -39,12 +39,13 @@ export const IssuesMain = React.createClass({ componentDidMount() { Promise.all([ this.requestMeasures(), - this.requestIssues() + this.requestIssues(), + this.requestAssignees() ]).then(responses => { let measures = this.getMeasuresValues(responses[0], 'value'); let leak = this.getMeasuresValues(responses[0], 'var' + this.props.leakPeriodIndex); - let tags = this.getFacet(responses[1].facets, 'tags'); - let assignees = extractAssignees(this.getFacet(responses[1].facets, 'assignees'), responses[1].response); + let tags = responses[1].facet; + let assignees = extractAssignees(responses[2].facet, responses[2].response); this.setState({ ready: true, measures, leak, tags, assignees }); }); }, @@ -80,10 +81,18 @@ export const IssuesMain = React.createClass({ }, requestIssues () { - return getFacets({ + return getFacet({ componentUuids: this.props.component.id, resolved: 'false' - }, ['tags', 'assignees']); + }, 'tags'); + }, + + requestAssignees () { + return getFacet({ + componentUuids: this.props.component.id, + resolved: 'false', + statuses: 'OPEN,REOPENED' + }, 'assignees'); }, renderLoading () { @@ -149,7 +158,7 @@ export const IssuesMain = React.createClass({
      -
      Technical Debt Overview
      +
      {window.t('overview.domain.debt')}
      {this.renderLegend()}
      @@ -176,7 +185,7 @@ export const IssuesMain = React.createClass({
      - & Issues + {window.t('overview.unmanaged_issues')}
      diff --git a/server/sonar-web/src/main/js/apps/overview/domains/duplications-domain.js b/server/sonar-web/src/main/js/apps/overview/domains/duplications-domain.js index e1e3977e264..48067d57a17 100644 --- a/server/sonar-web/src/main/js/apps/overview/domains/duplications-domain.js +++ b/server/sonar-web/src/main/js/apps/overview/domains/duplications-domain.js @@ -88,7 +88,7 @@ export const DuplicationsMain = React.createClass({
      -
      Duplications Overview
      +
      {window.t('overview.domain.duplications')}
      {this.renderLegend()}
      diff --git a/server/sonar-web/src/main/js/apps/overview/domains/size-domain.js b/server/sonar-web/src/main/js/apps/overview/domains/size-domain.js index e65f0123578..45b4728d73e 100644 --- a/server/sonar-web/src/main/js/apps/overview/domains/size-domain.js +++ b/server/sonar-web/src/main/js/apps/overview/domains/size-domain.js @@ -97,7 +97,7 @@ export const SizeMain = React.createClass({ return
      -
      Size Overview
      +
      {window.t('overview.domain.size')}
      {this.renderLegend()}
      diff --git a/server/sonar-web/src/main/js/apps/overview/main/components.js b/server/sonar-web/src/main/js/apps/overview/main/components.js index 68a5cd0670d..87b920f7ea0 100644 --- a/server/sonar-web/src/main/js/apps/overview/main/components.js +++ b/server/sonar-web/src/main/js/apps/overview/main/components.js @@ -2,7 +2,6 @@ import moment from 'moment'; import React from 'react'; import { Timeline } from './timeline'; -import { navigate } from '../../../components/router/router'; import { Legend } from '../components/legend'; @@ -14,17 +13,14 @@ export const Domain = React.createClass({ export const DomainTitle = React.createClass({ - handleClick(e) { - e.preventDefault(); - navigate(this.props.linkTo); - }, - render () { if (this.props.linkTo) { + let url = window.baseUrl + '/overview' + this.props.linkTo + + '?id=' + encodeURIComponent(this.props.component.key); return
      {this.props.children} - + More
      ; @@ -51,7 +47,7 @@ export const DomainLeakTitle = React.createClass({ export const DomainHeader = React.createClass({ render () { return
      - {this.props.title} + {this.props.title}
      ; } diff --git a/server/sonar-web/src/main/js/apps/overview/main/coverage.js b/server/sonar-web/src/main/js/apps/overview/main/coverage.js index 7a80f024bff..71d83c93b9d 100644 --- a/server/sonar-web/src/main/js/apps/overview/main/coverage.js +++ b/server/sonar-web/src/main/js/apps/overview/main/coverage.js @@ -72,7 +72,7 @@ export const GeneralCoverage = React.createClass({ } return - + diff --git a/server/sonar-web/src/main/js/apps/overview/main/duplications.js b/server/sonar-web/src/main/js/apps/overview/main/duplications.js index 9fcc3f5c420..8dcd5b0b4b3 100644 --- a/server/sonar-web/src/main/js/apps/overview/main/duplications.js +++ b/server/sonar-web/src/main/js/apps/overview/main/duplications.js @@ -19,10 +19,12 @@ export const GeneralDuplications = React.createClass({ if (!this.hasLeakPeriod()) { return null; } + let measure = this.props.leak['duplicated_lines_density'], + formatted = measure != null ? formatMeasureVariation(measure, 'PERCENT') : '—'; return - {formatMeasureVariation(this.props.leak['duplicated_lines_density'], 'PERCENT')} + {formatted} {this.renderTimeline('after')} @@ -42,7 +44,8 @@ export const GeneralDuplications = React.createClass({ render () { return - + diff --git a/server/sonar-web/src/main/js/apps/overview/main/issues.js b/server/sonar-web/src/main/js/apps/overview/main/issues.js index 5a500cda8e4..511353dbfbb 100644 --- a/server/sonar-web/src/main/js/apps/overview/main/issues.js +++ b/server/sonar-web/src/main/js/apps/overview/main/issues.js @@ -64,7 +64,7 @@ export const GeneralIssues = React.createClass({ render () { return - diff --git a/server/sonar-web/src/main/js/apps/overview/main/size.js b/server/sonar-web/src/main/js/apps/overview/main/size.js index 6caaa602342..0520e5466c5 100644 --- a/server/sonar-web/src/main/js/apps/overview/main/size.js +++ b/server/sonar-web/src/main/js/apps/overview/main/size.js @@ -20,12 +20,11 @@ export const GeneralSize = React.createClass({ if (!this.hasLeakPeriod()) { return null; } - + let measure = this.props.leak['ncloc'], + formatted = measure != null ? formatMeasureVariation(measure, 'SHORT_INT') : '—'; return - - {formatMeasureVariation(this.props.leak['ncloc'], 'SHORT_INT')} - + {formatted} {this.renderTimeline('after')} ; @@ -45,7 +44,7 @@ export const GeneralSize = React.createClass({ render () { return - + diff --git a/server/sonar-web/src/main/js/helpers/measures.js b/server/sonar-web/src/main/js/helpers/measures.js index dd8b4ea5854..639a7678266 100644 --- a/server/sonar-web/src/main/js/helpers/measures.js +++ b/server/sonar-web/src/main/js/helpers/measures.js @@ -85,7 +85,7 @@ function getVariationFormatter (type) { 'SHORT_WORK_DUR': shortDurationVariationFormatter, 'RATING': ratingFormatter, 'LEVEL': levelFormatter, - 'MILLISEC': millisecondsFormatter + 'MILLISEC': millisecondsVariationFormatter }; return FORMATTERS[type] || noFormatter; } @@ -168,6 +168,12 @@ function millisecondsFormatter (value) { } } +function millisecondsVariationFormatter (value) { + let absValue = Math.abs(value), + formattedValue = millisecondsFormatter(absValue); + return value < 0 ? `-${formattedValue}` : `+${formattedValue}`; +} + /* * Debt Formatters diff --git a/sonar-core/src/main/resources/org/sonar/l10n/core.properties b/sonar-core/src/main/resources/org/sonar/l10n/core.properties index 72ea12e31f8..aa4069ea989 100644 --- a/sonar-core/src/main/resources/org/sonar/l10n/core.properties +++ b/sonar-core/src/main/resources/org/sonar/l10n/core.properties @@ -3110,6 +3110,7 @@ overview.quality_gate=Quality Gate overview.quality_profiles=Quality Profiles overview.water_leak=Water Leak overview.project_in_a_nutshell=Project In a Nutshell +overview.unmanaged_issues=Unmanaged Issues overview.metric.issues=Issues overview.metric.debt=Debt @@ -3135,10 +3136,14 @@ overview.gate.ERROR=Failed overview.gate.WARN=Warning overview.gate.OK=Passed -overview.domain.issues=Issues & Technical Debt -overview.domain.coverage=Coverage & Tests +overview.domain.debt=Technical Debt +overview.domain.coverage=Coverage overview.domain.duplications=Duplications -overview.domain.size=Size & Complexity +overview.domain.size=Size + +overview.chart.files=Files +overview.chart.components=Components +overview.chart.history=History #------------------------------------------------------------------------------ -- 2.39.5