datetime and duration components now accepts value

This commit is contained in:
oleg 2015-08-26 20:06:59 +03:00
parent 893e2acf89
commit b35b8e6c5f
7 changed files with 14 additions and 23 deletions

View File

@ -51,21 +51,21 @@ mixin statusText(build)
span.build_info
i.fa.fa-fw.fa-clock-o
| finished
DateTime(date=new Date(build.endDate))
DateTime(value=build.endDate)
| ,
|
Duration(duration=(build.endDate - build.startDate), withSuffix=true)
Duration(value=(build.endDate - build.startDate), withSuffix=true)
else
if build.startDate
span.build_info
i.fa.fa-fw.fa-clock-o
| started
DateTime(date=new Date(build.startDate))
DateTime(value=build.startDate)
else
span.build_info
i.fa.fa-fw.fa-clock-o
| queued
DateTime(date=new Date(build.createDate))
DateTime(value=build.createDate)
|
if build.scm
span.build_info

View File

@ -61,10 +61,10 @@ div.row
span
if this.state.build.startDate
span Started
DateTime(date=new Date(this.state.build.startDate))
DateTime(value=this.state.build.startDate)
else
span Queued
DateTime(date=new Date(this.state.build.createDate))
DateTime(value=this.state.build.createDate)
if this.state.build.status !== 'in-progress'
p
@ -72,7 +72,7 @@ div.row
|
| Finished
if this.state.build.endDate
DateTime(date=new Date(this.state.build.endDate))
DateTime(value=this.state.build.endDate)
else
| -
- var rev = this.state.build.scm && this.state.build.scm.rev || {};

View File

@ -10,9 +10,6 @@ define([
});
var Component = React.createClass({
propTypes: {
date: React.PropTypes.instanceOf(Date)
},
render: template
});

View File

@ -1,2 +1,2 @@
- var date = moment(this.props.date);
- var date = moment(this.props.value);
span(title= date.format())= date.fromNow()

View File

@ -1,4 +1,4 @@
- var sec = Math.round(this.props.duration / 1000);
- var sec = Math.round(this.props.value / 1000);
- var min = sec >= 60 ? Math.round(sec / 60) : 0;
- var suffix = this.props.withSuffix ? 'in ' : '';
span(title= sec + ' sec')= suffix + (min ? min + ' min' : sec + ' sec')

View File

@ -7,15 +7,9 @@ define([
moment: moment
});
return React.createClass({
render: template,
getInitialState: function() {
var seconds = Math.round(this.props.duration / 1000);
return {
minutes: null,
seconds: seconds
}
}
var Component = React.createClass({
render: template
});
return Component;
});

View File

@ -25,7 +25,7 @@
- var lastDoneBuild = this.state.project.lastDoneBuild;
p Last successfully built:
if lastDoneBuild
DateTime(date=new Date(lastDoneBuild.endDate))
DateTime(value=lastDoneBuild.endDate)
|
| (build #
span= lastDoneBuild.number