import React from 'react';
+import moment from 'moment';
import { DomainLeakTitle } from '../main/components';
export const Legend = React.createClass({
render() {
- if (!this.props.leakPeriodDate) {
- return null;
- }
- return <div className="overview-legend">
- <span className="overview-legend-leak"/>
+ return <div className="overview-legend overview-leak">
<DomainLeakTitle label={this.props.leakPeriodLabel} date={this.props.leakPeriodDate}/>
</div>;
}
import { getPeriodLabel, getPeriodDate } from './../helpers/periods';
import { TooltipsMixin } from '../../../components/mixins/tooltips-mixin';
import { filterMetrics, filterMetricsForDomains } from '../helpers/metrics';
-import { Legend } from '../components/legend';
+import { DomainLeakTitle } from '../main/components';
import { CHART_COLORS_RANGE_PERCENT } from '../../../helpers/constants';
import { CoverageMeasuresList } from '../components/coverage-measures-list';
},
renderLegend () {
- return <Legend leakPeriodDate={this.state.leakPeriodDate} leakPeriodLabel={this.state.leakPeriodLabel}/>;
+ return <DomainLeakTitle inline={true} label={this.state.leakPeriodLabel} date={this.state.leakPeriodDate}/>
},
render () {
import { getPeriodLabel, getPeriodDate } from './../helpers/periods';
import { TooltipsMixin } from '../../../components/mixins/tooltips-mixin';
import { filterMetrics, filterMetricsForDomains } from '../helpers/metrics';
-import { Legend } from '../components/legend';
import { CHART_COLORS_RANGE_PERCENT } from '../../../helpers/constants';
import { AddedRemovedMeasure, AddedRemovedDebt, OnNewCodeMeasure, SeverityMeasure } from './../components/issue-measure';
import { IssuesTags } from './../components/issues-tags';
import StatusHelper from '../../../components/shared/status-helper';
import { Rating } from '../../../components/shared/rating';
import { DrilldownLink } from '../../../components/shared/drilldown-link';
+import { DomainLeakTitle } from '../main/components';
const KNOWN_METRICS = ['violations', 'sqale_index', 'sqale_rating', 'sqale_debt_ratio', 'blocker_violations',
},
renderLegend () {
- return <Legend leakPeriodDate={this.state.leakPeriodDate} leakPeriodLabel={this.state.leakPeriodLabel}/>;
+ return <DomainLeakTitle inline={true} label={this.state.leakPeriodLabel} date={this.state.leakPeriodDate}/>
},
renderOtherMeasures() {
import { getPeriodLabel, getPeriodDate } from './../helpers/periods';
import { TooltipsMixin } from '../../../components/mixins/tooltips-mixin';
import { filterMetrics, filterMetricsForDomains } from '../helpers/metrics';
-import { Legend } from '../components/legend';
+import { DomainLeakTitle } from '../main/components';
import { CHART_COLORS_RANGE_PERCENT } from '../../../helpers/constants';
},
renderLegend () {
- return <Legend leakPeriodDate={this.state.leakPeriodDate} leakPeriodLabel={this.state.leakPeriodLabel}/>;
+ return <DomainLeakTitle inline={true} label={this.state.leakPeriodLabel} date={this.state.leakPeriodDate}/>
},
renderMeasures() {
import { getPeriodLabel, getPeriodDate } from './../helpers/periods';
import { TooltipsMixin } from '../../../components/mixins/tooltips-mixin';
import { filterMetrics, filterMetricsForDomains } from '../helpers/metrics';
-import { Legend } from '../components/legend';
+import { DomainLeakTitle } from '../main/components';
export const SizeMain = React.createClass({
},
renderLegend () {
- return <Legend leakPeriodDate={this.state.leakPeriodDate} leakPeriodLabel={this.state.leakPeriodLabel}/>;
+ return <DomainLeakTitle inline={true} label={this.state.leakPeriodLabel} date={this.state.leakPeriodDate}/>
},
renderOtherMeasures(domain, hiddenMetrics) {
import React from 'react';
import { Timeline } from './timeline';
-import { Legend } from '../components/legend';
export const Domain = React.createClass({
<div className="overview-title">
{this.props.children}
<a className="small big-spacer-left link-no-underline" href={url}>
- More <i className="icon-chevron-right" style={{ position: 'relative', top: -1 }}/></a>
+ {window.t('more')}
+ <i className="icon-chevron-right" style={{ position: 'relative', top: -1 }}/>
+ </a>
</div>
</div>;
} else {
export const DomainLeakTitle = React.createClass({
+ renderInline (tooltip, fromNow) {
+ return <span title={tooltip} data-toggle="tooltip">
+ <span>{window.tp('overview.leak_period_x', this.props.label)}</span>
+ <span className="note spacer-left">{window.tp('overview.started_x', fromNow)}</span>
+ </span>;
+ },
+
render() {
if (!this.props.label || !this.props.date) {
return null;
}
let momentDate = moment(this.props.date);
let fromNow = momentDate.fromNow();
- let tooltip = 'Started ' + fromNow + ', ' + momentDate.format('LL');
- return <span title={tooltip} data-toggle="tooltip">Water Leak: {this.props.label}</span>;
+ let tooltip = 'Started on ' + momentDate.format('LL');
+ if (this.props.inline) {
+ return this.renderInline(tooltip, fromNow);
+ }
+ return <span title={tooltip} data-toggle="tooltip">
+ <span>{window.tp('overview.leak_period_x', this.props.label)}</span>
+ <br/>
+ <span className="note">{window.tp('overview.started_x', fromNow)}</span>
+ </span>;
}
});
render () {
return <div className="overview-card-header">
<DomainTitle {...this.props}>{this.props.title}</DomainTitle>
- <Legend leakPeriodLabel={this.props.leakPeriodLabel} leakPeriodDate={this.props.leakPeriodDate}/>
</div>;
}
});
export const DomainMixin = {
- renderTimeline(range) {
+ renderTimelineStartDate() {
+ let momentDate = moment(this.props.historyStartDate),
+ fromNow = momentDate.fromNow();
+ return <span className="overview-domain-timeline-date">{window.tp('overview.started_x', fromNow)}</span>;
+ },
+
+ renderTimeline(range, displayDate) {
if (!this.props.history) {
return null;
}
props[range] = this.props.leakPeriodDate;
return <div className="overview-domain-timeline">
<Timeline {...props}/>
+ {displayDate ? this.renderTimelineStartDate(range) : null}
</div>;
},
import { DrilldownLink } from '../../../components/shared/drilldown-link';
import SeverityIcon from '../../../components/shared/severity-icon';
import { TooltipsMixin } from '../../../components/mixins/tooltips-mixin';
+import { Legend } from '../components/legend';
import { getMetricName } from '../helpers/metrics';
import { formatMeasure } from '../../../helpers/measures';
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}
render () {
return <Domain>
- <DomainHeader component={this.props.component} title={window.t('overview.domain.debt')} linkTo="/issues"
- leakPeriodLabel={this.props.leakPeriodLabel} leakPeriodDate={this.props.leakPeriodDate}/>
+ <DomainHeader component={this.props.component} title={window.t('overview.domain.debt')} linkTo="/issues"/>
<DomainPanel domain="issues">
<DomainNutshell>
</IssuesLink>
</Measure>
</MeasuresList>
- {this.renderTimeline('before')}
+ {this.renderTimeline('before', true)}
</DomainNutshell>
{this.renderLeak()}
</DomainPanel>
return { date, value };
});
});
- this.setState({ history });
+ let historyStartDate = history[HISTORY_METRICS_LIST[0]][0].date;
+ this.setState({ history, historyStartDate });
});
},
}
.overview-card {
- margin: 30px 20px;
+ margin: 15px 20px;
}
.overview-card-fixed-width {
margin-top: 10px;
border: 1px solid @barBorderColor;
background-color: #fff;
- overflow: hidden;
.overview-bar-chart {
padding: 0;
.overview-domain-leak {
position: relative;
display: flex;
- padding: 30px 10px;
+ padding: 15px 10px;
}
.overview-domain-nutshell {
}
}
+.overview-domain-timeline-date {
+ position: absolute;
+ bottom: 2px;
+ left: 5px;
+ color: fade(@secondFontColor, 60%);
+ font-size: 11px;
+}
+
/*
* Detailed Pages
*/
padding: 0 10px;
}
-.overview-legend-leak {
- display: inline-block;
- vertical-align: middle;
- width: 16px;
- height: 16px;
- margin-top: -2px;
- margin-left: 16px;
- margin-right: 8px;
+.overview-legend {
+ position: absolute;
+ bottom: 100%;
+ left: 0;
+ right: -1px;
+ padding: 5px 0 2px;
border: 1px solid @barBorderColor;
- box-sizing: border-box;
- background-color: #fffae7;
+ border-bottom: none;
+ font-size: 14px;
+ text-align: center;
}
/*
#------------------------------------------------------------------------------
overview.quality_gate=Quality Gate
overview.quality_profiles=Quality Profiles
-overview.water_leak=Water Leak
+overview.leak_period_x=Leak Period {0}
+overview.started_x=started {0}
overview.project_in_a_nutshell=Project In a Nutshell
overview.unmanaged_issues=Unmanaged Issues