From: Stas Vilchik Date: Fri, 25 Mar 2016 15:10:52 +0000 (+0100) Subject: SONAR-6158 On a project Issues page, it should be possible to easily select the Leak... X-Git-Tag: 5.5-M12~72 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=1ed6c9b4d45b84522c46d781c185bbe21dd42543;p=sonarqube.git SONAR-6158 On a project Issues page, it should be possible to easily select the Leak period to filter new issues --- diff --git a/server/sonar-web/src/main/js/apps/issues/facets/creation-date-facet.js b/server/sonar-web/src/main/js/apps/issues/facets/creation-date-facet.js index f2fdce3cbf5..95f22a4cd71 100644 --- a/server/sonar-web/src/main/js/apps/issues/facets/creation-date-facet.js +++ b/server/sonar-web/src/main/js/apps/issues/facets/creation-date-facet.js @@ -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 }); } diff --git a/server/sonar-web/src/main/js/apps/issues/models/state.js b/server/sonar-web/src/main/js/apps/issues/models/state.js index 049f657f121..623ce85bdcf 100644 --- a/server/sonar-web/src/main/js/apps/issues/models/state.js +++ b/server/sonar-web/src/main/js/apps/issues/models/state.js @@ -68,6 +68,7 @@ export default State.extend({ 'assigned': 'assignees', 'createdBefore': 'createdAt', 'createdAfter': 'createdAt', + 'sinceLeakPeriod': 'createdAt', 'createdInLast': 'createdAt' } }, diff --git a/server/sonar-web/src/main/js/apps/issues/templates/facets/issues-creation-date-facet.hbs b/server/sonar-web/src/main/js/apps/issues/templates/facets/issues-creation-date-facet.hbs index a119faca85d..bf5410833c9 100644 --- a/server/sonar-web/src/main/js/apps/issues/templates/facets/issues-creation-date-facet.hbs +++ b/server/sonar-web/src/main/js/apps/issues/templates/facets/issues-creation-date-facet.hbs @@ -24,9 +24,19 @@
{{t "issues.facet.createdAt.or"}} {{t "issues.facet.createdAt.all"}} - {{t "issues.facet.createdAt.last_week"}} - {{t "issues.facet.createdAt.last_month"}} - {{t "issues.facet.createdAt.last_year"}} + {{#if hasLeak}} + Leak Period + {{else}} + + {{t "issues.facet.createdAt.last_week"}} + + + {{t "issues.facet.createdAt.last_month"}} + + + {{t "issues.facet.createdAt.last_year"}} + + {{/if}}
{{/if}} diff --git a/server/sonar-web/src/main/js/apps/overview/main/code-smells.js b/server/sonar-web/src/main/js/apps/overview/main/code-smells.js index 319f9909528..ff53578e60d 100644 --- a/server/sonar-web/src/main/js/apps/overview/main/code-smells.js +++ b/server/sonar-web/src/main/js/apps/overview/main/code-smells.js @@ -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 - + {formatMeasure(newDebt, 'SHORT_WORK_DUR')} - + + params={{ resolved: 'false', types: 'CODE_SMELL', sinceLeakPeriod: 'true' }}> @@ -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"> - + {formatMeasure(debt, 'SHORT_WORK_DUR')} - +
{getMetricName('effort')}
diff --git a/server/sonar-web/src/main/js/apps/overview/main/risk.js b/server/sonar-web/src/main/js/apps/overview/main/risk.js index 122162d7312..c732299dfb6 100644 --- a/server/sonar-web/src/main/js/apps/overview/main/risk.js +++ b/server/sonar-web/src/main/js/apps/overview/main/risk.js @@ -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({ + params={{ resolved: 'false', types: 'BUG', sinceLeakPeriod: 'true' }}> @@ -76,7 +75,7 @@ export const Risk = React.createClass({ + params={{ resolved: 'false', types: 'VULNERABILITY', sinceLeakPeriod: 'true' }}>