1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
|
import moment from 'moment';
import React from 'react';
import { Domain,
DomainHeader,
DomainPanel,
DomainNutshell,
DomainLeak,
MeasuresList,
Measure,
DomainMixin } from './components';
import { Rating } from './../../../components/shared/rating';
import { IssuesLink } from '../../../components/shared/issues-link';
import { DrilldownLink } from '../../../components/shared/drilldown-link';
import { TooltipsMixin } from '../../../components/mixins/tooltips-mixin';
import { Legend } from '../components/legend';
import { getMetricName } from '../helpers/metrics';
import { formatMeasure } from '../../../helpers/measures';
export const GeneralDebt = React.createClass({
propTypes: {
leakPeriodLabel: React.PropTypes.string,
leakPeriodDate: React.PropTypes.object
},
mixins: [TooltipsMixin, DomainMixin],
renderLeak () {
if (!this.hasLeakPeriod()) {
return null;
}
let createdAfter = moment(this.props.leakPeriodDate).format('YYYY-MM-DDTHH:mm:ssZZ');
return <DomainLeak>
<Legend leakPeriodLabel={this.props.leakPeriodLabel} leakPeriodDate={this.props.leakPeriodDate}/>
<MeasuresList>
<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>;
},
render () {
return <Domain>
<DomainHeader component={this.props.component}
title={window.t('overview.domain.debt')}
linkTo="/debt"/>
<DomainPanel>
<DomainNutshell>
<MeasuresList>
<Measure composite={true}>
<div className="display-inline-block text-middle big-spacer-right">
<div className="overview-domain-measure-value">
<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">
<IssuesLink component={this.props.component.key}
params={{ resolved: 'false', facetMode: 'debt' }}>
{formatMeasure(this.props.measures.debt, 'SHORT_WORK_DUR')}
</IssuesLink>
</div>
<div className="overview-domain-measure-label">{getMetricName('debt')}</div>
</div>
</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', true)}
</DomainNutshell>
{this.renderLeak()}
</DomainPanel>
</Domain>;
}
});
|