diff options
author | Stas Vilchik <vilchiks@gmail.com> | 2015-11-25 15:50:51 +0100 |
---|---|---|
committer | Stas Vilchik <vilchiks@gmail.com> | 2015-11-25 15:53:35 +0100 |
commit | 1dd4b644a11c9fbe100f357fe10d885e55bc95f8 (patch) | |
tree | cf6a2684623305ab0923583d06e2c1bc015d475f | |
parent | 72a252ae0f8e6b6f9d54aade3188f4d6c9c2fcb7 (diff) | |
download | sonarqube-1dd4b644a11c9fbe100f357fe10d885e55bc95f8.tar.gz sonarqube-1dd4b644a11c9fbe100f357fe10d885e55bc95f8.zip |
SONAR-6331 apply feedback
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 <div className="overview-domain-chart"> <div className="overview-card-header"> - <h2 className="overview-title">Project Files</h2> + <h2 className="overview-title">{window.t('overview.chart.files')}</h2> <ul className="list-inline small"> <li>X: {this.state.xMetric.name}</li> <li>Y: {this.state.yMetric.name}</li> 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 <div className="overview-domain-chart"> <div className="overview-card-header"> <div> - <h2 className="overview-title">Timeline</h2> + <h2 className="overview-title">{window.t('overview.chart.history')}</h2> {this.renderTimelineMetricSelect()} </div> {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('<br>'); return `<div class="text-left">${inner}</div>`; @@ -82,7 +84,7 @@ export class DomainTreemap extends React.Component { let color = this.props.colorMetric ? <li>Color: {this.state.colorMetric.name}</li> : null; return <div className="overview-domain-chart"> <div className="overview-card-header"> - <h2 className="overview-title">Treemap</h2> + <h2 className="overview-title">{window.t('overview.chart.components')}</h2> <ul className="list-inline small"> <li>Size: {this.state.sizeMetric.name}</li> {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({ <div className="overview-cards-list"> <div className="overview-card overview-card-fixed-width"> <div className="overview-card-header"> - <div className="overview-title">Coverage Overview</div> + <div className="overview-title">{window.t('overview.domain.coverage')}</div> {this.renderLegend()} </div> <CoverageMeasuresList {...this.props} {...this.state}/> 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({ <div className="overview-cards-list"> <div className="overview-card overview-card-fixed-width"> <div className="overview-card-header"> - <div className="overview-title">Technical Debt Overview</div> + <div className="overview-title">{window.t('overview.domain.debt')}</div> {this.renderLegend()} </div> @@ -176,7 +185,7 @@ export const IssuesMain = React.createClass({ <div className="overview-detailed-measure"> <div className="overview-detailed-measure-nutshell"> <div className="overview-detailed-measure-name"> - <StatusHelper status="OPEN"/> & <StatusHelper status="REOPENED"/> Issues + {window.t('overview.unmanaged_issues')} </div> <div className="spacer-top"> <Assignees {...this.props} assignees={this.state.assignees}/> 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({ <div className="overview-cards-list"> <div className="overview-card overview-card-fixed-width"> <div className="overview-card-header"> - <div className="overview-title">Duplications Overview</div> + <div className="overview-title">{window.t('overview.domain.duplications')}</div> {this.renderLegend()} </div> <div className="overview-detailed-measures-list"> 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 <div className="overview-detailed-page"> <div className="overview-card"> <div className="overview-card-header"> - <div className="overview-title">Size Overview</div> + <div className="overview-title">{window.t('overview.domain.size')}</div> {this.renderLegend()} </div> 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 <div> <div className="overview-title"> {this.props.children} - <a onClick={this.handleClick} className="small big-spacer-left link-no-underline" href="#"> + <a className="small big-spacer-left link-no-underline" href={url}> More <i className="icon-chevron-right" style={{ position: 'relative', top: -1 }}/></a> </div> </div>; @@ -51,7 +47,7 @@ export const DomainLeakTitle = React.createClass({ export const DomainHeader = React.createClass({ render () { return <div className="overview-card-header"> - <DomainTitle linkTo={this.props.linkTo}>{this.props.title}</DomainTitle> + <DomainTitle {...this.props}>{this.props.title}</DomainTitle> <Legend leakPeriodLabel={this.props.leakPeriodLabel} leakPeriodDate={this.props.leakPeriodDate}/> </div>; } 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 <Domain> - <DomainHeader title="Coverage" linkTo="/tests"/> + <DomainHeader component={this.props.component} title={window.t('overview.domain.coverage')} linkTo="/tests"/> <DomainPanel domain="coverage"> <DomainNutshell> 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 <DomainLeak> <MeasuresList> <Measure label={getMetricName('duplications')}> - {formatMeasureVariation(this.props.leak['duplicated_lines_density'], 'PERCENT')} + {formatted} </Measure> </MeasuresList> {this.renderTimeline('after')} @@ -42,7 +44,8 @@ export const GeneralDuplications = React.createClass({ render () { return <Domain> - <DomainHeader title="Duplications" linkTo="/duplications"/> + <DomainHeader component={this.props.component} title={window.t('overview.domain.duplications')} + linkTo="/duplications"/> <DomainPanel domain="duplications"> <DomainNutshell> 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 <Domain> - <DomainHeader title="Technical Debt" linkTo="/issues" + <DomainHeader component={this.props.component} title={window.t('overview.domain.debt')} linkTo="/issues" leakPeriodLabel={this.props.leakPeriodLabel} leakPeriodDate={this.props.leakPeriodDate}/> <DomainPanel domain="issues"> 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 <DomainLeak> <MeasuresList> - <Measure label={getMetricName('ncloc')}> - {formatMeasureVariation(this.props.leak['ncloc'], 'SHORT_INT')} - </Measure> + <Measure label={getMetricName('ncloc')}>{formatted}</Measure> </MeasuresList> {this.renderTimeline('after')} </DomainLeak>; @@ -45,7 +44,7 @@ export const GeneralSize = React.createClass({ render () { return <Domain> - <DomainHeader title="Size" linkTo="/size"/> + <DomainHeader component={this.props.component} title={window.t('overview.domain.size')} linkTo="/size"/> <DomainPanel domain="size"> <DomainNutshell> 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 #------------------------------------------------------------------------------ |