mirror of
https://gitlab.silvrtree.co.uk/martind2000/nci.git
synced 2025-02-11 09:29:16 +00:00
better datetime and duration formatting
This commit is contained in:
parent
ffff547082
commit
893e2acf89
@ -28,9 +28,9 @@ Ui fixes
|
|||||||
|
|
||||||
* speed up console output
|
* speed up console output
|
||||||
* projects autocomplete
|
* projects autocomplete
|
||||||
* add time ago to build list
|
* ~~add time ago to build list~~
|
||||||
* show scm changes on build page
|
* show scm changes on build page
|
||||||
* react says many many time to console:
|
* react says many many times to console:
|
||||||
Warning: setState(...): Can only update a mounted or mounting component.
|
Warning: setState(...): Can only update a mounted or mounting component.
|
||||||
This usually means you called setState() on an unmounted component.
|
This usually means you called setState() on an unmounted component.
|
||||||
This is a no-op.
|
This is a no-op.
|
||||||
@ -40,7 +40,7 @@ Ui fixes
|
|||||||
* don't appear build from other project on project page
|
* don't appear build from other project on project page
|
||||||
* update project info changes (avg duration, etc) on the fly - project page
|
* update project info changes (avg duration, etc) on the fly - project page
|
||||||
* long commit comment breakes build card makeup
|
* long commit comment breakes build card makeup
|
||||||
* comment start/duration should be on same place during all steps
|
* ~~comment start/duration should be on same place during all steps~~
|
||||||
|
|
||||||
## Roadmap
|
## Roadmap
|
||||||
|
|
||||||
|
@ -50,8 +50,22 @@ mixin statusText(build)
|
|||||||
if build.endDate
|
if build.endDate
|
||||||
span.build_info
|
span.build_info
|
||||||
i.fa.fa-fw.fa-clock-o
|
i.fa.fa-fw.fa-clock-o
|
||||||
|
| finished
|
||||||
|
DateTime(date=new Date(build.endDate))
|
||||||
|
| ,
|
||||||
|
|
|
|
||||||
Duration(duration=(build.endDate - build.startDate))
|
Duration(duration=(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))
|
||||||
|
else
|
||||||
|
span.build_info
|
||||||
|
i.fa.fa-fw.fa-clock-o
|
||||||
|
| queued
|
||||||
|
DateTime(date=new Date(build.createDate))
|
||||||
|
|
|
|
||||||
if build.scm
|
if build.scm
|
||||||
span.build_info
|
span.build_info
|
||||||
@ -59,18 +73,6 @@ mixin statusText(build)
|
|||||||
|
|
|
|
||||||
span= build.scm.rev.comment
|
span= build.scm.rev.comment
|
||||||
|
|
|
|
||||||
if !build.endDate
|
|
||||||
if build.startDate
|
|
||||||
span.build_info
|
|
||||||
i.fa.fa-fw.fa-clock-o
|
|
||||||
| started at
|
|
||||||
DateTime(date=new Date(build.startDate))
|
|
||||||
else
|
|
||||||
span.build_info
|
|
||||||
i.fa.fa-fw.fa-clock-o
|
|
||||||
| queued at
|
|
||||||
DateTime(date=new Date(build.createDate))
|
|
||||||
|
|
||||||
|
|
||||||
.build_controls
|
.build_controls
|
||||||
if build.completed
|
if build.completed
|
||||||
|
@ -60,17 +60,17 @@ div.row
|
|||||||
i.fa.fa-fw.fa-clock-o
|
i.fa.fa-fw.fa-clock-o
|
||||||
span
|
span
|
||||||
if this.state.build.startDate
|
if this.state.build.startDate
|
||||||
span Started at
|
span Started
|
||||||
DateTime(date=new Date(this.state.build.startDate))
|
DateTime(date=new Date(this.state.build.startDate))
|
||||||
else
|
else
|
||||||
span Queued at
|
span Queued
|
||||||
DateTime(date=new Date(this.state.build.createDate))
|
DateTime(date=new Date(this.state.build.createDate))
|
||||||
|
|
||||||
if this.state.build.status !== 'in-progress'
|
if this.state.build.status !== 'in-progress'
|
||||||
p
|
p
|
||||||
i.fa.fa-fw.fa-circle
|
i.fa.fa-fw.fa-circle
|
||||||
|
|
|
|
||||||
| Finished at
|
| Finished
|
||||||
if this.state.build.endDate
|
if this.state.build.endDate
|
||||||
DateTime(date=new Date(this.state.build.endDate))
|
DateTime(date=new Date(this.state.build.endDate))
|
||||||
else
|
else
|
||||||
|
@ -2,8 +2,13 @@
|
|||||||
|
|
||||||
define([
|
define([
|
||||||
'react',
|
'react',
|
||||||
'templates/app/components/common/dateTime/template'
|
'templates/app/components/common/dateTime/template',
|
||||||
], function(React, template) {
|
'moment'
|
||||||
|
], function(React, template, moment) {
|
||||||
|
template = template.locals({
|
||||||
|
moment: moment
|
||||||
|
});
|
||||||
|
|
||||||
var Component = React.createClass({
|
var Component = React.createClass({
|
||||||
propTypes: {
|
propTypes: {
|
||||||
date: React.PropTypes.instanceOf(Date)
|
date: React.PropTypes.instanceOf(Date)
|
||||||
|
@ -1 +1,2 @@
|
|||||||
span= this.props.date.toLocaleDateString() + ' ' + this.props.date.toLocaleTimeString()
|
- var date = moment(this.props.date);
|
||||||
|
span(title= date.format())= date.fromNow()
|
||||||
|
@ -1,9 +1,4 @@
|
|||||||
span
|
- var sec = Math.round(this.props.duration / 1000);
|
||||||
if this.props.minutes
|
- var min = sec >= 60 ? Math.round(sec / 60) : 0;
|
||||||
span= this.props.minutes
|
- var suffix = this.props.withSuffix ? 'in ' : '';
|
||||||
|
|
span(title= sec + ' sec')= suffix + (min ? min + ' min' : sec + ' sec')
|
||||||
span min
|
|
||||||
|
|
|
||||||
span= this.state.seconds
|
|
||||||
|
|
|
||||||
span sec
|
|
||||||
|
@ -1,8 +1,12 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
define([
|
define([
|
||||||
'react', 'templates/app/components/common/duration/index'
|
'react', 'templates/app/components/common/duration/index', 'moment'
|
||||||
], function(React, template) {
|
], function(React, template, moment) {
|
||||||
|
template = template.locals({
|
||||||
|
moment: moment
|
||||||
|
});
|
||||||
|
|
||||||
return React.createClass({
|
return React.createClass({
|
||||||
render: template,
|
render: template,
|
||||||
getInitialState: function() {
|
getInitialState: function() {
|
||||||
|
@ -23,12 +23,13 @@
|
|||||||
|
|
||||||
div.text-muted
|
div.text-muted
|
||||||
- var lastDoneBuild = this.state.project.lastDoneBuild;
|
- var lastDoneBuild = this.state.project.lastDoneBuild;
|
||||||
p Last successfully build:
|
p Last successfully built:
|
||||||
if lastDoneBuild
|
if lastDoneBuild
|
||||||
| build #
|
|
||||||
span= lastDoneBuild.number
|
|
||||||
| at
|
|
||||||
DateTime(date=new Date(lastDoneBuild.endDate))
|
DateTime(date=new Date(lastDoneBuild.endDate))
|
||||||
|
|
|
||||||
|
| (build #
|
||||||
|
span= lastDoneBuild.number
|
||||||
|
| )
|
||||||
else
|
else
|
||||||
| -
|
| -
|
||||||
|
|
||||||
|
@ -10,6 +10,7 @@ require.config({
|
|||||||
reflux: 'libs/reflux/dist/reflux',
|
reflux: 'libs/reflux/dist/reflux',
|
||||||
jquery: 'libs/jquery/jquery',
|
jquery: 'libs/jquery/jquery',
|
||||||
ansi_up: 'libs/ansi_up/ansi_up',
|
ansi_up: 'libs/ansi_up/ansi_up',
|
||||||
|
moment: 'libs/moment/moment',
|
||||||
'bootstrap/collapse': 'libs/bootstrap/js/collapse',
|
'bootstrap/collapse': 'libs/bootstrap/js/collapse',
|
||||||
'bootstrap/dropdown': 'libs/bootstrap/js/dropdown'
|
'bootstrap/dropdown': 'libs/bootstrap/js/dropdown'
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user