]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-6158 On a project Issues page, it should be possible to easily select the Leak...
authorStas Vilchik <vilchiks@gmail.com>
Fri, 25 Mar 2016 15:10:52 +0000 (16:10 +0100)
committerStas Vilchik <vilchiks@gmail.com>
Fri, 25 Mar 2016 15:10:52 +0000 (16:10 +0100)
server/sonar-web/src/main/js/apps/issues/facets/creation-date-facet.js
server/sonar-web/src/main/js/apps/issues/models/state.js
server/sonar-web/src/main/js/apps/issues/templates/facets/issues-creation-date-facet.hbs
server/sonar-web/src/main/js/apps/overview/main/code-smells.js
server/sonar-web/src/main/js/apps/overview/main/risk.js

index f2fdce3cbf5b2ae785e4313172e23331d5801833..95f22a4cd713b786c7d038ccfbbf9647f72b43ea 100644 (file)
@@ -37,7 +37,8 @@ export default BaseFacet.extend({
       'click .js-all': 'onAllClick',
       'click .js-last-week': 'onLastWeekClick',
       'click .js-last-month': 'onLastMonthClick',
-      'click .js-last-year': 'onLastYearClick'
+      'click .js-last-year': 'onLastYearClick',
+      'click .js-leak': 'onLeakClick'
     });
   },
 
@@ -98,6 +99,7 @@ export default BaseFacet.extend({
       createdAfter: null,
       createdBefore: null,
       createdAt: null,
+      sinceLeakPeriod: null,
       createdInLast: null
     });
   },
@@ -109,6 +111,7 @@ export default BaseFacet.extend({
       createdAfter: periodStart,
       createdBefore: periodEnd,
       createdAt: null,
+      sinceLeakPeriod: null,
       createdInLast: null
     });
   },
@@ -118,6 +121,7 @@ export default BaseFacet.extend({
       createdAfter: null,
       createdBefore: null,
       createdAt: null,
+      sinceLeakPeriod: null,
       createdInLast: period
     });
   },
@@ -141,11 +145,26 @@ export default BaseFacet.extend({
     return this.selectPeriod('1y');
   },
 
+  onLeakClick (e) {
+    e.preventDefault();
+    this.options.app.state.updateFilter({
+      createdAfter: null,
+      createdBefore: null,
+      createdAt: null,
+      createdInLast: null,
+      sinceLeakPeriod: 'true'
+    });
+  },
+
   serializeData () {
+    const hasLeak = this.options.app.state.get('contextComponentQualifier') === 'TRK';
+
     return _.extend(BaseFacet.prototype.serializeData.apply(this, arguments), {
+      hasLeak,
       periodStart: this.options.app.state.get('query').createdAfter,
       periodEnd: this.options.app.state.get('query').createdBefore,
       createdAt: this.options.app.state.get('query').createdAt,
+      sinceLeakPeriod: this.options.app.state.get('query').sinceLeakPeriod,
       createdInLast: this.options.app.state.get('query').createdInLast
     });
   }
index 049f657f1211eeff5bb47b3438907abd834a5739..623ce85bdcf2131b55ba97b2bc400ef472ef8316 100644 (file)
@@ -68,6 +68,7 @@ export default State.extend({
       'assigned': 'assignees',
       'createdBefore': 'createdAt',
       'createdAfter': 'createdAt',
+      'sinceLeakPeriod': 'createdAt',
       'createdInLast': 'createdAt'
     }
   },
index a119faca85d26935af42a10b6945992a89cfd6f3..bf5410833c9b1b1984f5c3c644e38b9685f99a5e 100644 (file)
     <div class="spacer-top">
       <span class="spacer-right">{{t "issues.facet.createdAt.or"}}</span>
       <a class="js-all spacer-right" href="#">{{t "issues.facet.createdAt.all"}}</a>
-      <a class="js-last-week spacer-right {{#eq createdInLast "1w"}}active-link{{/eq}}" href="#">{{t "issues.facet.createdAt.last_week"}}</a>
-      <a class="js-last-month spacer-right {{#eq createdInLast "1m"}}active-link{{/eq}}" href="#">{{t "issues.facet.createdAt.last_month"}}</a>
-      <a class="js-last-year {{#eq createdInLast "1y"}}active-link{{/eq}}" href="#">{{t "issues.facet.createdAt.last_year"}}</a>
+      {{#if hasLeak}}
+        <a class="js-leak spacer-right {{#eq sinceLeakPeriod "true"}}active-link{{/eq}}" href="#">Leak Period</a>
+      {{else}}
+        <a class="js-last-week spacer-right {{#eq createdInLast "1w"}}active-link{{/eq}}" href="#">
+          {{t "issues.facet.createdAt.last_week"}}
+        </a>
+        <a class="js-last-month spacer-right {{#eq createdInLast "1m"}}active-link{{/eq}}" href="#">
+          {{t "issues.facet.createdAt.last_month"}}
+        </a>
+        <a class="js-last-year {{#eq createdInLast "1y"}}active-link{{/eq}}" href="#">
+          {{t "issues.facet.createdAt.last_year"}}
+        </a>
+      {{/if}}
     </div>
   </div>
 {{/if}}
index 319f99095287ea9781f8e67cfa2709270e820f1d..ff53578e60d24e744b4beae38da3e0bac5d616f6 100644 (file)
@@ -54,27 +54,24 @@ export const CodeSmells = React.createClass({
 
     const { snapshotDate } = this.props.component;
     const formattedSnapshotDate = moment(snapshotDate).format('LLL');
-    const createdAfter = moment(this.props.leakPeriodDate).format('YYYY-MM-DDTHH:mm:ssZZ');
     const newDebt = this.props.leak['new_technical_debt'] || 0;
     const newCodeSmells = this.props.leak['new_code_smells'] || 0;
 
     return <DomainLeak>
       <MeasuresList>
         <Measure label={getMetricName('new_effort')}>
-          <IssuesLink
-              component={this.props.component.key}
-              params={{ resolved: 'false', createdAfter, types: 'CODE_SMELL', facetMode: 'debt' }}>
+          <DrilldownLink component={this.props.component.key} metric="new_technical_debt">
             <span
                 title={translateWithParameters('widget.as_calculated_on_x', formattedSnapshotDate)}
                 data-toggle="tooltip">
               {formatMeasure(newDebt, 'SHORT_WORK_DUR')}
             </span>
-          </IssuesLink>
+          </DrilldownLink>
         </Measure>
         <Measure label={getMetricName('new_code_smells')}>
           <IssuesLink
               component={this.props.component.key}
-              params={{ resolved: 'false', types: 'CODE_SMELL', createdAfter }}>
+              params={{ resolved: 'false', types: 'CODE_SMELL', sinceLeakPeriod: 'true' }}>
             <span
                 title={translateWithParameters('widget.as_calculated_on_x', formattedSnapshotDate)}
                 data-toggle="tooltip">
@@ -117,11 +114,9 @@ export const CodeSmells = React.createClass({
                     className="overview-domain-measure-value"
                     title={translateWithParameters('widget.as_calculated_on_x', formattedSnapshotDate)}
                     data-toggle="tooltip">
-                  <IssuesLink
-                      component={this.props.component.key}
-                      params={{ resolved: 'false', types: 'CODE_SMELL', facetMode: 'debt' }}>
+                  <DrilldownLink component={this.props.component.key} metric="sqale_index">
                     {formatMeasure(debt, 'SHORT_WORK_DUR')}
-                  </IssuesLink>
+                  </DrilldownLink>
                 </div>
                 <div className="overview-domain-measure-label">{getMetricName('effort')}</div>
               </div>
index 122162d731202cab176a5fad820ff702504f2767..c732299dfb6d582135d3c61c6a73f83c8919d764 100644 (file)
@@ -54,7 +54,6 @@ export const Risk = React.createClass({
 
     const { snapshotDate } = this.props.component;
     const formattedSnapshotDate = moment(snapshotDate).format('LLL');
-    const createdAfter = moment(this.props.leakPeriodDate).format('YYYY-MM-DDTHH:mm:ssZZ');
     const newBugs = this.props.leak['new_bugs'] || 0;
     const newVulnerabilities = this.props.leak['new_vulnerabilities'] || 0;
 
@@ -65,7 +64,7 @@ export const Risk = React.createClass({
         <Measure label={getMetricName('new_bugs')}>
           <IssuesLink
               component={this.props.component.key}
-              params={{ resolved: 'false', types: 'BUG', createdAfter }}>
+              params={{ resolved: 'false', types: 'BUG', sinceLeakPeriod: 'true' }}>
             <span
                 title={translateWithParameters('widget.as_calculated_on_x', formattedSnapshotDate)}
                 data-toggle="tooltip">
@@ -76,7 +75,7 @@ export const Risk = React.createClass({
         <Measure label={getMetricName('new_vulnerabilities')}>
           <IssuesLink
               component={this.props.component.key}
-              params={{ resolved: 'false', types: 'VULNERABILITY', createdAfter }}>
+              params={{ resolved: 'false', types: 'VULNERABILITY', sinceLeakPeriod: 'true' }}>
             <span
                 title={translateWithParameters('widget.as_calculated_on_x', formattedSnapshotDate)}
                 data-toggle="tooltip">