]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-6331 apply feedback
authorStas Vilchik <vilchiks@gmail.com>
Wed, 25 Nov 2015 14:50:51 +0000 (15:50 +0100)
committerStas Vilchik <vilchiks@gmail.com>
Wed, 25 Nov 2015 14:53:35 +0000 (15:53 +0100)
15 files changed:
server/sonar-web/src/main/js/apps/overview/components/domain-bubble-chart.js
server/sonar-web/src/main/js/apps/overview/components/domain-timeline.js
server/sonar-web/src/main/js/apps/overview/components/domain-treemap.js
server/sonar-web/src/main/js/apps/overview/components/issue-measure.js
server/sonar-web/src/main/js/apps/overview/domains/coverage-domain.js
server/sonar-web/src/main/js/apps/overview/domains/debt-domain.js
server/sonar-web/src/main/js/apps/overview/domains/duplications-domain.js
server/sonar-web/src/main/js/apps/overview/domains/size-domain.js
server/sonar-web/src/main/js/apps/overview/main/components.js
server/sonar-web/src/main/js/apps/overview/main/coverage.js
server/sonar-web/src/main/js/apps/overview/main/duplications.js
server/sonar-web/src/main/js/apps/overview/main/issues.js
server/sonar-web/src/main/js/apps/overview/main/size.js
server/sonar-web/src/main/js/helpers/measures.js
sonar-core/src/main/resources/org/sonar/l10n/core.properties

index 7dee684daaa65cd5e4299a5f3249aba967d6cb29..f67d5d02873d5944c259e2ce8446d1099853ec89 100644 (file)
@@ -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>
index f58e536ddaf49865060d4498c1cfe851053a28b4..336268b9c35262f9c7912efe22e8a58d1186dd83 100644 (file)
@@ -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()}
index 59ee367e3122ab856171327b611a845a33819fc0..d153b98ef1e44580cdd45294904a67b506648768 100644 (file)
@@ -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}
index b32c770cadc028636ed8350579ab333cf12cdd17..9fe4fc032fd97961e6dccfd8a26fa7c06ecc0e96 100644 (file)
@@ -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;
 
index 7d2ab65d8b749bc249b1dc8d992933357f88afec..79a45f6340842f7f8ea465ac185ae73fa2939508 100644 (file)
@@ -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}/>
index db6f40655cc6d6c835d9e944bf5575eb7513962a..bf521c4b69c69f7bac6d305fbc6f4d631f3fa563 100644 (file)
@@ -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}/>
index e1e3977e264ac7af55bc96d0af7958aba096f390..48067d57a17c1a611c11bab050e101520c75c365 100644 (file)
@@ -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">
index e65f0123578b0d8a369465e6f4b12bcc8580b76a..45b4728d73e917192a07ae22d09fd91ec6209c41 100644 (file)
@@ -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>
 
index 68a5cd0670d62267ba252eec49f7fa2bd627e3ce..87b920f7ea0375543d85a4a79901d87a511500f2 100644 (file)
@@ -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>;
   }
index 7a80f024bffcf68400db6005a6404ad2e554c41c..71d83c93b9d6e111dd4192ee6175b6b86e578927 100644 (file)
@@ -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>
index 9fcc3f5c4208e68d961bb25a703a53085dfa6a2b..8dcd5b0b4b3fc8f2f57bd350748fbb81e798f55f 100644 (file)
@@ -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>
index 5a500cda8e494ebdde2c63eca3a62d5a1e233a13..511353dbfbbc13836475699aff8ded4b1d9a2d05 100644 (file)
@@ -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">
index 6caaa602342b7aa7f3cb2d6e771c9d42516d09a5..0520e5466c5182af3a2e06ac3d8423f149be0c82 100644 (file)
@@ -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>
index dd8b4ea58547823beaaeddcc6c92a23618fe1362..639a76782666914e21405d586f72c6bcb1d40d88 100644 (file)
@@ -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
index 72ea12e31f8ab9f96225b5d0af129f035f4edd56..aa4069ea98974ea18f15453e79d0810ededc3700 100644 (file)
@@ -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
 
 
 #------------------------------------------------------------------------------