]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-7068 Add a visual indicators for each domain on the overview page
authorStas Vilchik <vilchiks@gmail.com>
Wed, 25 Nov 2015 15:00:46 +0000 (16:00 +0100)
committerStas Vilchik <vilchiks@gmail.com>
Wed, 25 Nov 2015 15:25:02 +0000 (16:25 +0100)
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

index 71d83c93b9d6e111dd4192ee6175b6b86e578927..1e37aac5139b2a6ff33c37bcd0f3cbd34da555e6 100644 (file)
@@ -3,6 +3,7 @@ import React from 'react';
 import { Domain, DomainHeader, DomainPanel, DomainNutshell, DomainLeak, MeasuresList, Measure, DomainMixin } from './components';
 import { DrilldownLink } from '../../../components/shared/drilldown-link';
 import { TooltipsMixin } from '../../../components/mixins/tooltips-mixin';
+import { DonutChart } from '../../../components/charts/donut-chart';
 import { getMetricName } from '../helpers/metrics';
 import { formatMeasure } from '../../../helpers/measures';
 
@@ -71,12 +72,20 @@ export const GeneralCoverage = React.createClass({
       return null;
     }
 
+    let donutData = [
+      { value: this.props.measures[coverageMetric], fill: '#85bb43' },
+      { value: 100 - this.props.measures[coverageMetric], fill: '#d4333f' }
+    ];
+
     return <Domain>
       <DomainHeader component={this.props.component} title={window.t('overview.domain.coverage')} linkTo="/tests"/>
 
       <DomainPanel domain="coverage">
         <DomainNutshell>
           <MeasuresList>
+            <Measure composite={true}>
+              <DonutChart width="48" height="48" thickness="6" data={donutData}/>
+            </Measure>
             <Measure label={getMetricName('coverage')}>
               <DrilldownLink component={this.props.component.key} metric={coverageMetric}>
                 <span className="js-overview-main-coverage">
index 8dcd5b0b4b3fc8f2f57bd350748fbb81e798f55f..18db99bb3c77979edd0002415bb3b1700691aff9 100644 (file)
@@ -3,6 +3,7 @@ import React from 'react';
 import { Domain, DomainHeader, DomainPanel, DomainNutshell, DomainLeak, MeasuresList, Measure, DomainMixin } from './components';
 import { DrilldownLink } from '../../../components/shared/drilldown-link';
 import { TooltipsMixin } from '../../../components/mixins/tooltips-mixin';
+import { DonutChart } from '../../../components/charts/donut-chart';
 import { getMetricName } from '../helpers/metrics';
 import { formatMeasure, formatMeasureVariation } from '../../../helpers/measures';
 
@@ -43,6 +44,11 @@ export const GeneralDuplications = React.createClass({
   },
 
   render () {
+    let donutData = [
+      { value: this.props.measures['duplicated_lines_density'], fill: '#f3ca8e' },
+      { value: 100 - this.props.measures['duplicated_lines_density'], fill: '#e6e6e6' }
+    ];
+
     return <Domain>
       <DomainHeader component={this.props.component} title={window.t('overview.domain.duplications')}
                     linkTo="/duplications"/>
@@ -50,6 +56,9 @@ export const GeneralDuplications = React.createClass({
       <DomainPanel domain="duplications">
         <DomainNutshell>
           <MeasuresList>
+            <Measure composite={true}>
+              <DonutChart width="48" height="48" thickness="6" data={donutData}/>
+            </Measure>
             <Measure label={getMetricName('duplications')}>
               <DrilldownLink component={this.props.component.key} metric="duplicated_lines_density">
                 {formatMeasure(this.props.measures['duplicated_lines_density'], 'PERCENT')}
index 3f742f035fa5fea3249b6b28103e982e5f1f7e5c..b291d8243eb3c9763dd353e1f87822ce68d741ab 100644 (file)
@@ -28,18 +28,18 @@ export const GeneralIssues = React.createClass({
 
     return <DomainLeak>
       <MeasuresList>
-        <Measure label={getMetricName('new_issues')}>
-          <IssuesLink component={this.props.component.key}
-                      params={{ resolved: 'false', createdAfter: createdAfter }}>
-            {formatMeasure(this.props.leak.issues, 'SHORT_INT')}
-          </IssuesLink>
-        </Measure>
         <Measure label={getMetricName('new_debt')}>
           <IssuesLink component={this.props.component.key}
                       params={{ resolved: 'false', createdAfter: createdAfter, facetMode: 'debt' }}>
             {formatMeasure(this.props.leak.debt, 'SHORT_WORK_DUR')}
           </IssuesLink>
         </Measure>
+        <Measure label={getMetricName('new_issues')}>
+          <IssuesLink component={this.props.component.key}
+                      params={{ resolved: 'false', createdAfter: createdAfter }}>
+            {formatMeasure(this.props.leak.issues, 'SHORT_INT')}
+          </IssuesLink>
+        </Measure>
       </MeasuresList>
       {this.renderTimeline('after')}
     </DomainLeak>;
@@ -58,16 +58,16 @@ export const GeneralIssues = React.createClass({
                 <Rating value={this.props.measures['sqale_rating']}/>
               </DrilldownLink>
             </Measure>
-            <Measure label={getMetricName('issues')}>
-              <IssuesLink component={this.props.component.key} params={{ resolved: 'false' }}>
-                {formatMeasure(this.props.measures.issues, 'SHORT_INT')}
-              </IssuesLink>
-            </Measure>
             <Measure label={getMetricName('debt')}>
               <IssuesLink component={this.props.component.key} params={{ resolved: 'false', facetMode: 'debt' }}>
                 {formatMeasure(this.props.measures.debt, 'SHORT_WORK_DUR')}
               </IssuesLink>
             </Measure>
+            <Measure label={getMetricName('issues')}>
+              <IssuesLink component={this.props.component.key} params={{ resolved: 'false' }}>
+                {formatMeasure(this.props.measures.issues, 'SHORT_INT')}
+              </IssuesLink>
+            </Measure>
           </MeasuresList>
           {this.renderTimeline('before')}
         </DomainNutshell>
index 0520e5466c5182af3a2e06ac3d8423f149be0c82..0ae35795ccb947df8e4ec73e3bfc289a10035f3c 100644 (file)
@@ -49,12 +49,12 @@ export const GeneralSize = React.createClass({
       <DomainPanel domain="size">
         <DomainNutshell>
           <MeasuresList>
+            {this.renderLanguageDistribution()}
             <Measure label={getMetricName('ncloc')}>
               <DrilldownLink component={this.props.component.key} metric="ncloc">
                 {formatMeasure(this.props.measures['ncloc'], 'SHORT_INT')}
               </DrilldownLink>
             </Measure>
-            {this.renderLanguageDistribution()}
           </MeasuresList>
           {this.renderTimeline('before')}
         </DomainNutshell>