project page and build page improvements

This commit is contained in:
Vladimir Polyakov 2015-07-11 18:15:18 +03:00
parent f66f3b97d6
commit 66362b2a08
15 changed files with 190 additions and 74 deletions

View File

@ -1,3 +1,11 @@
.build-view {
&_info {
}
&_terminal {
margin-top: 20px;
}
}
.build { .build {
.clearfix; .clearfix;
padding: 15px; padding: 15px;

View File

@ -24,24 +24,39 @@
&_items { &_items {
position: absolute; position: absolute;
width: 100%; width: 100%;
padding: 15px 5px 5px; padding: 0;
padding-top: 15px;
left: 0; left: 0;
background: #2c3e50; background: @brand-primary;
list-style: none; list-style: none;
} }
&_item { &_item {
padding: 5px 10px; .clearfix();
padding: 10px 10px;
&_link { &_link {
float: left;
display: block;
color: white; color: white;
text-decoration: none; text-decoration: none;
&:hover {
color: white;
text-decoration: none;
}
} }
&_run { &_run {
float: right;
color: rgba(255, 255, 255, 0.5); color: rgba(255, 255, 255, 0.5);
&:hover { &:hover {
color: white; color: white;
text-decoration: none; text-decoration: none;
} }
} }
&:hover {
background: lighten(@brand-primary, 10%);
}
} }
} }

View File

@ -2,7 +2,7 @@
box-sizing: border-box; box-sizing: border-box;
&_code { &_code {
height: 300px; height: 420px;
padding: 8px 12px; padding: 8px 12px;
box-sizing: border-box; box-sizing: border-box;
overflow-y: scroll; overflow-y: scroll;

View File

@ -20,7 +20,7 @@ define([
Route({handler: Components.App}, Route({handler: Components.App},
Route({name: 'dashboard', path: '/', handler: Components.Dashboard}), Route({name: 'dashboard', path: '/', handler: Components.Dashboard}),
Route({ Route({
name: 'projects', name: 'project',
path: 'projects/:name', path: 'projects/:name',
handler: Components.Project.View handler: Components.Project.View
}), }),
@ -34,5 +34,4 @@ define([
document.getElementById('content') document.getElementById('content')
); );
}); });
}); });

View File

@ -1,5 +1,5 @@
.builds .builds
if !this.state.items.length if !this.state.items.length
p Build list is empty p Build history is empty
each build, index in this.state.items each build, index in this.state.items
Item(build=build, key=build.id) Item(build=build, key=build.id)

View File

@ -1,52 +1,101 @@
if this.state.build mixin statusBadge(build)
h2 if build.status === 'in-progress'
span= this.state.build.project.name span.label.label-info in progress
span build #
span= this.state.build.number
div if build.status === 'queued'
| Initiated by span.label.label-default queued
- var initiator = this.state.build.initiator;
if initiator.type === 'user'
span user
else if initiator.type === 'build'
span= initiator.project.name
span build #
span= initiator.number
else
span= initiator.type
if this.state.build.startDate if build.status === 'done'
div span.label.label.sm.label-success done
| Started at
if this.state.build.startDate
DateTime(date=new Date(this.state.build.startDate))
else
| -
else
div
| Queued at
if this.state.build.createDate
DateTime(date=new Date(this.state.build.createDate))
else
| -
div if build.status === 'error'
| Built at span.label.label-danger error
if this.state.build.endDate
DateTime(date=new Date(this.state.build.endDate))
else
| -
div div.row
if this.state.build.error if this.state.build
| Error:
span= this.state.build.error.message
if this.state.build.error.stderr
div stderr:
pre= this.state.build.error.stderr
.row
.col-md-8 .col-md-8
Terminal(build=this.state.build.id) h1
.pull-right(style={fontSize: '22px'})
mixin statusBadge(this.state.build)
span Build #
span= this.state.build.number
.text-muted(style={marginTop: '-10px'})
| Initiated by
- var initiator = this.state.build.initiator;
if initiator.type === 'user'
span user
else if initiator.type === 'build'
Link(to="project", params={name: initiator.project.name})
span= initiator.project.name
|
| during the
|
Link(to="build", params={id: initiator.id})
span build #
span= initiator.number
else
span= initiator.type
hr
.build-view_info
if this.state.build.error && this.state.build.error.message
.text-center.alert.alert-danger
| Error:
span= this.state.build.error.message
.row
.col-md-6
p
Scm(scm=this.state.build.project.scm.type)
|
| Project
Link(to="project", params={name: this.state.build.project.name})
span= this.state.build.project.name
p
i.fa.fa-fw.fa-clock-o
span
if this.state.build.startDate
span Started at
DateTime(date=new Date(this.state.build.startDate))
else
span Queued at
DateTime(date=new Date(this.state.build.createDate))
if this.state.build.status !== 'in-progress'
p
i.fa.fa-fw.fa-circle
|
| Finished at
if this.state.build.endDate
DateTime(date=new Date(this.state.build.endDate))
else
| -
.col-md-6
p
i.fa.fa-fw.fa-user
|
| Commit author
|
span= this.state.build.scm.rev.author
p
i.fa.fa-fw.fa-code-fork
|
| Revision
|
span= this.state.build.scm.rev.id
p
i.fa.fa-fw.fa-comment-o
|
| Comment
|
span= this.state.build.scm.rev.comment
h2
i.fa.fa-fw.fa-terminal
|
| Console output
.build-view_terminal
Terminal(build=this.state.build.id)

View File

@ -2,6 +2,7 @@
define([ define([
'react', 'react',
'react-router',
'reflux', 'reflux',
'app/actions/build', 'app/actions/build',
'app/stores/build', 'app/stores/build',
@ -9,12 +10,14 @@ define([
'templates/app/components/builds/view', 'templates/app/components/builds/view',
'app/components/common/index' 'app/components/common/index'
], function( ], function(
React, Reflux, BuildActions, buildStore, TerminalComponent, template, React, Router, Reflux, BuildActions, buildStore, TerminalComponent, template,
CommonComponents CommonComponents
) { ) {
template = template.locals({ template = template.locals({
DateTime: CommonComponents.DateTime, DateTime: CommonComponents.DateTime,
Terminal: TerminalComponent Scm: CommonComponents.Scm,
Terminal: TerminalComponent,
Link: Router.Link
}); });
var Component = React.createClass({ var Component = React.createClass({

View File

@ -1,9 +1,11 @@
'use strict'; 'use strict';
define([ define([
'./dateTime/index' './dateTime/index',
], function(DateTime) { './scm/index'
], function(DateTime, Scm) {
return { return {
DateTime: DateTime DateTime: DateTime,
Scm: Scm
}; };
}); });

View File

@ -0,0 +1,5 @@
if this.props.scm
if this.props.scm === 'mercurial'
i.fa.fa-fw.fa-bitbucket
else
i.fa.fa-fw.fa-git

View File

@ -0,0 +1,10 @@
'use strict';
define([
'react', 'templates/app/components/common/scm/index'
], function(React, template) {
return React.createClass({
render: template
});
});

View File

@ -13,12 +13,12 @@
) )
ul.projects-selector_items ul.projects-selector_items
each project in this.state.projects each project in this.state.projects
li.projects-selector_item.row(key=project.name) li.projects-selector_item(key=project.name)
.col-md-8 Link.projects-selector_item_link(to="project", params={name: project.name}, onMouseDown=this.onSelectProject(project.name))
Link.projects-selector_item_link(to="projects", params={name: project.name}, onMouseDown=this.onSelectProject(project.name)) Scm(scm=project.scm.type)
span= project.name span
.col-md-4.text-small.text-right span= project.name
a.projects-selector_item_run(href="javascript:void(0);", onMouseDown=this.onRunProject(project.name)) a.projects-selector_item_run(href="javascript:void(0);", onMouseDown=this.onRunProject(project.name))
i.fa.fa-fw.fa-play i.fa.fa-fw.fa-play

View File

@ -3,10 +3,14 @@
define([ define([
'react', 'react-router', 'reflux', 'app/actions/project', 'react', 'react-router', 'reflux', 'app/actions/project',
'app/stores/projects', 'app/stores/projects',
'app/components/common/scm/index',
'templates/app/components/projects/selector/index' 'templates/app/components/projects/selector/index'
], function(React, Router, Reflux, ProjectActions, projectsStore, template) { ], function(React, Router, Reflux, ProjectActions, projectsStore, Scm,
template
) {
template = template.locals({ template = template.locals({
Link: Router.Link Link: Router.Link,
Scm: Scm
}); });
return React.createClass({ return React.createClass({
@ -24,7 +28,7 @@ define([
this.setState({showSearch: false}); this.setState({showSearch: false});
}, },
onSelectProject: function(name) { onSelectProject: function(name) {
this.transitionTo('projects', {name: name}); this.transitionTo('project', {name: name});
}, },
updateItems: function(projects) { updateItems: function(projects) {
this.setState({projects: projects}); this.setState({projects: projects});

View File

@ -1,3 +1,21 @@
div .row
h1= this.state.project.name .col-md-8
Builds() h1
.pull-right
span.badge.badge-default= this.state.project.scm ? this.state.project.scm.rev : ''
Scm(scm=this.state.project.scm ? this.state.project.scm.type : '')
span= this.state.project.name
hr
div.text-muted
p Last successfully build: ...
p Current successfully streak: ...
p Last build time: ...
p Average build time: ...
h2
i.fa.fa-fw.fa-history
span
span Build history
Builds()

View File

@ -6,12 +6,14 @@ define([
'app/actions/build', 'app/actions/build',
'app/stores/project', 'app/stores/project',
'app/components/builds/list', 'app/components/builds/list',
'app/components/common/scm/index',
'templates/app/components/projects/view/index' 'templates/app/components/projects/view/index'
], function(React, Reflux, ProjectActions, BuildActions, ], function(React, Reflux, ProjectActions, BuildActions,
projectStore, Builds, template projectStore, Builds, Scm, template
) { ) {
template = template.locals({ template = template.locals({
Builds: Builds Builds: Builds,
Scm: Scm
}); });
return React.createClass({ return React.createClass({

View File

@ -17,6 +17,7 @@ define([
resource.sync('readAll', function(err, projects) { resource.sync('readAll', function(err, projects) {
if (err) throw err; if (err) throw err;
self.trigger(projects); self.trigger(projects);
console.log(projects);
}); });
} }
}); });