]> source.dussan.org Git - sonarqube.git/commitdiff
improve code quality
authorStas Vilchik <vilchiks@gmail.com>
Tue, 8 Dec 2015 14:05:06 +0000 (15:05 +0100)
committerStas Vilchik <vilchiks@gmail.com>
Tue, 8 Dec 2015 14:05:06 +0000 (15:05 +0100)
28 files changed:
server/sonar-web/.eslintrc
server/sonar-web/src/main/js/apps/background-tasks/search.js
server/sonar-web/src/main/js/apps/background-tasks/stats.js
server/sonar-web/src/main/js/apps/background-tasks/tasks.js
server/sonar-web/src/main/js/apps/overview/components/coverage-measures-list.js
server/sonar-web/src/main/js/apps/overview/components/coverage-measures.js
server/sonar-web/src/main/js/apps/overview/components/event.js
server/sonar-web/src/main/js/apps/overview/components/timeline-chart.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/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/main.js
server/sonar-web/src/main/js/apps/overview/main/size.js
server/sonar-web/src/main/js/apps/project-permissions/search.js
server/sonar-web/src/main/js/apps/projects/search.js
server/sonar-web/src/main/js/components/charts/bar-chart.js
server/sonar-web/src/main/js/components/charts/bubble-chart.js
server/sonar-web/src/main/js/components/charts/donut-chart.js
server/sonar-web/src/main/js/components/charts/histogram.js
server/sonar-web/src/main/js/components/charts/line-chart.js
server/sonar-web/src/main/js/components/charts/treemap.js
server/sonar-web/src/main/js/components/charts/word-cloud.js
server/sonar-web/src/main/js/components/shared/avatar.js
server/sonar-web/src/main/js/components/shared/radio-toggle.js
server/sonar-web/src/main/js/main/nav/global/global-nav-branding.js

index 6a403ba8a2f149c12d8a9b9eb1e896321856473d..a063471955c2a5dcf9b1202700885914b9f34f16 100644 (file)
   ],
 
   "rules": {
-    "quotes": [ 2, "single", "avoid-escape" ],
-    "react/jsx-uses-react": 1
+    "quotes": [2, "single", "avoid-escape"],
+
+    "react/jsx-closing-bracket-location": [1, "after-props"],
+    "react/jsx-handler-names": 0,
+    "react/jsx-key": 2,
+    "react/jsx-max-props-per-line": [1, { "maximum": 3 }],
+    "react/jsx-no-duplicate-props": 2,
+    "react/jsx-no-undef": 2,
+    "react/jsx-pascal-case": 1,
+    "react/jsx-uses-react": 1,
+    "react/jsx-uses-vars": 2,
+    "react/no-did-mount-set-state": [2, "allow-in-func"],
+    "react/no-did-update-set-state": [2, "allow-in-func"],
+    "react/no-direct-mutation-state": 2,
+    "react/no-multi-comp": 0,
+    "react/no-unknown-property": 2,
+    "react/prop-types": 0,
+    "react/react-in-jsx-scope": 2,
+    "react/self-closing-comp": 2,
+    "react/sort-comp": 1
   }
 }
index a1624f02aaea70d7a0fb95a4b7d3ee81f92b4be5..8c68049cf14647912cb796682e47ec2a956c77c2 100644 (file)
@@ -5,11 +5,11 @@ import RadioToggle from '../../components/shared/radio-toggle';
 import { STATUSES, CURRENTS, DATE, DATE_FORMAT } from './constants';
 
 export default React.createClass({
-  componentDidUpdate() {
+  componentDidMount() {
     this.attachDatePicker();
   },
 
-  componentDidMount() {
+  componentDidUpdate() {
     this.attachDatePicker();
   },
 
@@ -102,8 +102,12 @@ export default React.createClass({
           <button className="search-box-submit button-clean">
             <i className="icon-search"></i>
           </button>
-          <input onChange={this.onSearch} value={this.props.searchQuery} ref="searchInput" className="search-box-input"
-                 type="search" placeholder="Search"/>
+          <input onChange={this.onSearch}
+                 value={this.props.searchQuery}
+                 ref="searchInput"
+                 className="search-box-input"
+                 type="search"
+                 placeholder="Search"/>
         </form>
     );
   },
index f8010c93d68cfa9321baaf802db5d3b247d53896..308d7e4d8a8f7e156443e74b9f1184f7e56ec2c5 100644 (file)
@@ -64,7 +64,10 @@ export default React.createClass({
     if (this.props.failuresCount > 0) {
       return (
           <span>
-            <a ref="failureCount" onClick={this.onFailuresClick} className="emphasised-measure" data-toggle="tooltip"
+            <a ref="failureCount"
+               onClick={this.onFailuresClick}
+               className="emphasised-measure"
+               data-toggle="tooltip"
                title="Count of projects where processing of most recent analysis report failed"
                href="#">{this.props.failuresCount}</a>
             &nbsp;
index 54b05fa0eeddf6d48709bd72e9bbcb8586a10367..edffaf43198c67b06a4ea6748c2aaf2b21a25ec9 100644 (file)
@@ -10,12 +10,12 @@ import { TooltipsMixin } from '../../components/mixins/tooltips-mixin';
 
 
 export default React.createClass({
-  mixins: [TooltipsMixin],
-
   propTypes: {
     tasks: React.PropTypes.arrayOf(React.PropTypes.object).isRequired
   },
 
+  mixins: [TooltipsMixin],
+
   onTaskCanceled (task, e) {
     e.preventDefault();
     this.props.onTaskCanceled(task);
index 0ce2db9c0d4f6a46b62abeab81c20c60f191ac53..96520d0ffdad289d4b18663d1c3eebb93bc0f0ac 100644 (file)
@@ -54,7 +54,10 @@ export const CoverageMeasuresList = React.createClass({
     }
 
     metrics = metrics.map(metric => {
-      return <DetailedMeasure key={metric.key} {...this.props} {...this.props} metric={metric.key}
+      return <DetailedMeasure key={metric.key}
+                              {...this.props} 
+                              {...this.props}
+                              metric={metric.key}
                               type={metric.type}/>;
     });
     return <div className="overview-detailed-measures-list">{metrics}</div>;
index 3fdf521a872ad4d86ee5ef6b5d1d947a1ea3fa02..731aafa9740923426be21f8ede9aecb822fe8e04 100644 (file)
@@ -72,7 +72,10 @@ export const CoverageMeasures = React.createClass({
       <div className="overview-detailed-measure-leak">
         <span className="overview-detailed-measure-value">
           <span className="spacer-right">
-            <DonutChart width="30" height="30" thickness="4" data={donutData}/>
+            <DonutChart width="30"
+                        height="30"
+                        thickness="4"
+                        data={donutData}/>
           </span>
           <DrilldownLink component={this.props.component.key}
                          metric={newCoverageMetricName}
@@ -90,7 +93,10 @@ export const CoverageMeasures = React.createClass({
       { value: coverage, fill: '#85bb43' },
       { value: 100 - coverage, fill: '#d4333f' }
     ];
-    return <DonutChart width="30" height="30" thickness="4" data={donutData}/>;
+    return <DonutChart width="30"
+                       height="30"
+                       thickness="4"
+                       data={donutData}/>;
   },
 
   render() {
index 05fe615a93b43b5a5268bd4fd46af9b6972b2204..80fe89648cec51a305bdfe5a699f504f99657d21 100644 (file)
@@ -5,8 +5,6 @@ import { TooltipsMixin } from '../../../components/mixins/tooltips-mixin';
 
 
 export const Event = React.createClass({
-  mixins: [TooltipsMixin],
-
   propTypes: {
     event: React.PropTypes.shape({
       id: React.PropTypes.string.isRequired,
@@ -17,6 +15,8 @@ export const Event = React.createClass({
     })
   },
 
+  mixins: [TooltipsMixin],
+
   render () {
     const { event } = this.props;
     return <li className="spacer-top">
index 62610c2f190171c1020699372bdd3ee1ab1fc6ce..e82f5a3c457f0cdaa3c4f9835e70f30614e556af 100644 (file)
@@ -9,8 +9,6 @@ import { TooltipsMixin } from '../../../components/mixins/tooltips-mixin';
 
 
 export const Timeline = React.createClass({
-  mixins: [ResizeMixin, TooltipsMixin],
-
   propTypes: {
     data: React.PropTypes.arrayOf(React.PropTypes.object).isRequired,
     padding: React.PropTypes.arrayOf(React.PropTypes.number),
@@ -18,6 +16,8 @@ export const Timeline = React.createClass({
     interpolate: React.PropTypes.string
   },
 
+  mixins: [ResizeMixin, TooltipsMixin],
+
   getDefaultProps() {
     return {
       padding: [10, 10, 10, 10],
@@ -93,7 +93,11 @@ export const Timeline = React.createClass({
       let nextTick = index + 1 < ticks.length ? ticks[index + 1] : xScale.domain()[1];
       let x = (xScale(tick) + xScale(nextTick)) / 2;
       let y = yScale.range()[0];
-      return <text key={index} className="line-chart-tick" x={x} y={y} dy="1.5em">{format(tick)}</text>;
+      return <text key={index}
+                   className="line-chart-tick"
+                   x={x}
+                   y={y}
+                   dy="1.5em">{format(tick)}</text>;
     });
     return <g>{ticks}</g>;
   },
@@ -113,11 +117,11 @@ export const Timeline = React.createClass({
   },
 
   renderLine (xScale, yScale) {
-    let path = d3.svg.line()
+    let p = d3.svg.line()
         .x(d => xScale(d.x))
         .y(d => yScale(d.y))
         .interpolate(this.props.interpolate);
-    return <path className="line-chart-path" d={path(this.props.data)}/>;
+    return <path className="line-chart-path" d={p(this.props.data)}/>;
   },
 
   renderEvents(xScale, yScale) {
index 179520a106fcfcc0ee44902112a4160b66a8662a..7527c23c18eb25b325a8cf660d0ab7c34470cb7b 100644 (file)
@@ -109,7 +109,10 @@ export const IssuesMain = React.createClass({
         .filter(metric => KNOWN_METRICS.indexOf(metric.key) === -1)
         .filter(metric => this.state.measures[metric.key] != null)
         .map(metric => {
-          return <DetailedMeasure key={metric.key} {...this.props} {...this.state} metric={metric.key}
+          return <DetailedMeasure key={metric.key}
+                                  {...this.props}
+                                  {...this.state}
+                                  metric={metric.key}
                                   type={metric.type}/>;
         });
     if (!metrics.length) {
index 321595b779d32fbbd8ce39deacf35ed74b88bb21..2223139a7604f9fe233359d05fa89dc409b2d0f1 100644 (file)
@@ -84,7 +84,10 @@ export const DuplicationsMain = React.createClass({
     let metrics = filterMetricsForDomains(this.props.metrics, ['Duplication'])
         .filter(metric => metric.key !== 'duplicated_lines_density')
         .map(metric => {
-          return <DetailedMeasure key={metric.key} {...this.props} {...this.state} metric={metric.key}
+          return <DetailedMeasure key={metric.key}
+                                  {...this.props}
+                                  {...this.state}
+                                  metric={metric.key}
                                   type={metric.type}/>;
         });
     return <div>{metrics}</div>;
@@ -97,7 +100,10 @@ export const DuplicationsMain = React.createClass({
       { value: duplications, fill: '#f3ca8e' },
       { value: Math.max(0, 20 - duplications), fill: '#e6e6e6' }
     ];
-    return <DonutChart width="30" height="30" thickness="4" data={donutData}/>;
+    return <DonutChart width="30"
+                       height="30"
+                       thickness="4"
+                       data={donutData}/>;
   },
 
   renderDuplicationsLeak() {
index 26f4af61cb1edc5db407dc12bab409fcd7f00854..05a23ae3d5184b07ff6eafaafe059f533620ecd4 100644 (file)
@@ -71,7 +71,10 @@ export const SizeMain = React.createClass({
     let metrics = filterMetricsForDomains(this.props.metrics, [domain])
         .filter(metric => hiddenMetrics.indexOf(metric.key) === -1)
         .map(metric => {
-          return <DetailedMeasure key={metric.key} {...this.props} {...this.state} metric={metric.key}
+          return <DetailedMeasure key={metric.key}
+                                  {...this.props}
+                                  {...this.state}
+                                  metric={metric.key}
                                   type={metric.type}/>;
         });
     return <div>{metrics}</div>;
@@ -112,16 +115,28 @@ export const SizeMain = React.createClass({
 
     return <div className="overview-detailed-layout-column">
       <div className="overview-detailed-measures-list">
-        <DetailedMeasure {...this.props} {...this.state} metric="complexity" type="INT"/>
-        <DetailedMeasure {...this.props} {...this.state} metric="function_complexity" type="FLOAT">
+        <DetailedMeasure {...this.props}
+                         {...this.state}
+                         metric="complexity"
+                         type="INT"/>
+        <DetailedMeasure {...this.props}
+                         {...this.state}
+                         metric="function_complexity"
+                         type="FLOAT">
           {this.renderComplexityDistribution(this.state.measures['function_complexity_distribution'],
               { of: 'function' })}
         </DetailedMeasure>
-        <DetailedMeasure {...this.props} {...this.state} metric="file_complexity" type="FLOAT">
+        <DetailedMeasure {...this.props}
+                         {...this.state}
+                         metric="file_complexity"
+                         type="FLOAT">
           {this.renderComplexityDistribution(this.state.measures['file_complexity_distribution'],
               { of: 'file' })}
         </DetailedMeasure>
-        <DetailedMeasure {...this.props} {...this.state} metric="class_complexity" type="FLOAT"/>
+        <DetailedMeasure {...this.props}
+                         {...this.state}
+                         metric="class_complexity"
+                         type="FLOAT"/>
         {this.renderOtherComplexityMeasures()}
       </div>
     </div>;
@@ -141,7 +156,10 @@ export const SizeMain = React.createClass({
         <div className="overview-detailed-layout-size">
           <div className="overview-detailed-layout-column">
             <div className="overview-detailed-measures-list">
-              <DetailedMeasure {...this.props} {...this.state} metric="ncloc" type="INT">
+              <DetailedMeasure {...this.props}
+                               {...this.state}
+                               metric="ncloc"
+                               type="INT">
                 {this.renderLanguageDistribution()}
               </DetailedMeasure>
               {this.renderOtherSizeMeasures()}
index 49d08a91f3173bb4625141e76a7fc815e5c05b90..36168a35b5ff57856eb96a7a62ffca12d685ff5b 100644 (file)
@@ -9,8 +9,6 @@ import { formatMeasure } from '../../../helpers/measures';
 
 
 export const GeneralCoverage = React.createClass({
-  mixins: [TooltipsMixin, DomainMixin],
-
   propTypes: {
     measures: React.PropTypes.object.isRequired,
     leakPeriodLabel: React.PropTypes.string,
@@ -18,6 +16,8 @@ export const GeneralCoverage = React.createClass({
     coverageMetricPrefix: React.PropTypes.string.isRequired
   },
 
+  mixins: [TooltipsMixin, DomainMixin],
+
   getCoverageMetric () {
     return this.props.coverageMetricPrefix + 'coverage';
   },
@@ -86,7 +86,10 @@ export const GeneralCoverage = React.createClass({
 
             <Measure composite={true}>
               <div className="display-inline-block text-middle big-spacer-right">
-                <DonutChart width="40" height="40" thickness="4" data={donutData}/>
+                <DonutChart width="40"
+                            height="40"
+                            thickness="4"
+                            data={donutData}/>
               </div>
               <div className="display-inline-block text-middle">
                 <div className="overview-domain-measure-value">
index 7e64f5184e5aca42c4cae129a96becad2291de88..eb08696c9bc759c3247a36e3424c131545a25ffe 100644 (file)
@@ -9,13 +9,13 @@ import { formatMeasure, formatMeasureVariation } from '../../../helpers/measures
 
 
 export const GeneralDuplications = React.createClass({
-  mixins: [TooltipsMixin, DomainMixin],
-
   propTypes: {
     leakPeriodLabel: React.PropTypes.string,
     leakPeriodDate: React.PropTypes.object
   },
 
+  mixins: [TooltipsMixin, DomainMixin],
+
   renderLeak () {
     if (!this.hasLeakPeriod()) {
       return null;
@@ -59,7 +59,10 @@ export const GeneralDuplications = React.createClass({
 
             <Measure composite={true}>
               <div className="display-inline-block text-middle big-spacer-right">
-                <DonutChart width="40" height="40" thickness="4" data={donutData}/>
+                <DonutChart width="40"
+                            height="40"
+                            thickness="4"
+                            data={donutData}/>
               </div>
               <div className="display-inline-block text-middle">
                 <div className="overview-domain-measure-value">
index f92e7ce12a99a1bff9ae4700b353edd6dd8da32e..9993f49c720054101d50299974aed06f85ea7060 100644 (file)
@@ -12,13 +12,13 @@ import { formatMeasure } from '../../../helpers/measures';
 
 
 export const GeneralIssues = React.createClass({
-  mixins: [TooltipsMixin, DomainMixin],
-
   propTypes: {
     leakPeriodLabel: React.PropTypes.string,
     leakPeriodDate: React.PropTypes.object
   },
 
+  mixins: [TooltipsMixin, DomainMixin],
+
   renderLeak () {
     if (!this.hasLeakPeriod()) {
       return null;
index 3d458a74c55c2e8c45e9508e4191e2c226e7b51a..39e17057257636e0631c6f1f2be2df2c525026fd 100644 (file)
@@ -36,12 +36,12 @@ const HISTORY_METRICS_LIST = [
 
 
 export default React.createClass({
-  mixins: [CoverageSelectionMixin],
-
   propTypes: {
     leakPeriodIndex: React.PropTypes.string.isRequired
   },
 
+  mixins: [CoverageSelectionMixin],
+
   getInitialState() {
     return {
       ready: false,
index 0ae35795ccb947df8e4ec73e3bfc289a10035f3c..683d23f52706bed996be075abee8377bceafaa53 100644 (file)
@@ -9,13 +9,13 @@ import { LanguageDistribution } from '../components/language-distribution';
 
 
 export const GeneralSize = React.createClass({
-  mixins: [TooltipsMixin, DomainMixin],
-
   propTypes: {
     leakPeriodLabel: React.PropTypes.string,
     leakPeriodDate: React.PropTypes.object
   },
 
+  mixins: [TooltipsMixin, DomainMixin],
+
   renderLeak () {
     if (!this.hasLeakPeriod()) {
       return null;
index 9f6bdbf12d0fac9f4800fbc2aaa4fc3c4290dcc4..547d5fe696b246523c96acc8fd3a7641b275ab92 100644 (file)
@@ -38,7 +38,11 @@ export default React.createClass({
             <button className="search-box-submit button-clean">
               <i className="icon-search"></i>
             </button>
-            <input onChange={this.search} ref="input" className="search-box-input" type="search" placeholder="Search"/>
+            <input onChange={this.search}
+                   ref="input"
+                   className="search-box-input"
+                   type="search"
+                   placeholder="Search"/>
           </form>
         </div>
     );
index 02b7229421a70f55ed6463e9cc3ca5eb889846d3..c07450d93ca66e1968202283c015ed9795af1bac 100644 (file)
@@ -105,8 +105,12 @@ export default React.createClass({
                   <button className="search-box-submit button-clean">
                     <i className="icon-search"></i>
                   </button>
-                  <input onChange={this.search} value={this.props.query} ref="input" className="search-box-input"
-                         type="search" placeholder="Search"/>
+                  <input onChange={this.search}
+                         value={this.props.query}
+                         ref="input"
+                         className="search-box-input"
+                         type="search"
+                         placeholder="Search"/>
                 </form>
               </td>
               <td className="thin text-middle">
index 761ae960c65386c3d4c756fa8e2187b3a84a5492..6b95a6ec42cebe8ae806e094036724c739894a26 100644 (file)
@@ -5,8 +5,6 @@ import { ResizeMixin } from './../mixins/resize-mixin';
 import { TooltipsMixin } from './../mixins/tooltips-mixin';
 
 export const BarChart = React.createClass({
-  mixins: [ResizeMixin, TooltipsMixin],
-
   propTypes: {
     data: React.PropTypes.arrayOf(React.PropTypes.object).isRequired,
     xTicks: React.PropTypes.arrayOf(React.PropTypes.any),
@@ -16,6 +14,8 @@ export const BarChart = React.createClass({
     barsWidth: React.PropTypes.number
   },
 
+  mixins: [ResizeMixin, TooltipsMixin],
+
   getDefaultProps() {
     return {
       xTicks: [],
@@ -43,7 +43,12 @@ export const BarChart = React.createClass({
         tooltipAtts['title'] = d.tooltip;
         tooltipAtts['data-toggle'] = 'tooltip';
       }
-      return <text key={index} className="bar-chart-tick" x={x} y={y} dy="1.5em" {...tooltipAtts}>{tick}</text>;
+      return <text key={index}
+                   className="bar-chart-tick"
+                   x={x}
+                   y={y}
+                   dy="1.5em"
+                   {...tooltipAtts}>{tick}</text>;
     });
     return <g>{ticks}</g>;
   },
@@ -62,7 +67,12 @@ export const BarChart = React.createClass({
         tooltipAtts['title'] = d.tooltip;
         tooltipAtts['data-toggle'] = 'tooltip';
       }
-      return <text key={index} className="bar-chart-tick" x={x} y={y} dy="-1em" {...tooltipAtts}>{value}</text>;
+      return <text key={index}
+                   className="bar-chart-tick"
+                   x={x}
+                   y={y}
+                   dy="-1em"
+                   {...tooltipAtts}>{value}</text>;
     });
     return <g>{ticks}</g>;
   },
@@ -78,8 +88,13 @@ export const BarChart = React.createClass({
         tooltipAtts['title'] = d.tooltip;
         tooltipAtts['data-toggle'] = 'tooltip';
       }
-      return <rect key={index} className="bar-chart-bar" {...tooltipAtts}
-                   x={x} y={y} width={this.props.barsWidth} height={height}/>;
+      return <rect key={index}
+                   className="bar-chart-bar"
+                   {...tooltipAtts}
+                   x={x}
+                   y={y}
+                   width={this.props.barsWidth}
+                   height={height}/>;
     });
     return <g>{bars}</g>;
   },
index ab1d18333581c9f2b11fdd993c0c0b3744b66c25..270bec31d1255fcac9931997488289fdb7cb683e 100644 (file)
@@ -37,8 +37,6 @@ export const Bubble = React.createClass({
 
 
 export const BubbleChart = React.createClass({
-  mixins: [ResizeMixin, TooltipsMixin],
-
   propTypes: {
     items: React.PropTypes.arrayOf(React.PropTypes.object).isRequired,
     sizeRange: React.PropTypes.arrayOf(React.PropTypes.number),
@@ -52,6 +50,8 @@ export const BubbleChart = React.createClass({
     formatYTick: React.PropTypes.func
   },
 
+  mixins: [ResizeMixin, TooltipsMixin],
+
   getDefaultProps() {
     return {
       sizeRange: [5, 45],
@@ -94,7 +94,12 @@ export const BubbleChart = React.createClass({
       let x = xScale(tick);
       let y1 = yScale.range()[0];
       let y2 = yScale.range()[1];
-      return <line key={index} x1={x} x2={x} y1={y1} y2={y2} className="bubble-chart-grid"/>;
+      return <line key={index}
+                   x1={x}
+                   x2={x}
+                   y1={y1}
+                   y2={y2}
+                   className="bubble-chart-grid"/>;
     });
 
     return <g ref="xGrid">{lines}</g>;
@@ -109,7 +114,12 @@ export const BubbleChart = React.createClass({
       let y = yScale(tick);
       let x1 = xScale.range()[0];
       let x2 = xScale.range()[1];
-      return <line key={index} x1={x1} x2={x2} y1={y} y2={y} className="bubble-chart-grid"/>;
+      return <line key={index}
+                   x1={x1}
+                   x2={x2}
+                   y1={y}
+                   y2={y}
+                   className="bubble-chart-grid"/>;
     });
 
     return <g ref="yGrid">{lines}</g>;
@@ -123,8 +133,12 @@ export const BubbleChart = React.createClass({
     let ticks = xScale.ticks().map((tick, index) => {
       let x = xScale(tick);
       let y = yScale.range()[0];
-      let text = this.props.formatXTick(tick);
-      return <text key={index} className="bubble-chart-tick" x={x} y={y} dy="1.5em">{text}</text>;
+      let innerText = this.props.formatXTick(tick);
+      return <text key={index}
+                   className="bubble-chart-tick"
+                   x={x}
+                   y={y}
+                   dy="1.5em">{innerText}</text>;
     });
 
     return <g>{ticks}</g>;
@@ -138,9 +152,13 @@ export const BubbleChart = React.createClass({
     let ticks = yScale.ticks(5).map((tick, index) => {
       let x = xScale.range()[0];
       let y = yScale(tick);
-      let text = this.props.formatYTick(tick);
-      return <text key={index} className="bubble-chart-tick bubble-chart-tick-y"
-                   x={x} y={y} dx="-0.5em" dy="0.3em">{text}</text>;
+      let innerText = this.props.formatYTick(tick);
+      return <text key={index}
+                   className="bubble-chart-tick bubble-chart-tick-y"
+                   x={x}
+                   y={y}
+                   dx="-0.5em"
+                   dy="0.3em">{innerText}</text>;
     });
 
     return <g>{ticks}</g>;
index b54597dd208736f076a959ef18d298fbdd3f0f92..de07bd6f1693b4c336fbb5610e132bb984c49f1f 100644 (file)
@@ -16,12 +16,12 @@ const Sector = React.createClass({
 
 
 export const DonutChart = React.createClass({
-  mixins: [ResizeMixin, TooltipsMixin],
-
   propTypes: {
     data: React.PropTypes.arrayOf(React.PropTypes.object).isRequired
   },
 
+  mixins: [ResizeMixin, TooltipsMixin],
+
   getDefaultProps() {
     return { thickness: 6, padding: [0, 0, 0, 0] };
   },
@@ -45,7 +45,11 @@ export const DonutChart = React.createClass({
         .sort(null)
         .value(d => d.value);
     let sectors = pie(this.props.data).map((d, i) => {
-      return <Sector key={i} data={d} radius={radius} fill={this.props.data[i].fill} thickness={this.props.thickness}/>;
+      return <Sector key={i}
+                     data={d}
+                     radius={radius}
+                     fill={this.props.data[i].fill}
+                     thickness={this.props.thickness}/>;
     });
 
     return <svg className="donut-chart" width={this.state.width} height={this.state.height}>
index 0843e76126ab53844aff5d72ed814bab26ea5dc3..ffac187583c92327c21ee485d9bff38655d9caa2 100644 (file)
@@ -5,8 +5,6 @@ import { ResizeMixin } from './../mixins/resize-mixin';
 import { TooltipsMixin } from './../mixins/tooltips-mixin';
 
 export const Histogram = React.createClass({
-  mixins: [ResizeMixin, TooltipsMixin],
-
   propTypes: {
     data: React.PropTypes.arrayOf(React.PropTypes.object).isRequired,
     yTicks: React.PropTypes.arrayOf(React.PropTypes.any),
@@ -18,6 +16,8 @@ export const Histogram = React.createClass({
     onBarClick: React.PropTypes.func
   },
 
+  mixins: [ResizeMixin, TooltipsMixin],
+
   getDefaultProps() {
     return {
       xTicks: [],
index 375931ea9f5c34a652dbebea363186f97e521a56..e4f66c7c9c8c4ba83b5395339237d559527e3863 100644 (file)
@@ -6,8 +6,6 @@ import { TooltipsMixin } from './../mixins/tooltips-mixin';
 
 
 export const LineChart = React.createClass({
-  mixins: [ResizeMixin, TooltipsMixin],
-
   propTypes: {
     data: React.PropTypes.arrayOf(React.PropTypes.object).isRequired,
     xTicks: React.PropTypes.arrayOf(React.PropTypes.any),
@@ -21,6 +19,8 @@ export const LineChart = React.createClass({
     interpolate: React.PropTypes.string
   },
 
+  mixins: [ResizeMixin, TooltipsMixin],
+
   getDefaultProps() {
     return {
       displayBackdrop: true,
@@ -63,7 +63,11 @@ export const LineChart = React.createClass({
     let points = this.props.data.map((point, index) => {
       let x = xScale(point.x);
       let y = yScale(point.y);
-      return <circle key={index} className="line-chart-point" r="3" cx={x} cy={y}/>;
+      return <circle key={index}
+                     className="line-chart-point"
+                     r="3"
+                     cx={x}
+                     cy={y}/>;
     });
     return <g>{points}</g>;
   },
@@ -76,7 +80,12 @@ export const LineChart = React.createClass({
       let x = xScale(point.x);
       let y1 = yScale.range()[0];
       let y2 = yScale(point.y);
-      return <line key={index} className="line-chart-grid" x1={x} x2={x} y1={y1} y2={y2}/>;
+      return <line key={index}
+                   className="line-chart-grid"
+                   x1={x}
+                   x2={x}
+                   y1={y1}
+                   y2={y2}/>;
     });
     return <g>{lines}</g>;
   },
@@ -89,7 +98,11 @@ export const LineChart = React.createClass({
       let point = this.props.data[index];
       let x = xScale(point.x);
       let y = yScale.range()[0];
-      return <text key={index} className="line-chart-tick" x={x} y={y} dy="1.5em">{tick}</text>;
+      return <text key={index}
+                   className="line-chart-tick"
+                   x={x}
+                   y={y}
+                   dy="1.5em">{tick}</text>;
     });
     return <g>{ticks}</g>;
   },
@@ -102,18 +115,22 @@ export const LineChart = React.createClass({
       let point = this.props.data[index];
       let x = xScale(point.x);
       let y = yScale(point.y);
-      return <text key={index} className="line-chart-tick" x={x} y={y} dy="-1em">{value}</text>;
+      return <text key={index}
+                   className="line-chart-tick"
+                   x={x}
+                   y={y}
+                   dy="-1em">{value}</text>;
     });
     return <g>{ticks}</g>;
   },
 
   renderLine (xScale, yScale) {
-    let path = d3.svg.line()
+    let p = d3.svg.line()
                  .x(d => xScale(d.x))
                  .y(d => yScale(d.y))
                  .interpolate(this.props.interpolate);
 
-    return <path className="line-chart-path" d={path(this.props.data)}/>;
+    return <path className="line-chart-path" d={p(this.props.data)}/>;
   },
 
   render () {
index f06eda570d0b292fd8d8464235c10a7249aad130..ad8519481134d54b0690a81edf4b8ba190c5ecc2 100644 (file)
@@ -48,7 +48,7 @@ export const TreemapRect = React.createClass({
     return <a onClick={e => e.stopPropagation()}
               className="treemap-link"
               href={this.props.link}
-              style={{ fontSize: 12 }}><i className="icon-link"/></a>;
+              style={{ fontSize: 12 }}><span className="icon-link"/></a>;
   },
 
   render () {
@@ -70,7 +70,10 @@ export const TreemapRect = React.createClass({
       cursor: typeof this.props.onClick === 'function' ? 'pointer' : 'default'
     };
     let isTextVisible = this.props.width >= 40 && this.props.height >= 40;
-    return <div className="treemap-cell" {...tooltipAttrs} style={cellStyles} onClick={this.props.onClick}>
+    return <div className="treemap-cell"
+                {...tooltipAttrs}
+                style={cellStyles}
+                onClick={this.props.onClick}>
       <div className="treemap-inner" dangerouslySetInnerHTML={{ __html: this.props.label }}
            style={{ maxWidth: this.props.width, visibility: isTextVisible ? 'visible': 'hidden' }}/>
       {this.renderLink()}
@@ -80,14 +83,14 @@ export const TreemapRect = React.createClass({
 
 
 export const Treemap = React.createClass({
-  mixins: [ResizeMixin, TooltipsMixin],
-
   propTypes: {
     items: React.PropTypes.arrayOf(React.PropTypes.object).isRequired,
     height: React.PropTypes.number,
     onRectangleClick: React.PropTypes.func
   },
 
+  mixins: [ResizeMixin, TooltipsMixin],
+
   getInitialState() {
     return { width: this.props.width, height: this.props.height };
   },
index 1edbc2274ecc2cb08fcc863076c21ef2e235ecb3..3744d3fa6de09bebe7f4bfcc4f9232be9cda5350 100644 (file)
@@ -26,13 +26,13 @@ export const Word = React.createClass({
 
 
 export const WordCloud = React.createClass({
-  mixins: [TooltipsMixin],
-
   propTypes: {
     items: React.PropTypes.arrayOf(React.PropTypes.object).isRequired,
     sizeRange: React.PropTypes.arrayOf(React.PropTypes.number)
   },
 
+  mixins: [TooltipsMixin],
+
   getDefaultProps() {
     return {
       sizeRange: [10, 24]
index 5060e088a0021812bf5726958ca8dd87e52e92e7..6178343a7f78a72ede2a11310dd416a4b6533106 100644 (file)
@@ -16,6 +16,10 @@ export default React.createClass({
     const url = ('' + window.SS.lf.gravatarServerUrl)
             .replace('{EMAIL_MD5}', emailHash)
             .replace('{SIZE}', this.props.size * 2);
-    return <img className="rounded" src={url} width={this.props.size} height={this.props.size} alt={this.props.email}/>;
+    return <img className="rounded"
+                src={url}
+                width={this.props.size} 
+                height={this.props.size}
+                alt={this.props.email}/>;
   }
 });
index eca4026c69f97b9bcf1cdc56c4af025a4537a28d..126a486fcae81b380ba0eb7da56b066989237281 100644 (file)
@@ -22,8 +22,13 @@ export default React.createClass({
     let htmlId = this.props.name + '__' + option.value;
     return (
         <li key={option.value}>
-          <input onChange={this.onChange} type="radio" name={this.props.name} value={option.value} id={htmlId}
-                 checked={checked} disabled={this.props.disabled}/>
+          <input onChange={this.onChange}
+                 type="radio"
+                 name={this.props.name}
+                 value={option.value}
+                 id={htmlId}
+                 checked={checked}
+                 disabled={this.props.disabled}/>
           <label htmlFor={htmlId}>{option.label}</label>
         </li>
     );
index 1860d5eaf2ab70966162c79588f0b15b71d11207..1421220263f21bdbe29312b5d9410768e846ebf0 100644 (file)
@@ -6,7 +6,11 @@ export default React.createClass({
         width = this.props.logoWidth || 100,
         height = 30,
         title = window.t('layout.sonar.slogan');
-    return <img src={url} width={width} height={height} alt={title} title={title}/>;
+    return <img src={url}
+                width={width}
+                height={height}
+                alt={title} 
+                title={title}/>;
   },
 
   render() {