import { TooltipsMixin } from '../../../components/mixins/tooltips-mixin';
import { getMetricName } from '../helpers/metrics';
import { formatMeasure } from '../../../helpers/measures';
-import { translate } from '../../../helpers/l10n';
+import { translate, translateWithParameters } from '../../../helpers/l10n';
export const CodeSmells = React.createClass({
return null;
}
+ 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;
<IssuesLink
component={this.props.component.key}
params={{ resolved: 'false', createdAfter, types: 'CODE_SMELL', facetMode: 'debt' }}>
- {formatMeasure(newDebt, 'SHORT_WORK_DUR')}
+ <span
+ title={translateWithParameters('widget.as_calculated_on_x', formattedSnapshotDate)}
+ data-toggle="tooltip">
+ {formatMeasure(newDebt, 'SHORT_WORK_DUR')}
+ </span>
</IssuesLink>
</Measure>
<Measure label={getMetricName('new_code_smells')}>
<IssuesLink
component={this.props.component.key}
params={{ resolved: 'false', types: 'CODE_SMELL', createdAfter }}>
- {formatMeasure(newCodeSmells, 'SHORT_INT')}
+ <span
+ title={translateWithParameters('widget.as_calculated_on_x', formattedSnapshotDate)}
+ data-toggle="tooltip">
+ {formatMeasure(newCodeSmells, 'SHORT_INT')}
+ </span>
</IssuesLink>
</Measure>
</MeasuresList>
render () {
const debt = this.props.measures['sqale_index'] || 0;
const codeSmells = this.props.measures['code_smells'] || 0;
+ const { snapshotDate } = this.props.component;
+ const formattedSnapshotDate = moment(snapshotDate).format('LLL');
return <Domain>
<DomainHeader component={this.props.component}
<Measure composite={true}>
<div className="display-inline-block text-middle big-spacer-right">
- <div className="overview-domain-measure-value">
+ <div
+ className="overview-domain-measure-value"
+ title={translateWithParameters('widget.as_calculated_on_x', formattedSnapshotDate)}
+ data-toggle="tooltip">
<DrilldownLink component={this.props.component.key} metric="sqale_rating">
<Rating value={this.props.measures['sqale_rating']}/>
</DrilldownLink>
</div>
</div>
<div className="display-inline-block text-middle">
- <div className="overview-domain-measure-value">
+ <div
+ 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' }}>
<IssuesLink
component={this.props.component.key}
params={{ resolved: 'false', types: 'CODE_SMELL' }}>
- {formatMeasure(codeSmells, 'SHORT_INT')}
+ <span
+ title={translateWithParameters('widget.as_calculated_on_x', formattedSnapshotDate)}
+ data-toggle="tooltip">
+ {formatMeasure(codeSmells, 'SHORT_INT')}
+ </span>
</IssuesLink>
</Measure>
</MeasuresList>
import { CoverageSelectionMixin } from '../components/coverage-selection-mixin';
import { getPeriodLabel, getPeriodDate } from './../helpers/periods';
import { getMeasures } from '../../../api/measures';
-import { getFacet } from '../../../api/issues';
import { getTimeMachineData } from '../../../api/time-machine';
'sqale_index',
'new_technical_debt',
+ 'code_smells',
+ 'new_code_smells',
'sqale_rating',
'reliability_rating',
- 'security_rating'
+ 'bugs',
+ 'new_bugs',
+ 'security_rating',
+ 'vulnerabilities',
+ 'new_vulnerabilities'
];
const HISTORY_METRICS_LIST = [
},
componentDidMount() {
- Promise.all([
- this.requestMeasures(),
- this.requestIssues(),
- this.requestNewIssues()
- ]).then(responses => {
- const measures = this.getMeasuresValues(responses[0]);
- const typesFacet = responses[1];
- measures['code_smells'] = this.getFacetCount(typesFacet, 'CODE_SMELL');
- measures['bugs'] = this.getFacetCount(typesFacet, 'BUG');
- measures['vulnerabilities'] = this.getFacetCount(typesFacet, 'VULNERABILITY');
+ this.requestMeasures().then(r => {
+ const measures = this.getMeasuresValues(r);
let leak;
if (this.state.leakPeriodDate) {
- const newTypesFacet = responses[2];
- leak = this.getMeasuresValues(responses[0], Number(this.props.leakPeriodIndex));
- leak['new_code_smells'] = this.getFacetCount(newTypesFacet, 'CODE_SMELL');
- leak['new_bugs'] = this.getFacetCount(newTypesFacet, 'BUG');
- leak['new_vulnerabilities'] = this.getFacetCount(newTypesFacet, 'VULNERABILITY');
+ leak = this.getMeasuresValues(r, Number(this.props.leakPeriodIndex));
}
this.setState({
return values;
},
- requestIssues (criteria = {}) {
- const { component } = this.props;
- const query = {
- componentUuids: component.id,
- resolved: false,
- ...criteria
- };
- return getFacet(query, 'types').then(r => r.facet);
- },
-
- requestNewIssues () {
- const { leakPeriodDate } = this.state;
-
- if (!leakPeriodDate) {
- return Promise.resolve();
- }
-
- const createdAfter = moment(leakPeriodDate).format('YYYY-MM-DDTHH:mm:ssZZ');
- return this.requestIssues({ createdAfter });
- },
-
- getFacetCount (facet, value) {
- return facet.find(item => item.val === value).count;
- },
-
requestHistory () {
const coverageMetric = this.state.coverageMetricPrefix + 'coverage';
const metrics = [].concat(HISTORY_METRICS_LIST, coverageMetric).join(',');
import { Legend } from '../components/legend';
import { getMetricName } from '../helpers/metrics';
import { formatMeasure } from '../../../helpers/measures';
-import { translate } from '../../../helpers/l10n';
+import { translate, translateWithParameters } from '../../../helpers/l10n';
export const Risk = React.createClass({
return null;
}
+ 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;
<IssuesLink
component={this.props.component.key}
params={{ resolved: 'false', types: 'BUG', createdAfter }}>
- {formatMeasure(newBugs, 'SHORT_INT')}
+ <span
+ title={translateWithParameters('widget.as_calculated_on_x', formattedSnapshotDate)}
+ data-toggle="tooltip">
+ {formatMeasure(newBugs, 'SHORT_INT')}
+ </span>
</IssuesLink>
</Measure>
<Measure label={getMetricName('new_vulnerabilities')}>
<IssuesLink
component={this.props.component.key}
params={{ resolved: 'false', types: 'VULNERABILITY', createdAfter }}>
- {formatMeasure(newVulnerabilities, 'SHORT_INT')}
+ <span
+ title={translateWithParameters('widget.as_calculated_on_x', formattedSnapshotDate)}
+ data-toggle="tooltip">
+ {formatMeasure(newVulnerabilities, 'SHORT_INT')}
+ </span>
</IssuesLink>
</Measure>
</MeasuresList>
},
render () {
+ const { snapshotDate } = this.props.component;
+ const formattedSnapshotDate = moment(snapshotDate).format('LLL');
const bugs = this.props.measures['bugs'] || 0;
const vulnerabilities = this.props.measures['vulnerabilities'] || 0;
<Measure composite={true}>
<div className="display-inline-block text-middle big-spacer-right">
- <div className="overview-domain-measure-value">
+ <div
+ className="overview-domain-measure-value"
+ title={translateWithParameters('widget.as_calculated_on_x', formattedSnapshotDate)}
+ data-toggle="tooltip">
<DrilldownLink component={this.props.component.key} metric="reliability_rating">
<Rating value={this.props.measures['reliability_rating']}/>
</DrilldownLink>
<IssuesLink
component={this.props.component.key}
params={{ resolved: 'false', types: 'BUG' }}>
- {formatMeasure(bugs, 'SHORT_INT')}
+ <span
+ title={translateWithParameters('widget.as_calculated_on_x', formattedSnapshotDate)}
+ data-toggle="tooltip">
+ {formatMeasure(bugs, 'SHORT_INT')}
+ </span>
</IssuesLink>
</div>
<div className="overview-domain-measure-label">{getMetricName('bugs')}</div>
<Measure composite={true}>
<div className="display-inline-block text-middle big-spacer-right">
- <div className="overview-domain-measure-value">
+ <div
+ className="overview-domain-measure-value"
+ title={translateWithParameters('widget.as_calculated_on_x', formattedSnapshotDate)}
+ data-toggle="tooltip">
<DrilldownLink component={this.props.component.key} metric="security_rating">
<Rating value={this.props.measures['security_rating']}/>
</DrilldownLink>
<IssuesLink
component={this.props.component.key}
params={{ resolved: 'false', types: 'VULNERABILITY' }}>
- {formatMeasure(vulnerabilities, 'SHORT_INT')}
+ <span
+ title={translateWithParameters('widget.as_calculated_on_x', formattedSnapshotDate)}
+ data-toggle="tooltip">
+ {formatMeasure(vulnerabilities, 'SHORT_INT')}
+ </span>
</IssuesLink>
</div>
<div className="overview-domain-measure-label">{getMetricName('vulnerabilities')}</div>
key: navResponse.component.key,
name: navResponse.component.name,
qualifier: _.last(navResponse.component.breadcrumbs).qualifier,
- breadcrumbs: navResponse.component.breadcrumbs
+ breadcrumbs: navResponse.component.breadcrumbs,
+ snapshotDate: navResponse.component.snapshotDate
};
}
}
overview.metric.vulnerabilities=Vulnerabilities
overview.metric.new_vulnerabilities=New Vulnerabilities
overview.metric.issues=Issues
-overview.metric.effort=Effort
+overview.metric.effort=Debt
overview.metric.new_issues=New Issues
-overview.metric.new_effort=New Effort
+overview.metric.new_effort=New Debt
overview.metric.coverage=Coverage
overview.metric.tests=Tests
overview.metric.new_coverage=Coverage on New Code