mirror of
https://gitlab.silvrtree.co.uk/martind2000/nci.git
synced 2025-01-11 02:55:08 +00:00
merge
This commit is contained in:
commit
820a276a83
3
.gitignore
vendored
3
.gitignore
vendored
@ -2,9 +2,10 @@ node_modules
|
||||
test/workspace
|
||||
test/distributor/workspace
|
||||
test/repos/mercurial/.hg/strip-backup
|
||||
test/repos/mercurial/.hg/cache/branch2-served
|
||||
static/css/**/*.css
|
||||
static/fonts
|
||||
static/js/libs
|
||||
static/js/templates
|
||||
data/projects/**/workspace
|
||||
data/builds
|
||||
data/builds
|
||||
|
@ -10,9 +10,19 @@ module.exports = function(app) {
|
||||
resource.use('readAll', function(req, res, next) {
|
||||
Steppy(
|
||||
function() {
|
||||
var findParams = _(req.data).pick('offset', 'limit');
|
||||
var data = req.data || {};
|
||||
|
||||
var start = {};
|
||||
if (data.projectName) {
|
||||
start.projectName = data.projectName;
|
||||
}
|
||||
if (data.descCreateDate) {
|
||||
start.descCreateDate = data.descCreateDate;
|
||||
}
|
||||
|
||||
var findParams = _(data).pick('offset', 'limit');
|
||||
findParams.start = start;
|
||||
findParams.limit = findParams.limit || 20;
|
||||
findParams.start = {descCreateDate: ''};
|
||||
|
||||
db.builds.find(findParams, this.slot());
|
||||
},
|
||||
|
@ -1,6 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
var Steppy = require('twostep').Steppy,
|
||||
_ = require('underscore'),
|
||||
createBuildDataResource = require('../distributor').createBuildDataResource,
|
||||
logger = require('../lib/logger')('projects resource');
|
||||
|
||||
@ -18,6 +19,10 @@ module.exports = function(app) {
|
||||
res.send(app.projects);
|
||||
});
|
||||
|
||||
resource.use('read', function(req, res) {
|
||||
res.send(_(app.projects).findWhere(req.data));
|
||||
});
|
||||
|
||||
resource.use('run', function(req, res) {
|
||||
var projectName = req.data.projectName;
|
||||
logger.log('Run the project: "%s"', projectName);
|
||||
|
@ -14,6 +14,9 @@
|
||||
//variables
|
||||
@import "./sources/common/variables.less";
|
||||
|
||||
//fonts
|
||||
@import "./sources/common/fonts.less";
|
||||
|
||||
//layout
|
||||
@import "./sources/components/layout.less";
|
||||
|
||||
|
1
static/css/sources/common/fonts.less
Normal file
1
static/css/sources/common/fonts.less
Normal file
@ -0,0 +1 @@
|
||||
@import url(http://fonts.googleapis.com/css?family=Ubuntu&subset=latin,cyrillic);
|
@ -3,15 +3,15 @@
|
||||
|
||||
&_code {
|
||||
height: 300px;
|
||||
padding: 8px;
|
||||
padding: 8px 12px;
|
||||
box-sizing: border-box;
|
||||
overflow-y: scroll;
|
||||
border: none;
|
||||
color: white;
|
||||
background-color: black;
|
||||
line-height: 0.8;
|
||||
font-size: 12px;
|
||||
font-family: Monaco, Monosapce, sans-serif;
|
||||
font-size: 13px;
|
||||
font-family: 'Ubuntu', sans-serif;
|
||||
|
||||
&_newline {
|
||||
display: block;
|
||||
|
@ -3,7 +3,8 @@
|
||||
define(['reflux'], function(Reflux) {
|
||||
var Actions = Reflux.createActions([
|
||||
'run',
|
||||
'readAll'
|
||||
'readAll',
|
||||
'read'
|
||||
]);
|
||||
|
||||
return Actions;
|
||||
|
@ -19,7 +19,11 @@ define([
|
||||
var routes = (
|
||||
Route({name: 'index', path: '/'},
|
||||
Route({name: 'dashboard', path: '/', handler: Components.App}),
|
||||
Route({name: 'projects', path: 'projects', handler: Components.Project.List}),
|
||||
Route({
|
||||
name: 'projects',
|
||||
path: 'projects/:name',
|
||||
handler: Components.Project.View
|
||||
}),
|
||||
Route({name: 'build', path: 'builds/:id', handler: Components.Build.View})
|
||||
)
|
||||
);
|
||||
|
@ -66,7 +66,3 @@ mixin statusText(build)
|
||||
i.fa.fa-fw.fa-clock-o
|
||||
| queued at
|
||||
DateTime(date=new Date(build.createDate))
|
||||
|
||||
if this.state.showTerminal
|
||||
.build_terminal
|
||||
Terminal(build=build.id)
|
||||
|
@ -1,6 +1,5 @@
|
||||
- console.log('builds', items)
|
||||
.builds
|
||||
if !items.length
|
||||
p Build queue is empty
|
||||
each build, index in items
|
||||
if !this.state.items.length
|
||||
p Build list is empty
|
||||
each build, index in this.state.items
|
||||
Item(build=build, key=build.id)
|
||||
|
@ -7,6 +7,10 @@ define([
|
||||
'app/stores/builds',
|
||||
'templates/app/components/builds/list'
|
||||
], function(React, Reflux, Item, buildsStore, template) {
|
||||
template = template.locals({
|
||||
Item: Item
|
||||
});
|
||||
|
||||
var Component = React.createClass({
|
||||
mixins: [Reflux.ListenerMixin],
|
||||
componentDidMount: function() {
|
||||
@ -15,12 +19,7 @@ define([
|
||||
updateItems: function(items) {
|
||||
this.setState({items: items});
|
||||
},
|
||||
render: function() {
|
||||
return template({
|
||||
Item: Item,
|
||||
items: this.state.items
|
||||
});
|
||||
},
|
||||
render: template,
|
||||
getInitialState: function() {
|
||||
return {
|
||||
items: []
|
||||
|
@ -1,9 +1,11 @@
|
||||
'use strict';
|
||||
|
||||
define([
|
||||
'app/components/projects/selector/index'
|
||||
], function(Selector) {
|
||||
'app/components/projects/selector/index',
|
||||
'app/components/projects/view/index'
|
||||
], function(Selector, View) {
|
||||
return {
|
||||
Selector: Selector
|
||||
Selector: Selector,
|
||||
View: View
|
||||
};
|
||||
});
|
||||
|
@ -1,10 +1,14 @@
|
||||
'use strict';
|
||||
|
||||
define([
|
||||
'react', 'reflux', 'app/actions/project',
|
||||
'app/stores/project',
|
||||
'react', 'react-router', 'reflux', 'app/actions/project',
|
||||
'app/stores/projects',
|
||||
'templates/app/components/projects/selector/index'
|
||||
], function(React, Reflux, ProjectActions, projectsStore, template) {
|
||||
], function(React, Router, Reflux, ProjectActions, projectsStore, template) {
|
||||
template = template.locals({
|
||||
Link: Router.Link
|
||||
});
|
||||
|
||||
return React.createClass({
|
||||
mixins: [Reflux.ListenerMixin],
|
||||
componentDidMount: function() {
|
||||
|
2
static/js/app/components/projects/view/index.jade
Normal file
2
static/js/app/components/projects/view/index.jade
Normal file
@ -0,0 +1,2 @@
|
||||
h1= this.state.project.name
|
||||
Builds()
|
35
static/js/app/components/projects/view/index.js
Normal file
35
static/js/app/components/projects/view/index.js
Normal file
@ -0,0 +1,35 @@
|
||||
'use strict';
|
||||
|
||||
define([
|
||||
'react', 'reflux',
|
||||
'app/actions/project',
|
||||
'app/actions/build',
|
||||
'app/stores/project',
|
||||
'app/components/builds/list',
|
||||
'templates/app/components/projects/view/index'
|
||||
], function(React, Reflux, ProjectActions, BuildActions,
|
||||
projectStore, Builds, template
|
||||
) {
|
||||
template = template.locals({
|
||||
Builds: Builds
|
||||
});
|
||||
|
||||
return React.createClass({
|
||||
mixins: [Reflux.ListenerMixin],
|
||||
componentDidMount: function() {
|
||||
ProjectActions.read({name: this.props.params.name});
|
||||
BuildActions.readAll({projectName: this.props.params.name});
|
||||
|
||||
this.listenTo(projectStore, this.updateItem);
|
||||
},
|
||||
updateItem: function(project) {
|
||||
this.setState({project: project});
|
||||
},
|
||||
getInitialState: function() {
|
||||
return {
|
||||
project: {}
|
||||
}
|
||||
},
|
||||
render: template,
|
||||
});
|
||||
});
|
@ -27,9 +27,9 @@ define([
|
||||
resource.subscribe('change', this.onChange);
|
||||
},
|
||||
|
||||
onReadAll: function() {
|
||||
onReadAll: function(params) {
|
||||
var self = this;
|
||||
resource.sync('readAll', function(err, builds) {
|
||||
resource.sync('readAll', params, function(err, builds) {
|
||||
if (err) throw err;
|
||||
self.builds = builds;
|
||||
self.trigger(self.builds);
|
||||
|
@ -1,22 +1,28 @@
|
||||
'use strict';
|
||||
|
||||
define([
|
||||
'underscore',
|
||||
'reflux', 'app/actions/project', 'app/resources'
|
||||
], function(Reflux, ProjectActions, resources) {
|
||||
], function(_, Reflux, ProjectActions, resources) {
|
||||
var resource = resources.projects;
|
||||
|
||||
var Store = Reflux.createStore({
|
||||
listenables: ProjectActions,
|
||||
onRun: function(projectName) {
|
||||
resource.sync('run', {projectName: projectName}, function(err, result) {
|
||||
console.log('run project, shoould get queue');
|
||||
});
|
||||
project: null,
|
||||
|
||||
onChange: function(data, action) {
|
||||
},
|
||||
onReadAll: function() {
|
||||
|
||||
init: function() {
|
||||
resource.subscribe('change', this.onChange);
|
||||
},
|
||||
|
||||
onRead: function(params) {
|
||||
var self = this;
|
||||
resource.sync('readAll', function(err, projects) {
|
||||
resource.sync('read', params, function(err, project) {
|
||||
if (err) throw err;
|
||||
self.trigger(projects);
|
||||
self.project = project;
|
||||
self.trigger(self.project);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
25
static/js/app/stores/projects.js
Normal file
25
static/js/app/stores/projects.js
Normal file
@ -0,0 +1,25 @@
|
||||
'use strict';
|
||||
|
||||
define([
|
||||
'reflux', 'app/actions/project', 'app/resources'
|
||||
], function(Reflux, ProjectActions, resources) {
|
||||
var resource = resources.projects;
|
||||
|
||||
var Store = Reflux.createStore({
|
||||
listenables: ProjectActions,
|
||||
onRun: function(projectName) {
|
||||
resource.sync('run', {projectName: projectName}, function(err, result) {
|
||||
console.log('run project, shoould get queue');
|
||||
});
|
||||
},
|
||||
onReadAll: function() {
|
||||
var self = this;
|
||||
resource.sync('readAll', function(err, projects) {
|
||||
if (err) throw err;
|
||||
self.trigger(projects);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
return Store;
|
||||
});
|
Loading…
Reference in New Issue
Block a user