ui is plugin now

This commit is contained in:
oleg 2016-01-10 02:46:13 +03:00
parent 80a4108afb
commit 3a4abf354b
81 changed files with 19 additions and 3536 deletions

View File

@ -1,5 +0,0 @@
{
"directory": "static/js/libs",
"analytics": false,
"timeout": 120000
}

5
.gitignore vendored
View File

@ -3,10 +3,5 @@ test/workspace
test/distributor/workspace
test/repos/mercurial/
test/repos/git/
static/css/**/*.css
static/fonts
static/js/libs
static/js/templates
data/projects/**/workspace
data/builds
static/index.html

View File

@ -1,13 +1,6 @@
data
.npmignore
test
static/css/**/*.less
#ignore all static/js except shared
static/js/app
static/js/libs
static/js/requirejs
static/js/templates
static/js/*.js
.bowerrc
bower.json
*.tgz
.travis.yml
docs

29
app.js
View File

@ -19,8 +19,6 @@ var env = process.env.NODE_ENV || 'development',
var app = new EventEmitter(),
logger = libLogger('app');
var staticPath = path.join(__dirname, 'static');
var httpServerLogger = libLogger('http server');
app.httpServer = httpServer.create();
@ -55,11 +53,6 @@ app.httpServer.addRequestListener(function(req, res, next) {
next();
});
var socketio = require('socket.io')(app.httpServer);
var dataio = require('./dataio')(socketio);
app.dataio = dataio;
app.lib = {};
app.lib.reader = reader;
app.lib.notifier = notifier;
@ -231,33 +224,11 @@ Steppy(
});
notifier.init(app.config.notify, this.slot());
// init resources
require('./resources')(app);
},
function() {
// load projects after all plugins to provide ability for plugins to
// handle `projectLoaded` event
app.projects.loadAll(this.slot());
// serve index for all app pages, add this listener after all other
// listeners
app.httpServer.addRequestListener(function(req, res, next) {
if (req.url.indexOf('/data.io.js') === -1) {
if (env === 'development') {
var jade = require('jade');
// Compile a function
var index = jade.compileFile(__dirname + '/views/index.jade');
res.write(index({env: env}));
res.end();
} else {
fs.createReadStream(path.join(staticPath, 'index.html'))
.pipe(res);
}
} else {
next();
}
});
},
function(err) {
logger.log('Loaded projects: ', _(app.projects.getAll()).pluck('name'));

View File

@ -1,31 +0,0 @@
{
"name": "nci",
"version": "0.0.0",
"homepage": "https://github.com/okv/nci",
"authors": [],
"dependencies": {
"underscore": "1.8.2",
"moment": "2.10.6",
"react": "0.13.2",
"requirejs": "2.1.17",
"jquery": "1.10.2",
"reflux": "0.2.7",
"bootstrap": "3.3.4",
"font-awesome": "4.3.0",
"react-router": "0.13.3",
"ansi_up": "1.2.1",
"almond": "0.3.1"
},
"moduleType": [
"amd"
],
"license": "MIT",
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"app/components/",
"test",
"tests"
]
}

View File

@ -6,6 +6,8 @@ plugins:
# - nci-mail-notification
# - nci-jabber-notification
# - nci-scheduler
#ui better be last pugin
# - nci-classic-ui
nodes:
- type: local
@ -18,7 +20,7 @@ http:
static:
locations:
- url: !!js/regexp ^/(js|css|fonts|images)/
root: static/
root: node_modules/nci-classic-ui/static/
- url: !!js/regexp ^/projects/(\w|-)+/workspace/
root: data/

View File

@ -1,40 +0,0 @@
'use strict';
var dataio = require('data.io'),
Server = require('./node_modules/data.io/lib/server'),
Resource = require('./node_modules/data.io/lib/resource'),
Sync = require('./node_modules/data.io/lib/sync');
/*
* Patch server and resource to provide ability to send data to all clients
* of the resource
*/
Server.prototype.resource = function(name, resource) {
var self = this;
if (resource === undefined) {
resource = this.resources[name];
if (resource) return resource;
resource = new Resource();
}
this.resources[name] = resource;
this.namespace(name).on('connection', function(client) {
self.connect(resource, client);
});
// save link to the namespace at resource
resource.namespace = this.namespace(name);
return resource;
};
Resource.prototype.clientEmitSync = function(action, data) {
this.namespace.emit('sync', action, data);
};
module.exports = function() {
return dataio.apply(dataio, arguments);
};

View File

@ -1,42 +0,0 @@
'use strict';
var gulp = require('gulp');
var nodemon = require('gulp-nodemon');
var less = require('gulp-less');
var gulpReactJade = require('gulp-react-jade-amd');
var mainBowerFiles = require('main-bower-files');
gulp.task('react-jade', function() {
return gulp.src('static/js/**/*.jade')
.pipe(gulpReactJade())
.pipe(gulp.dest('static/js/templates'));
});
gulp.task('less', function () {
return gulp.src('static/css/index.less')
.pipe(less('index.css'))
.pipe(gulp.dest('./static/css'));
});
gulp.task('fonts', function() {
return gulp.src(mainBowerFiles({filter: /.*fonts.*/i}))
.pipe(gulp.dest('static/fonts/'));
});
gulp.task('develop', function() {
gulp.watch('static/js/app/**/*.jade', ['react-jade']);
gulp.watch('static/css/**/*.less', ['less']);
return nodemon({
ignore: ['static/**/*.js', 'app/**/*.js', 'node_modules/**', 'data/**'],
script: 'app.js',
ext: 'js'
});
});
gulp.task('default', [
'react-jade',
'less',
'fonts',
'develop'
]);

View File

@ -1,9 +1,17 @@
'use strict';
var _ = require('underscore'),
sharedUtils = require('../static/js/shared/utils');
var _ = require('underscore');
_(exports).extend(sharedUtils);
exports.prune = function(str, length) {
var result = '',
words = str.split(' ');
do {
result += words.shift() + ' ';
} while (words.length && result.length < length);
return result.replace(/ $/, words.length ? '...' : '');
};
exports.lpad = function(str, length, chr) {
chr = chr || '0';

View File

@ -8,15 +8,11 @@
"scripts": {
"makeTestRepos": "rm -rf test/repos/{mercurial,git}; cd test/repos/ && tar -xf mercurial.tar.gz && tar -xf git.tar.gz",
"test": "npm run makeTestRepos && mocha --bail --reporter=spec --timeout 10000",
"dev": "gulp",
"sync": "npm install && npm prune && bower install && bower prune",
"dev": "nodemon -i node_modules -i data app.js",
"sync": "npm install && npm prune",
"docProjectsCollection": "dox --api --skipSingleStar < lib/project.js | sed '/^ - \\[ProjectsCollection/ d' > docs/developing-plugins/projects-collection.md",
"docBuildsCollection": "dox --api --skipSingleStar < lib/build.js | sed '/^ - \\[BuildsCollection/ d' > docs/developing-plugins/builds-collection.md",
"doc": "nrun docProjectsCollection && nrun docBuildsCollection",
"buildJs": "r.js -o static/js/requirejs/buid.js",
"buildClean": "rm static/index.html",
"buildHtml": "jade views/index.jade --obj '{\"env\": \"production\"}' -o static/",
"build": "gulp less && gulp fonts && gulp react-jade && npm run buildJs && npm run buildHtml && git checkout static/js/app.build.js"
"doc": "nrun docProjectsCollection && nrun docBuildsCollection"
},
"repository": {
"type": "git",
@ -47,23 +43,14 @@
"dependencies": {
"colors": "1.1.2",
"conform": "0.2.12",
"data.io": "0.3.0",
"nlevel": "1.0.3",
"socket.io": "1.3.5",
"through": "2.3.6",
"twostep": "0.4.1",
"underscore": "1.8.3"
},
"devDependencies": {
"bower": "1.4.1",
"dox": "0.8.0",
"expect.js": "0.3.1",
"gulp": "3.8.11",
"gulp-less": "3.0.3",
"gulp-nodemon": "2.0.3",
"gulp-react-jade-amd": "git://github.com/vladimir-polyakov/gulp-react-jade-amd",
"jade": "1.11.0",
"main-bower-files": "2.7.0",
"memdown": "1.1.0",
"mocha": "1.18.2",
"nci-projects-reloader": "0.1.1",
@ -72,7 +59,6 @@
"nci-yaml-reader": "0.1.0",
"nodemon": "1.3.7",
"nrun": "0.1.4",
"requirejs": "2.1.19",
"sinon": "1.14.1"
}
}

View File

@ -1,97 +0,0 @@
'use strict';
var Steppy = require('twostep').Steppy,
_ = require('underscore'),
logger = require('../lib/logger')('builds resource');
module.exports = function(app) {
var resource = app.dataio.resource('builds');
resource.use('readAll', function(req, res, next) {
Steppy(
function() {
var data = req.data || {},
getParams = {limit: Number(data.limit) || 20};
if (data.projectName) {
getParams.projectName = data.projectName;
}
app.builds.getRecent(getParams, this.slot());
},
function(err, builds) {
// omit big fields not needed for list
_(builds).each(function(build) {
delete build.stepTimings;
if (build.scm) {
delete build.scm.changes;
}
build.project = _(build.project).pick(
'name', 'scm', 'avgBuildDuration'
);
});
res.send(builds);
},
next
);
});
resource.use('read', function(req, res, next) {
Steppy(
function() {
app.builds.get(req.data.id, this.slot());
},
function(err, build) {
res.send(build);
},
next
);
});
resource.use('getBuildLogTail', function(req, res, next) {
Steppy(
function() {
app.builds.getLogLinesTail({
buildId: req.data.buildId,
limit: req.data.length
}, this.slot());
},
function(err, tail) {
res.send(tail);
},
next
);
});
resource.use('getBuildLogLines', function(req, res, next) {
Steppy(
function() {
app.builds.getLogLines(
_(req.data).pick('buildId', 'from', 'to'),
this.slot()
);
},
function(err, logLinesData) {
res.send(logLinesData);
},
next
);
});
resource.use('cancel', function(req, res, next) {
Steppy(
function() {
var buildId = req.data.buildId;
logger.log('Cancel build: "%s"', buildId);
app.builds.cancel(buildId, this.slot());
},
function() {
res.send();
},
next
);
});
return resource;
};

View File

@ -1,11 +0,0 @@
'use strict';
var logger = require('../lib/logger')('resources error handler');
module.exports = function(err, req, res, next) {
logger.error(
'Error is occurred during requesting ' +
req.resource.namespace.name + ' ' + req.action + ':',
err.stack || err
);
};

View File

@ -1,37 +0,0 @@
'use strict';
var Steppy = require('twostep').Steppy,
logger = require('../lib/logger')('create build resource');
var buildDataResourcesHash = {};
// create resource for build data
exports.createBuildDataResource = function(app, buildId) {
if (buildId in buildDataResourcesHash) {
return;
}
var buildDataResource = app.dataio.resource('build' + buildId);
buildDataResource.on('connection', function(client) {
var callback = this.async();
Steppy(
function() {
app.builds.getLogLines({buildId: buildId}, this.slot());
},
function(err, logLinesData) {
client.emit('sync', 'data', {lines: logLinesData.lines});
this.pass(null);
},
function(err) {
if (err) {
logger.error(
'error during read log for "' + buildId + '":',
err.stack || err
);
}
callback();
}
);
});
buildDataResourcesHash[buildId] = buildDataResource;
};

View File

@ -1,42 +0,0 @@
'use strict';
var _ = require('underscore'),
errorHandler = require('./errorHandler'),
helpers = require('./helpers');
module.exports = function(app) {
_(['builds', 'projects']).each(function(resource) {
var resource = require('./' + resource)(app);
resource.use(errorHandler);
});
var buildsResource = app.dataio.resource('builds');
app.builds.on('buildUpdated', function(build, changes) {
if (build.status === 'queued') {
helpers.createBuildDataResource(app, build.id);
}
// notify about build's project change, coz building affects project
// related stat (last build date, avg build time, etc)
if (changes.completed) {
var projectsResource = app.dataio.resource('projects');
projectsResource.clientEmitSyncChange(build.project.name);
}
buildsResource.clientEmitSync('change', {
buildId: build.id, changes: changes
});
});
app.builds.on('buildCanceled', function(build) {
buildsResource.clientEmitSync('cancel', {buildId: build.id});
});
app.builds.on('buildLogLines', function(build, lines) {
app.dataio.resource('build' + build.id).clientEmitSync(
'data',
{lines: lines}
);
});
};

View File

@ -1,99 +0,0 @@
'use strict';
var Steppy = require('twostep').Steppy,
_ = require('underscore'),
helpers = require('./helpers'),
logger = require('../lib/logger')('projects resource');
module.exports = function(app) {
var resource = app.dataio.resource('projects');
resource.use('createBuildDataResource', function(req, res) {
helpers.createBuildDataResource(app, req.data.buildId);
res.send();
});
resource.use('readAll', function(req, res) {
var filteredProjects = app.projects.getAll(),
nameQuery = req.data && req.data.nameQuery;
if (nameQuery) {
filteredProjects = app.projects.filter(function(project) {
return project.name.indexOf(nameQuery) !== -1;
});
}
filteredProjects = _(filteredProjects).sortBy('name');
res.send(filteredProjects);
});
// get project with additional fields
var getProject = function(name, callback) {
var project;
Steppy(
function() {
project = _(app.projects.get(name)).clone();
app.builds.getRecent({
projectName: project.name,
status: 'done',
limit: 10
}, this.slot());
app.builds.getDoneStreak({projectName: project.name}, this.slot());
},
function(err, doneBuilds, doneBuildsStreak) {
project.avgBuildDuration = app.builds.getAvgBuildDuration(doneBuilds);
project.lastDoneBuild = doneBuilds[0];
project.doneBuildsStreak = doneBuildsStreak;
this.pass(project);
},
callback
);
};
// resource custom method which finds project by name
// and emits event about it change to clients
resource.clientEmitSyncChange = function(name) {
Steppy(
function() {
getProject(name, this.slot());
},
function(err, project) {
resource.clientEmitSync('change', {project: project});
},
function(err) {
console.error(
'Error during sync project change occurred:',
err.stack || err
);
}
);
};
resource.use('read', function(req, res) {
Steppy(
function() {
getProject(req.data.name, this.slot());
},
function(err, project) {
res.send(project);
}
);
});
resource.use('run', function(req, res) {
var projectName = req.data.projectName;
logger.log('Run the project: "%s"', projectName);
app.builds.create({
projectName: projectName,
initiator: {type: 'user'},
queueQueued: true
});
res.send();
});
return resource;
};

View File

@ -1,26 +0,0 @@
@import url(http://fonts.googleapis.com/css?family=Open+Sans:400,700&subset=latin,cyrillic-ext);
@bowerPath: "../js/libs";
// bootstrap
@import "@{bowerPath}/bootstrap/less/bootstrap.less";
/*//flatly*/
@import "./sources/common/variables-flatly.less";
//font-awesome
@import "@{bowerPath}/font-awesome/less/font-awesome.less";
//variables
@import "./sources/common/variables.less";
//fonts
@import "./sources/common/fonts.less";
//layout
@import "./sources/components/layout.less";
//components
@import "./sources/components/builds.less";
@import "./sources/components/projects.less";
@import "./sources/components/terminal.less";

View File

@ -1 +0,0 @@
@import url(http://fonts.googleapis.com/css?family=Ubuntu&subset=latin,cyrillic);

View File

@ -1,861 +0,0 @@
// Flatly 3.3.4
// Variables
// --------------------------------------------------
//== Colors
//
//## Gray and brand colors for use across Bootstrap.
@gray-base: #000;
@gray-darker: lighten(@gray-base, 13.5%); // #222
@gray-dark: #7b8a8b; // #333
@gray: #95a5a6; // #555
@gray-light: #b4bcc2; // #999
@gray-lighter: #ecf0f1; // #eee
@brand-primary: #2C3E50;
@brand-success: #18BC9C;
@brand-info: #3498DB;
@brand-warning: #F39C12;
@brand-danger: #E74C3C;
//== Scaffolding
//
//## Settings for some of the most global styles.
//** Background color for `<body>`.
@body-bg: #fff;
//** Global text color on `<body>`.
@text-color: @brand-primary;
//** Global textual link color.
@link-color: @brand-success;
//** Link hover color set via `darken()` function.
@link-hover-color: @link-color;
//** Link hover decoration.
@link-hover-decoration: underline;
//== Typography
//
//## Font, line-height, and color for body text, headings, and more.
@font-family-sans-serif: "Lato", "Helvetica Neue", Helvetica, Arial, sans-serif;
@font-family-serif: Georgia, "Times New Roman", Times, serif;
//** Default monospace fonts for `<code>`, `<kbd>`, and `<pre>`.
@font-family-monospace: Menlo, Monaco, Consolas, "Courier New", monospace;
@font-family-base: @font-family-sans-serif;
@font-size-base: 15px;
@font-size-large: ceil((@font-size-base * 1.25)); // ~18px
@font-size-small: ceil((@font-size-base * 0.85)); // ~12px
@font-size-h1: floor((@font-size-base * 2.6)); // ~36px
@font-size-h2: floor((@font-size-base * 2.15)); // ~30px
@font-size-h3: ceil((@font-size-base * 1.7)); // ~24px
@font-size-h4: ceil((@font-size-base * 1.25)); // ~18px
@font-size-h5: @font-size-base;
@font-size-h6: ceil((@font-size-base * 0.85)); // ~12px
//** Unit-less `line-height` for use in components like buttons.
@line-height-base: 1.428571429; // 20/14
//** Computed "line-height" (`font-size` * `line-height`) for use with `margin`, `padding`, etc.
@line-height-computed: floor((@font-size-base * @line-height-base)); // ~20px
//** By default, this inherits from the `<body>`.
@headings-font-family: @font-family-base;
@headings-font-weight: 400;
@headings-line-height: 1.1;
@headings-color: inherit;
//== Iconography
//
//## Specify custom location and filename of the included Glyphicons icon font. Useful for those including Bootstrap via Bower.
//** Load fonts from this directory.
@icon-font-path: "../fonts/";
//** File name for all font files.
@icon-font-name: "glyphicons-halflings-regular";
//** Element ID within SVG icon file.
@icon-font-svg-id: "glyphicons_halflingsregular";
//== Components
//
//## Define common padding and border radius sizes and more. Values based on 14px text and 1.428 line-height (~20px to start).
@padding-base-vertical: 10px;
@padding-base-horizontal: 15px;
@padding-large-vertical: 18px;
@padding-large-horizontal: 27px;
@padding-small-vertical: 6px;
@padding-small-horizontal: 9px;
@padding-xs-vertical: 1px;
@padding-xs-horizontal: 5px;
@line-height-large: 1.3333333; // extra decimals for Win 8.1 Chrome
@line-height-small: 1.5;
@border-radius-base: 4px;
@border-radius-large: 6px;
@border-radius-small: 3px;
//** Global color for active items (e.g., navs or dropdowns).
@component-active-color: #fff;
//** Global background color for active items (e.g., navs or dropdowns).
@component-active-bg: @brand-primary;
//** Width of the `border` for generating carets that indicator dropdowns.
@caret-width-base: 4px;
//** Carets increase slightly in size for larger components.
@caret-width-large: 5px;
//== Tables
//
//## Customizes the `.table` component with basic values, each used across all table variations.
//** Padding for `<th>`s and `<td>`s.
@table-cell-padding: 8px;
//** Padding for cells in `.table-condensed`.
@table-condensed-cell-padding: 5px;
//** Default background color used for all tables.
@table-bg: transparent;
//** Background color used for `.table-striped`.
@table-bg-accent: #f9f9f9;
//** Background color used for `.table-hover`.
@table-bg-hover: @gray-lighter;
@table-bg-active: @table-bg-hover;
//** Border color for table and cell borders.
@table-border-color: @gray-lighter;
//== Buttons
//
//## For each of Bootstrap's buttons, define text, background and border color.
@btn-font-weight: normal;
@btn-default-color: #fff;
@btn-default-bg: @gray;
@btn-default-border: @btn-default-bg;
@btn-primary-color: @btn-default-color;
@btn-primary-bg: @brand-primary;
@btn-primary-border: @btn-primary-bg;
@btn-success-color: @btn-default-color;
@btn-success-bg: @brand-success;
@btn-success-border: @btn-success-bg;
@btn-info-color: @btn-default-color;
@btn-info-bg: @brand-info;
@btn-info-border: @btn-info-bg;
@btn-warning-color: @btn-default-color;
@btn-warning-bg: @brand-warning;
@btn-warning-border: @btn-warning-bg;
@btn-danger-color: @btn-default-color;
@btn-danger-bg: @brand-danger;
@btn-danger-border: @btn-danger-bg;
@btn-link-disabled-color: @gray-light;
//== Forms
//
//##
//** `<input>` background color
@input-bg: #fff;
//** `<input disabled>` background color
@input-bg-disabled: @gray-lighter;
//** Text color for `<input>`s
@input-color: @text-color;
//** `<input>` border color
@input-border: #dce4ec;
// TODO: Rename `@input-border-radius` to `@input-border-radius-base` in v4
//** Default `.form-control` border radius
// This has no effect on `<select>`s in some browsers, due to the limited stylability of `<select>`s in CSS.
@input-border-radius: @border-radius-base;
//** Large `.form-control` border radius
@input-border-radius-large: @border-radius-large;
//** Small `.form-control` border radius
@input-border-radius-small: @border-radius-small;
//** Border color for inputs on focus
@input-border-focus: @brand-primary;
//** Placeholder text color
@input-color-placeholder: #acb6c0;
//** Default `.form-control` height
@input-height-base: (@line-height-computed + (@padding-base-vertical * 2) + 4);
//** Large `.form-control` height
@input-height-large: (ceil(@font-size-large * @line-height-large) + (@padding-large-vertical * 2) + 4);
//** Small `.form-control` height
@input-height-small: (floor(@font-size-small * @line-height-small) + (@padding-small-vertical * 2) + 4);
//** `.form-group` margin
@form-group-margin-bottom: 15px;
@legend-color: @text-color;
@legend-border-color: transparent;
//** Background color for textual input addons
@input-group-addon-bg: @gray-lighter;
//** Border color for textual input addons
@input-group-addon-border-color: @input-border;
//** Disabled cursor for form controls and buttons.
@cursor-disabled: not-allowed;
//== Dropdowns
//
//## Dropdown menu container and contents.
//** Background for the dropdown menu.
@dropdown-bg: #fff;
//** Dropdown menu `border-color`.
@dropdown-border: rgba(0,0,0,.15);
//** Dropdown menu `border-color` **for IE8**.
@dropdown-fallback-border: #ccc;
//** Divider color for between dropdown items.
@dropdown-divider-bg: #e5e5e5;
//** Dropdown link text color.
@dropdown-link-color: @gray-dark;
//** Hover color for dropdown links.
@dropdown-link-hover-color: #fff;
//** Hover background for dropdown links.
@dropdown-link-hover-bg: @component-active-bg;
//** Active dropdown menu item text color.
@dropdown-link-active-color: #fff;
//** Active dropdown menu item background color.
@dropdown-link-active-bg: @component-active-bg;
//** Disabled dropdown menu item background color.
@dropdown-link-disabled-color: @gray-light;
//** Text color for headers within dropdown menus.
@dropdown-header-color: @gray-light;
//** Deprecated `@dropdown-caret-color` as of v3.1.0
@dropdown-caret-color: #000;
//-- Z-index master list
//
// Warning: Avoid customizing these values. They're used for a bird's eye view
// of components dependent on the z-axis and are designed to all work together.
//
// Note: These variables are not generated into the Customizer.
@zindex-navbar: 1000;
@zindex-dropdown: 1000;
@zindex-popover: 1060;
@zindex-tooltip: 1070;
@zindex-navbar-fixed: 1030;
@zindex-modal-background: 1040;
@zindex-modal: 1050;
//== Media queries breakpoints
//
//## Define the breakpoints at which your layout will change, adapting to different screen sizes.
// Extra small screen / phone
//** Deprecated `@screen-xs` as of v3.0.1
@screen-xs: 480px;
//** Deprecated `@screen-xs-min` as of v3.2.0
@screen-xs-min: @screen-xs;
//** Deprecated `@screen-phone` as of v3.0.1
@screen-phone: @screen-xs-min;
// Small screen / tablet
//** Deprecated `@screen-sm` as of v3.0.1
@screen-sm: 768px;
@screen-sm-min: @screen-sm;
//** Deprecated `@screen-tablet` as of v3.0.1
@screen-tablet: @screen-sm-min;
// Medium screen / desktop
//** Deprecated `@screen-md` as of v3.0.1
@screen-md: 992px;
@screen-md-min: @screen-md;
//** Deprecated `@screen-desktop` as of v3.0.1
@screen-desktop: @screen-md-min;
// Large screen / wide desktop
//** Deprecated `@screen-lg` as of v3.0.1
@screen-lg: 1200px;
@screen-lg-min: @screen-lg;
//** Deprecated `@screen-lg-desktop` as of v3.0.1
@screen-lg-desktop: @screen-lg-min;
// So media queries don't overlap when required, provide a maximum
@screen-xs-max: (@screen-sm-min - 1);
@screen-sm-max: (@screen-md-min - 1);
@screen-md-max: (@screen-lg-min - 1);
//== Grid system
//
//## Define your custom responsive grid.
//** Number of columns in the grid.
@grid-columns: 12;
//** Padding between columns. Gets divided in half for the left and right.
@grid-gutter-width: 30px;
// Navbar collapse
//** Point at which the navbar becomes uncollapsed.
@grid-float-breakpoint: @screen-sm-min;
//** Point at which the navbar begins collapsing.
@grid-float-breakpoint-max: (@grid-float-breakpoint - 1);
//== Container sizes
//
//## Define the maximum width of `.container` for different screen sizes.
// Small screen / tablet
@container-tablet: (720px + @grid-gutter-width);
//** For `@screen-sm-min` and up.
@container-sm: @container-tablet;
// Medium screen / desktop
@container-desktop: (940px + @grid-gutter-width);
//** For `@screen-md-min` and up.
@container-md: @container-desktop;
// Large screen / wide desktop
@container-large-desktop: (1140px + @grid-gutter-width);
//** For `@screen-lg-min` and up.
@container-lg: @container-large-desktop;
//== Navbar
//
//##
// Basics of a navbar
@navbar-height: 60px;
@navbar-margin-bottom: @line-height-computed;
@navbar-border-radius: @border-radius-base;
@navbar-padding-horizontal: floor((@grid-gutter-width / 2));
@navbar-padding-vertical: ((@navbar-height - @line-height-computed) / 2);
@navbar-collapse-max-height: 340px;
@navbar-default-color: #777;
@navbar-default-bg: @brand-primary;
@navbar-default-border: transparent;
// Navbar links
@navbar-default-link-color: #fff;
@navbar-default-link-hover-color: @brand-success;
@navbar-default-link-hover-bg: transparent;
@navbar-default-link-active-color: #fff;
@navbar-default-link-active-bg: darken(@navbar-default-bg, 10%);
@navbar-default-link-disabled-color: #ccc;
@navbar-default-link-disabled-bg: transparent;
// Navbar brand label
@navbar-default-brand-color: @navbar-default-link-color;
@navbar-default-brand-hover-color: @navbar-default-link-hover-color;
@navbar-default-brand-hover-bg: transparent;
// Navbar toggle
@navbar-default-toggle-hover-bg: darken(@navbar-default-bg, 10%);
@navbar-default-toggle-icon-bar-bg: #fff;
@navbar-default-toggle-border-color: darken(@navbar-default-bg, 10%);
// Inverted navbar
// Reset inverted navbar basics
@navbar-inverse-color: #fff;
@navbar-inverse-bg: @brand-success;
@navbar-inverse-border: transparent;
// Inverted navbar links
@navbar-inverse-link-color: #fff;
@navbar-inverse-link-hover-color: @brand-primary;
@navbar-inverse-link-hover-bg: transparent;
@navbar-inverse-link-active-color: #fff;
@navbar-inverse-link-active-bg: darken(@navbar-inverse-bg, 5%);
@navbar-inverse-link-disabled-color: #ccc;
@navbar-inverse-link-disabled-bg: transparent;
// Inverted navbar brand label
@navbar-inverse-brand-color: @navbar-inverse-link-color;
@navbar-inverse-brand-hover-color: @navbar-inverse-link-hover-color;
@navbar-inverse-brand-hover-bg: transparent;
// Inverted navbar toggle
@navbar-inverse-toggle-hover-bg: darken(@navbar-inverse-bg, 10%);
@navbar-inverse-toggle-icon-bar-bg: #fff;
@navbar-inverse-toggle-border-color: darken(@navbar-inverse-bg, 10%);
//== Navs
//
//##
//=== Shared nav styles
@nav-link-padding: 10px 15px;
@nav-link-hover-bg: @gray-lighter;
@nav-disabled-link-color: @gray-light;
@nav-disabled-link-hover-color: @gray-light;
//== Tabs
@nav-tabs-border-color: @gray-lighter;
@nav-tabs-link-hover-border-color: @gray-lighter;
@nav-tabs-active-link-hover-bg: @body-bg;
@nav-tabs-active-link-hover-color: @brand-primary;
@nav-tabs-active-link-hover-border-color: @gray-lighter;
@nav-tabs-justified-link-border-color: @gray-lighter;
@nav-tabs-justified-active-link-border-color: @body-bg;
//== Pills
@nav-pills-border-radius: @border-radius-base;
@nav-pills-active-link-hover-bg: @component-active-bg;
@nav-pills-active-link-hover-color: @component-active-color;
//== Pagination
//
//##
@pagination-color: #fff;
@pagination-bg: @brand-success;
@pagination-border: transparent;
@pagination-hover-color: #fff;
@pagination-hover-bg: darken(@brand-success, 15%);
@pagination-hover-border: transparent;
@pagination-active-color: #fff;
@pagination-active-bg: darken(@brand-success, 15%);
@pagination-active-border: transparent;
@pagination-disabled-color: @gray-lighter;
@pagination-disabled-bg: lighten(@brand-success, 15%);
@pagination-disabled-border: transparent;
//== Pager
//
//##
@pager-bg: @pagination-bg;
@pager-border: @pagination-border;
@pager-border-radius: 15px;
@pager-hover-bg: @pagination-hover-bg;
@pager-active-bg: @pagination-active-bg;
@pager-active-color: @pagination-active-color;
@pager-disabled-color: #fff;
//== Jumbotron
//
//##
@jumbotron-padding: 30px;
@jumbotron-color: inherit;
@jumbotron-bg: @gray-lighter;
@jumbotron-heading-color: inherit;
@jumbotron-font-size: ceil((@font-size-base * 1.5));
//== Form states and alerts
//
//## Define colors for form feedback states and, by default, alerts.
@state-success-text: #fff;
@state-success-bg: @brand-success;
@state-success-border: @brand-success;
@state-info-text: #fff;
@state-info-bg: @brand-info;
@state-info-border: @brand-info;
@state-warning-text: #fff;
@state-warning-bg: @brand-warning;
@state-warning-border: @brand-warning;
@state-danger-text: #fff;
@state-danger-bg: @brand-danger;
@state-danger-border: @brand-danger;
//== Tooltips
//
//##
//** Tooltip max width
@tooltip-max-width: 200px;
//** Tooltip text color
@tooltip-color: #fff;
//** Tooltip background color
@tooltip-bg: #000;
@tooltip-opacity: .9;
//** Tooltip arrow width
@tooltip-arrow-width: 5px;
//** Tooltip arrow color
@tooltip-arrow-color: @tooltip-bg;
//== Popovers
//
//##
//** Popover body background color
@popover-bg: #fff;
//** Popover maximum width
@popover-max-width: 276px;
//** Popover border color
@popover-border-color: rgba(0,0,0,.2);
//** Popover fallback border color
@popover-fallback-border-color: #ccc;
//** Popover title background color
@popover-title-bg: darken(@popover-bg, 3%);
//** Popover arrow width
@popover-arrow-width: 10px;
//** Popover arrow color
@popover-arrow-color: @popover-bg;
//** Popover outer arrow width
@popover-arrow-outer-width: (@popover-arrow-width + 1);
//** Popover outer arrow color
@popover-arrow-outer-color: fadein(@popover-border-color, 5%);
//** Popover outer arrow fallback color
@popover-arrow-outer-fallback-color: darken(@popover-fallback-border-color, 20%);
//== Labels
//
//##
//** Default label background color
@label-default-bg: @btn-default-bg;
//** Primary label background color
@label-primary-bg: @brand-primary;
//** Success label background color
@label-success-bg: @brand-success;
//** Info label background color
@label-info-bg: @brand-info;
//** Warning label background color
@label-warning-bg: @brand-warning;
//** Danger label background color
@label-danger-bg: @brand-danger;
//** Default label text color
@label-color: #fff;
//** Default text color of a linked label
@label-link-hover-color: #fff;
//== Modals
//
//##
//** Padding applied to the modal body
@modal-inner-padding: 20px;
//** Padding applied to the modal title
@modal-title-padding: 15px;
//** Modal title line-height
@modal-title-line-height: @line-height-base;
//** Background color of modal content area
@modal-content-bg: #fff;
//** Modal content border color
@modal-content-border-color: rgba(0,0,0,.2);
//** Modal content border color **for IE8**
@modal-content-fallback-border-color: #999;
//** Modal backdrop background color
@modal-backdrop-bg: #000;
//** Modal backdrop opacity
@modal-backdrop-opacity: .5;
//** Modal header border color
@modal-header-border-color: #e5e5e5;
//** Modal footer border color
@modal-footer-border-color: @modal-header-border-color;
@modal-lg: 900px;
@modal-md: 600px;
@modal-sm: 300px;
//== Alerts
//
//## Define alert colors, border radius, and padding.
@alert-padding: 15px;
@alert-border-radius: @border-radius-base;
@alert-link-font-weight: bold;
@alert-success-bg: @state-success-bg;
@alert-success-text: @state-success-text;
@alert-success-border: @state-success-border;
@alert-info-bg: @state-info-bg;
@alert-info-text: @state-info-text;
@alert-info-border: @state-info-border;
@alert-warning-bg: @state-warning-bg;
@alert-warning-text: @state-warning-text;
@alert-warning-border: @state-warning-border;
@alert-danger-bg: @state-danger-bg;
@alert-danger-text: @state-danger-text;
@alert-danger-border: @state-danger-border;
//== Progress bars
//
//##
//** Background color of the whole progress component
@progress-bg: @gray-lighter;
//** Progress bar text color
@progress-bar-color: #fff;
//** Variable for setting rounded corners on progress bar.
@progress-border-radius: @border-radius-base;
//** Default progress bar color
@progress-bar-bg: @brand-primary;
//** Success progress bar color
@progress-bar-success-bg: @brand-success;
//** Warning progress bar color
@progress-bar-warning-bg: @brand-warning;
//** Danger progress bar color
@progress-bar-danger-bg: @brand-danger;
//** Info progress bar color
@progress-bar-info-bg: @brand-info;
//== List group
//
//##
//** Background color on `.list-group-item`
@list-group-bg: #fff;
//** `.list-group-item` border color
@list-group-border: @gray-lighter;
//** List group border radius
@list-group-border-radius: @border-radius-base;
//** Background color of single list items on hover
@list-group-hover-bg: @gray-lighter;
//** Text color of active list items
@list-group-active-color: @component-active-color;
//** Background color of active list items
@list-group-active-bg: @component-active-bg;
//** Border color of active list elements
@list-group-active-border: @list-group-active-bg;
//** Text color for content within active list items
@list-group-active-text-color: lighten(@list-group-active-bg, 40%);
//** Text color of disabled list items
@list-group-disabled-color: @gray-light;
//** Background color of disabled list items
@list-group-disabled-bg: @gray-lighter;
//** Text color for content within disabled list items
@list-group-disabled-text-color: @list-group-disabled-color;
@list-group-link-color: #555;
@list-group-link-hover-color: @list-group-link-color;
@list-group-link-heading-color: #333;
//== Panels
//
//##
@panel-bg: #fff;
@panel-body-padding: 15px;
@panel-heading-padding: 10px 15px;
@panel-footer-padding: @panel-heading-padding;
@panel-border-radius: @border-radius-base;
//** Border color for elements within panels
@panel-inner-border: @gray-lighter;
@panel-footer-bg: @gray-lighter;
@panel-default-text: @text-color;
@panel-default-border: @gray-lighter;
@panel-default-heading-bg: @gray-lighter;
@panel-primary-text: #fff;
@panel-primary-border: @brand-primary;
@panel-primary-heading-bg: @brand-primary;
@panel-success-text: @state-success-text;
@panel-success-border: @state-success-border;
@panel-success-heading-bg: @state-success-bg;
@panel-info-text: @state-info-text;
@panel-info-border: @state-info-border;
@panel-info-heading-bg: @state-info-bg;
@panel-warning-text: @state-warning-text;
@panel-warning-border: @state-warning-border;
@panel-warning-heading-bg: @state-warning-bg;
@panel-danger-text: @state-danger-text;
@panel-danger-border: @state-danger-border;
@panel-danger-heading-bg: @state-danger-bg;
//== Thumbnails
//
//##
//** Padding around the thumbnail image
@thumbnail-padding: 4px;
//** Thumbnail background color
@thumbnail-bg: @body-bg;
//** Thumbnail border color
@thumbnail-border: @gray-lighter;
//** Thumbnail border radius
@thumbnail-border-radius: @border-radius-base;
//** Custom text color for thumbnail captions
@thumbnail-caption-color: @text-color;
//** Padding around the thumbnail caption
@thumbnail-caption-padding: 9px;
//== Wells
//
//##
@well-bg: @gray-lighter;
@well-border: transparent;
//== Badges
//
//##
@badge-color: #fff;
//** Linked badge text color on hover
@badge-link-hover-color: #fff;
@badge-bg: @brand-primary;
//** Badge text color in active nav link
@badge-active-color: @brand-primary;
//** Badge background color in active nav link
@badge-active-bg: #fff;
@badge-font-weight: bold;
@badge-line-height: 1;
@badge-border-radius: 10px;
//== Breadcrumbs
//
//##
@breadcrumb-padding-vertical: 8px;
@breadcrumb-padding-horizontal: 15px;
//** Breadcrumb background color
@breadcrumb-bg: @gray-lighter;
//** Breadcrumb text color
@breadcrumb-color: #ccc;
//** Text color of current page in the breadcrumb
@breadcrumb-active-color: @gray;
//** Textual separator for between breadcrumb elements
@breadcrumb-separator: "/";
//== Carousel
//
//##
@carousel-text-shadow: 0 1px 2px rgba(0,0,0,.6);
@carousel-control-color: #fff;
@carousel-control-width: 15%;
@carousel-control-opacity: .5;
@carousel-control-font-size: 20px;
@carousel-indicator-active-bg: #fff;
@carousel-indicator-border-color: #fff;
@carousel-caption-color: #fff;
//== Close
//
//##
@close-font-weight: bold;
@close-color: #000;
@close-text-shadow: none;
//== Code
//
//##
@code-color: #c7254e;
@code-bg: #f9f2f4;
@kbd-color: #fff;
@kbd-bg: #333;
@pre-bg: @gray-lighter;
@pre-color: @gray-dark;
@pre-border-color: #ccc;
@pre-scrollable-max-height: 340px;
//== Type
//
//##
//** Horizontal offset for forms and lists.
@component-offset-horizontal: 180px;
//** Text muted color
@text-muted: @gray-light;
//** Abbreviations and acronyms border color
@abbr-border-color: @gray-light;
//** Headings small color
@headings-small-color: @gray-light;
//** Blockquote small color
@blockquote-small-color: @gray-light;
//** Blockquote font size
@blockquote-font-size: (@font-size-base * 1.25);
//** Blockquote border color
@blockquote-border-color: @gray-lighter;
//** Page header border color
@page-header-border-color: transparent;
//** Width of horizontal description list titles
@dl-horizontal-offset: @component-offset-horizontal;
//** Horizontal line color.
@hr-border: @gray-lighter;

View File

@ -1 +0,0 @@
@font-size-base: 14px;

View File

@ -1,375 +0,0 @@
.build-view {
&_info {
}
&_terminal {
margin-top: 20px;
}
}
@animation-duration: 1.5s;
.builds {
&_item {
&:hover {
.builds {
&_buttons {
opacity: 1;
}
}
}
}
&_inner {
background: @well-bg;
padding: 15px;
}
&_header {
.make-xs-column(9);
}
&_controls {
.make-xs-column(3);
.text-right;
}
&_buttons {
transition: opacity 0.2s ease;
opacity: 0;
}
&_progress {
.progress {
height: 18px;
margin-bottom: 0;
}
}
&_status {
float: left;
margin-right: 8px;
}
&_info {
display: inline-block;
margin-right: 10px;
}
&__timeline {
position: relative;
.builds {
&_inner {
border-left: 6px solid darken(@well-bg, 10%);
}
&_header {
margin-bottom: 6px;
font-size: 18px;
}
&_progress {
padding: 3px 0;
}
&_item {
margin: 4px 0;
position: relative;
&:after {
content: '';
position: absolute;
border-radius: 50%;
background: @well-bg;
left: 0;
z-index: 1;
}
&:before {
content: '';
position: absolute;
border: 11px solid transparent;
top: 25px;
}
&__in-progress {
&:after {
background: @brand-info;
-webkit-animation: pulsate @animation-duration ease-out;
-webkit-animation-iteration-count: infinite;
-moz-animation: pulsate @animation-duration ease-out;
-moz-animation-iteration-count: infinite;
-o-animation: pulsate @animation-duration ease-out;
-o-animation-iteration-count: infinite;
animation: pulsate @animation-duration ease-out;
animation-iteration-count: infinite;
}
}
&__done {
&:after {
background: @link-color;
}
}
&__error {
&:after {
background: @brand-danger;
}
}
&__queued {
&:after {
background: @brand-primary;
}
}
}
}
&:after {
content: '';
position: absolute;
top: 0;
bottom: 0;
width: 2px;
margin-left: -1px;
background: darken(@well-bg, 10%);
}
&-large {
.builds {
&_item {
padding-left: 40px;
&:after {
width: 24px;
height: 24px;
top: 25px;
}
&:before {
left: 20px;
border-right-color: darken(@well-bg, 10%);
top: 25px;
}
}
}
&:after {
left: 12px;
}
}
&-small {
.builds {
&_item {
padding-left: 30px;
&:after {
top: 16px;
height: 16px;
width: 16px;
}
&:before {
left: 10px;
border-right-color: darken(@well-bg, 10%);
top: 13px;
}
&__current {
&:before {
left: 10px;
border-right-color: @component-active-bg;
top: 13px;
}
.builds {
&_inner {
border-left: 6px solid @component-active-bg;
}
}
}
}
&_header {
font-size: 14px;
.make-xs-column(7);
margin-bottom: 0;
}
&_controls {
.make-xs-column(5);
font-size: 12px;
}
&_progress {
padding: 1px 0;
}
}
&:after {
left: 8px;
}
}
}
}
@media (min-width: @screen-sm-min) {
.builds {
&__timeline {
&-large {
.builds {
&_item {
padding-left: 0;
display: inline-block;
vertical-align: top;
width: 50%;
margin: 10px 0;
&:after {
left: auto;
}
&:before {
left: auto;
border-right-color: transparent;
}
}
&_inner {
border-left: 0;
}
}
&:after {
left: 50%;
}
}
&-left {
.builds {
&_item {
&:nth-child(odd) {
padding-right: 30px;
.builds {
&_inner {
border-right: 6px solid darken(@well-bg, 10%);
}
}
&:after {
right: -12px;
}
&:before {
right: 10px;
border-left-color: darken(@well-bg, 10%);
}
}
&:nth-child(even) {
padding-left: 30px;
top: 50px;
.builds {
&_inner {
border-left: 6px solid darken(@well-bg, 10%);
}
}
&:after {
left: -12px;
}
&:before {
left: 10px;
border-right-color: darken(@well-bg, 10%);
}
}
}
}
}
&-right {
.builds {
&_item {
&:first-child {
margin-left: 50%;
}
&:nth-child(even) {
padding-right: 30px;
top: -50px;
.builds {
&_inner {
border-right: 6px solid darken(@well-bg, 10%);
}
}
&:after {
right: -12px;
}
&:before {
right: 10px;
border-left-color: darken(@well-bg, 10%);
}
}
&:nth-child(odd) {
padding-left: 30px;
.builds {
&_inner {
border-left: 6px solid darken(@well-bg, 10%);
}
}
&:after {
left: -12px;
}
&:before {
left: 10px;
border-right-color: darken(@well-bg, 10%);
}
}
}
}
}
}
}
}
.pulsate-frames() {
.transform(@scaleX, @scaleY) {
-webkit-transform: scale3d(@scaleX, @scaleY, 1);
-moz-transform: scale3d(@scaleX, @scaleY, 1);
-ms-transform: scale3d(@scaleX, @scaleY, 1);
-o-transform: scale3d(@scaleX, @scaleY, 1);
transform: scale3d(@scaleX, @scaleY, 1);
}
0% {
.transform(1, 1);
}
50% {
.transform(0.75, 0.75);
}
100% {
.transform(1, 1);
}
}
@-webkit-keyframes pulsate {.pulsate-frames}
@-moz-keyframes pulsate {.pulsate-frames}
@-ms-keyframes pulsate {.pulsate-frames}
@-o-keyframes pulsate {.pulsate-frames}
@keyframes pulsate {.pulsate-frames}

View File

@ -1,18 +0,0 @@
body {
font-family: 'Open Sans', sans-serif;
padding-top: @navbar-height;
min-width: 320px;
}
.page-wrapper {
padding: 20px 0;
}
.page-header {
margin-top: 0;
border-bottom-color: #d7d7d7;
.small {
font-size: @font-size-base;
}
}

View File

@ -1,65 +0,0 @@
.projects-selector {
position: relative;
width: 300px;
color: white;
cursor: pointer;
&_preview {
color: rgba(255, 255, 255, 0.5);
padding: 5px 25px 5px 5px;
&_text {
padding-left: 10px;
}
}
&_input {
width: 80%;
padding-bottom: 3px;
padding-left: 10px;
border: none;
border-bottom: 1px solid rgba(255, 255, 255, 0.5);
background: transparent;
outline: none;
}
&_items {
position: absolute;
width: 100%;
padding: 0;
padding-top: 15px;
left: 0;
background: @brand-primary;
list-style: none;
}
&_item {
.clearfix();
padding: 10px 10px;
&_link {
float: left;
width: 90%;
color: white;
text-decoration: none;
&:hover {
color: white;
text-decoration: none;
}
}
&_run {
float: right;
width: 10%;
color: rgba(255, 255, 255, 0.5);
text-align: right;
&:hover {
color: white;
text-decoration: none;
}
}
&:hover {
background: lighten(@brand-primary, 10%);
}
}
}

View File

@ -1,63 +0,0 @@
.terminal {
box-sizing: border-box;
position: relative;
&_header {
}
&_code {
display: table;
width: 100%;
padding: 10px 0;
color: #f1f1f1;
font-family: monospace;
font-size: 12px;
line-height: 18px;
white-space: pre-wrap;
word-wrap: break-word;
background-color: #2a2a2a;
counter-reset: line-numbering;
}
&_footer {
}
}
.code-line {
display: table-row;
&_counter {
display: table-cell;
width: 1px;
vertical-align: top;
text-align: right;
cursor: pointer;
text-decoration: none;
color: darken(@gray-lighter, 15%);
padding: 0 10px;
border-right: 1px solid rgba(255, 255, 255, 0.1);
white-space: nowrap;
&:before {
content: counter(line-numbering);
counter-increment: line-numbering;
}
&:hover {
text-decoration: none;
color: @gray-lighter;
}
}
&_body {
display: table-cell;
vertical-align: top;
padding: 0 10px;
}
&:hover {
background-color: #444;
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

View File

@ -1,2 +0,0 @@
// client build for production replaces this file, this file exists only
// for jade include - file must exists even if include is conditional

View File

@ -1,12 +0,0 @@
'use strict';
define(['reflux'], function(Reflux) {
var Actions = Reflux.createActions([
'cancel',
'readTerminalOutput',
'readAll',
'read'
]);
return Actions;
});

View File

@ -1,10 +0,0 @@
'use strict';
define(['reflux'], function(Reflux) {
var Actions = Reflux.createActions([
'getTail',
'getLines'
]);
return Actions;
});

View File

@ -1,11 +0,0 @@
'use strict';
define(['reflux'], function(Reflux) {
var Actions = Reflux.createActions([
'run',
'readAll',
'read'
]);
return Actions;
});

View File

@ -1,42 +0,0 @@
'use strict';
define([
'react',
'react-router',
'templates/app/components/app/index',
'app/components/index',
'app/actions/project', 'app/actions/build'
], function(
React,
Router,
template,
Components,
ProjectActions, BuildActions
) {
var Route = React.createFactory(Router.Route),
DefaultRoute = React.createFactory(Router.DefaultRoute);
var routes = (
Route({handler: Components.App},
Route({name: 'dashboard', path: '/', handler: Components.Dashboard}),
Route({
name: 'project',
path: 'projects/:name',
handler: Components.Project.View
}),
Route({name: 'build', path: 'builds/:id', handler: Components.Build.View}),
Route({
name: 'buildLog',
path: 'builds/:buildId/log',
handler: Components.BuildLog
})
)
);
Router.run(routes, Router.HistoryLocation, function(Handler) {
React.render(
React.createElement(Handler),
document.getElementById('content')
);
});
});

View File

@ -1,6 +0,0 @@
div
Header()
.container-fluid
.page-wrapper
RouteHandler()

View File

@ -1,24 +0,0 @@
'use strict';
define([
'react',
'react-router',
'app/actions/project',
'app/components/header/index',
'templates/app/components/app/index'
], function(React, Router, ProjectActions, Header, template) {
template = template.locals({
Link: Router.Link,
Header: Header,
RouteHandler: Router.RouteHandler
});
var Component = React.createClass({
componentWillMount: function() {
ProjectActions.readAll();
},
render: template
});
return Component;
});

View File

@ -1,30 +0,0 @@
- var buildId = this.props.params.buildId;
- var total = this.state.data.total;
- var output = this.state.data.output;
div
| build:
span= buildId
div
| lines in total:
span= total
div
| from:
input(type="text", value=this.state.from, onChange=this.onFromChange)
br
.terminal(style="width: 900px; float: left;")
.terminal_code(ref="code")!= output
div.terminal-virtual-scroll(
style="width: 15px; height: 320px; overflow: scroll; float: clear;",
onScroll=this.onVirtualScroll
)
- var height = total * 15;
div(style="height: #{height}px;")
div
| virtual scroll top:
span= this.state.virtualScrollTop

View File

@ -1,78 +0,0 @@
'use strict';
define([
'react', 'reflux', 'app/actions/buildLog', 'app/stores/buildLog',
'ansi_up', 'underscore', 'templates/app/components/buildLog/index',
'jquery'
], function(
React, Reflux, BuildLogActions, buildLogStore,
ansiUp, _, template,
$
) {
var chunkSize = 40;
return React.createClass({
mixins: [
Reflux.connectFilter(buildLogStore, 'data', function(data) {
data.output = _(data.lines).pluck('text').join('<br>');
data.output = data.output.replace(
/(.*)\n/gi,
'<span class="terminal_code_newline">$1</span>'
);
data.output = ansiUp.ansi_to_html(data.output);
return data;
})
],
statics: {
willTransitionTo: function(transition, params, query) {
BuildLogActions.getTail({buildId: params.buildId, length: chunkSize});
}
},
onFromChange: function(event) {
var from = Number(event.target.value);
this.setState({from: from});
BuildLogActions.getLines({
buildId: this.props.params.buildId,
from: from,
to: from + chunkSize - 1
});
},
onVirtualScroll: function(event) {
this.virtualScrollTop = $(event.target).scrollTop();
this.setState({virtualScrollTop: this.virtualScrollTop});
var isDown = this.virtualScrollTop > this.lastVirtualScrollTop;
var inc = isDown ? 15 : -15;
var scrollTop = $('.terminal_code').scrollTop(),
viewHeight = $('.terminal_code').height(),
contentHeight = $('.terminal_code div:first').height();
if (
(isDown && scrollTop + viewHeight + inc < contentHeight) ||
(!isDown && scrollTop + inc > 0)
) {
$('.terminal_code').scrollTop(scrollTop + inc);
} else {
var lines = this.state.data.lines,
line = lines[isDown ? lines.length - 1 : 0],
from = isDown ? line.number : line.number - chunkSize;
from = from < 0 ? 1 : from;
console.log('>>> end = ', line, from);
BuildLogActions.getLines({
buildId: this.props.params.buildId,
from: from,
to: from + chunkSize - 1
});
}
this.lastVirtualScrollTop = this.virtualScrollTop;
},
render: template
});
});

View File

@ -1,20 +0,0 @@
.builds.builds__timeline.builds__timeline-small
each item in this.state.items
- var buildItemClasses = ['builds_item__' + item.status];
- if (item.id === this.props.currentBuild.id) buildItemClasses.push('builds_item__current');
.builds_item(key=item.id, class=buildItemClasses)
.builds_inner
.row
.builds_header
Link(to="build", params={id: item.id})
span build #
span= item.number
.builds_controls
if item.status === 'in-progress'
.builds_progress
if item.project.avgBuildDuration
Progress(build=item)
if !item.endDate
DateTime(value=item.endDate)

View File

@ -1,33 +0,0 @@
'use strict';
define([
'underscore',
'react', 'react-router',
'app/stores/builds', 'reflux',
'templates/app/components/buildSidebar/index', 'app/components/common/index',
], function(
_,
React, Router,
buildsStore, Reflux,
template, CommonComponents
) {
template = template.locals(_({
Link: Router.Link
}).extend(CommonComponents));
return React.createClass({
mixins: [
Reflux.connectFilter(buildsStore, 'items', function(items) {
var projectName = this.props.projectName;
if (projectName) {
return _(items).filter(function(item) {
return item.project && item.project.name === projectName;
});
} else {
return items;
}
})
],
render: template
});
});

View File

@ -1,13 +0,0 @@
'use strict';
define([
'app/components/builds/item',
'app/components/builds/list',
'app/components/builds/view'
], function(Item, List, View) {
return {
Item: Item,
List: List,
View: View
};
});

View File

@ -1,92 +0,0 @@
mixin statusText(build)
if build.status === 'in-progress'
span in progress
if build.status === 'queued'
span queued
if build.status === 'done'
span done
if build.status === 'error'
span error
- var build = this.props.build;
.builds_item(class="builds_item__#{build.status}")
.builds_inner
.row
.builds_header
if build.project
span
Scm(scm=build.project.scm.type)
|
Link(to="project", params={name: build.project.name})
span= build.project.name
|
if build.number
span(style={fontSize: '15px', color: '#a6a6a6'}) build
|
if build.status !== 'queued'
Link(to="build", params={id: build.id})
span #
span= build.number
else
span #
span= build.number
if build.waitReason
span (
span= build.waitReason
span , waiting)
if build.status === 'in-progress' && build.currentStep
span (
span= build.currentStep
span )
.builds_controls
if build.completed
.builds_buttons
a.btn.btn-sm.btn-default(href="javascript:void(0);", onClick=this.onRebuildProject(build.project.name))
i.fa.fa-fw.fa-repeat(title="Rebuild")
|
| Build again
if build.status === 'in-progress'
.builds_progress
if build.project.avgBuildDuration
Progress(build=build)
if build.status === 'queued'
.builds_buttons
a.btn.btn-sm.btn-default(href="javascript:void(0);", onClick=this.onCancelBuild(build.id))
i.fa.fa-fw.fa-times(title="Cancel build")
|
| Cancel build
.builds_content
if build.endDate
span.builds_info
i.fa.fa-fw.fa-clock-o
| finished
DateTime(value=build.endDate)
|
Duration(value=(build.endDate - build.startDate), withSuffix=true)
else
if build.startDate
span.builds_info
i.fa.fa-fw.fa-clock-o
| started
DateTime(value=build.startDate)
else
span.builds_info
i.fa.fa-fw.fa-clock-o
| queued
DateTime(value=build.createDate)
|
if build.scm
span.builds_info
i.fa.fa-fw.fa-comment-o
|
span= utils.prune(build.scm.rev.comment, 40)

View File

@ -1,47 +0,0 @@
'use strict';
define([
'react', 'react-router', 'app/actions/project',
'app/actions/build', 'templates/app/components/builds/item',
'app/components/terminal/terminal', 'app/components/common/index',
'app/utils'
], function(
React, Router, ProjectActions,
BuildActions, template,
TerminalComponent, CommonComponents,
utils
) {
template = template.locals({
DateTime: CommonComponents.DateTime,
Duration: CommonComponents.Duration,
Progress: CommonComponents.Progress,
Scm: CommonComponents.Scm,
Terminal: TerminalComponent,
Link: Router.Link,
utils: utils
});
var Component = React.createClass({
getInitialState: function() {
return {
showTerminal: false
};
},
onRebuildProject: function(projectName) {
ProjectActions.run(projectName)
},
onCancelBuild: function(buildId) {
BuildActions.cancel(buildId);
},
onShowTerminal: function(build) {
this.setState({showTerminal: !this.state.showTerminal});
BuildActions.readTerminalOutput(this.props.build);
},
onBuildSelect: function(buildId) {
console.log('on build select');
},
render: template
});
return Component;
});

View File

@ -1,15 +0,0 @@
- var itemsCount = this.state.items.length;
if itemsCount
.builds.builds__timeline.builds__timeline-large(class="builds__timeline-#{itemsCount % 2 ? 'left' : 'right'}")
each build, index in this.state.items
Item(build=build, key=build.id)
else
p Build history is empty
if itemsCount && itemsCount % 20 === 0
.text-center
a.btn.btn-sm.btn-default(href="javascript:void(0);", onClick=this.onShowMoreBuilds(this.props.projectName))
i.fa.fa-fw.fa-plus(title="Show more builds")
|
| Show more builds

View File

@ -1,39 +0,0 @@
'use strict';
define([
'react',
'reflux',
'underscore',
'./item',
'app/actions/build',
'app/stores/builds',
'templates/app/components/builds/list'
], function(React, Reflux, _, Item, BuildActions, buildsStore, template) {
template = template.locals({
Item: Item
});
var Component = React.createClass({
mixins: [
Reflux.connectFilter(buildsStore, 'items', function(items) {
var projectName = this.props.projectName;
if (projectName) {
return _(items).filter(function(item) {
return item.project && item.project.name === projectName;
});
} else {
return items;
}
})
],
onShowMoreBuilds: function(projectName) {
BuildActions.readAll({
projectName: projectName,
limit: this.state.items.length + 20
});
},
render: template
});
return Component;
});

View File

@ -1,138 +0,0 @@
mixin statusBadge(build)
if build.status === 'in-progress'
span.label.label-info in progress
if build.status === 'queued'
span.label.label-default queued
if build.status === 'done'
span.label.label.sm.label-success done
if build.status === 'error'
span.label.label-danger error
.row
if this.state.build
.col-sm-3.hidden-xs
BuildSidebar(projectName=this.state.build.project.name, currentBuild=this.state.build)
.col-sm-9
h1.page-header
.pull-right(style={fontSize: '22px'})
mixin statusBadge(this.state.build)
span Build #
span= this.state.build.number
.small.text-muted
| Initiated by
- var initiator = this.state.build.initiator;
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
if this.state.build.error.message
.text-center.alert.alert-danger
| Error:
div= this.state.build.error.message
if this.state.build.error.stderr
pre= this.state.build.error.stderr
.row
.col-md-12
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
.row
.col-md-12
p
i.fa.fa-fw.fa-clock-o
span
if this.state.build.startDate
span Started
DateTime(value=this.state.build.startDate)
else
span Queued
DateTime(value=this.state.build.createDate)
if this.state.build.endDate
- var durationTitle = _(this.state.build.stepTimings).map(function(stepTiming) {
- return stepTiming.name + ': ' + (stepTiming.duration / 1000).toFixed(1) + ' sec';
- }).join('\n');
| , finished
|
DateTime(value=this.state.build.endDate)
|
Duration(value=(this.state.build.endDate - this.state.build.startDate), withSuffix=true, title=durationTitle)
mixin rev(rev, prefix)
- prefix = prefix || '';
span(title= 'Revision: ' + rev.id + ' by ' + rev.author)= prefix + rev.comment
- var scm = this.state.build.scm;
- var rev = scm && scm.rev;
- var changes = scm && scm.changes;
.row
.col-md-12
p
i.fa.fa-fw.fa-code-fork
if changes
if changes.length
| Scm changes:
else
| No scm changes, current revision is
|
| "
mixin rev(rev)
| " by
|
= rev.author
else
| -
if changes && changes.length
each change, index in changes
- var number = index + 1;
.row(key= 'scm-change-' + number)
.col-md-offset-4.col-md-8
p
mixin rev(change, String(number) + '. ')
h2
i.fa.fa-fw.fa-terminal
|
| Console output
.build-view_terminal
if this.state.showConsole
Terminal(build=this.state.build.id, showPreloader=true)
if this.state.build.completed
if this.state.build.error
.text-center.alert.alert-danger
| Build ended with error
Duration(value=(this.state.build.endDate - this.state.build.startDate), withSuffix=true)
else
.text-center.alert.alert-success
| Build successfully completed
Duration(value=(this.state.build.endDate - this.state.build.startDate), withSuffix=true)
else
.well.text-center
button.btn.btn-primary(onClick=this.toggleConsole)
i.fa.fa-fw.fa-refresh
|
| Show full console output

View File

@ -1,66 +0,0 @@
'use strict';
define([
'react',
'react-router',
'reflux',
'app/actions/build',
'app/stores/build',
'app/components/terminal/terminal',
'app/components/buildSidebar/index',
'templates/app/components/builds/view',
'app/components/common/index'
], function(
React, Router, Reflux, BuildActions, buildStore, TerminalComponent,
BuildSidebar, template, CommonComponents
) {
template = template.locals({
DateTime: CommonComponents.DateTime,
Duration: CommonComponents.Duration,
Scm: CommonComponents.Scm,
Terminal: TerminalComponent,
Link: Router.Link,
BuildSidebar: BuildSidebar
});
var Component = React.createClass({
mixins: [Reflux.ListenerMixin],
statics: {
willTransitionTo: function(transition, params, query) {
BuildActions.read(Number(params.id));
}
},
componentDidMount: function() {
this.listenTo(buildStore, this.updateBuild);
},
componentWillReceiveProps: function(nextProps) {
// reset console status when go from build page to another build
// page (did mount and mount not called in this case)
if (Number(nextProps.params.id) !== this.state.build.id) {
this.setState({showConsole: this.getInitialState().showConsole});
}
},
updateBuild: function(build) {
if (build) {
BuildActions.readAll({projectName: build.project.name});
}
this.setState({build: build});
},
render: template,
getInitialState: function() {
return {
build: null,
showConsole: false
};
},
toggleConsole: function() {
var consoleState = !this.state.showConsole;
if (consoleState) {
BuildActions.readTerminalOutput(this.state.build);
}
this.setState({showConsole: consoleState});
}
});
return Component;
});

View File

@ -1,17 +0,0 @@
'use strict';
define([
'react',
'templates/app/components/common/dateTime/template',
'moment'
], function(React, template, moment) {
template = template.locals({
moment: moment
});
var Component = React.createClass({
render: template
});
return Component;
});

View File

@ -1,2 +0,0 @@
- var date = moment(this.props.value);
span(title= date.format('YYYY-MM-DD HH:mm:ss'))= date.fromNow()

View File

@ -1,7 +0,0 @@
- var sec = this.props.value / 1000;
- sec = sec >= 1 ? Math.round(sec) : Number(sec.toFixed(2));
- var min = sec >= 60 ? Math.round(sec / 60) : 0;
- var suffix = this.props.withSuffix ? 'in ' : '';
- var ending = min === 1 ? '' : 's';
- var title = this.props.title || sec + ' second' + ending;
span(title= title)= suffix + (min ? min + ' minunte' : sec + ' second') + ending

View File

@ -1,15 +0,0 @@
'use strict';
define([
'react', 'templates/app/components/common/duration/index', 'moment'
], function(React, template, moment) {
template = template.locals({
moment: moment
});
var Component = React.createClass({
render: template
});
return Component;
});

View File

@ -1,15 +0,0 @@
'use strict';
define([
'./dateTime/index',
'./scm/index',
'./duration/index',
'./progress/index'
], function(DateTime, Scm, Duration, Progress) {
return {
DateTime: DateTime,
Scm: Scm,
Duration: Duration,
Progress: Progress
};
});

View File

@ -1,2 +0,0 @@
.progress
.progress-bar.progress-bar-success.progress-bar-striped.active(style={width: this.state.percent + '%'})

View File

@ -1,34 +0,0 @@
'use strict';
define([
'underscore',
'react',
'templates/app/components/common/progress/index'
], function(_, React, template) {
return React.createClass({
render: template,
_computePercent: function() {
var build = this.props.build;
return Math.round((Date.now() - build.startDate) /
build.project.avgBuildDuration * 100);
},
componentDidMount: function() {
var self = this;
var updateCallback = function() {
if (self.props.build.status === 'in-progress') {
if (self.isMounted()) {
self.setState({percent: self._computePercent()});
_.delay(updateCallback, 100);
}
}
};
updateCallback();
},
getInitialState: function() {
return {
percent: this._computePercent()
}
}
});
});

View File

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

View File

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

View File

@ -1,4 +0,0 @@
div
h1.page-header Builds history
BuildsList()

View File

@ -1,25 +0,0 @@
'use strict';
define([
'react',
'react-router',
'app/actions/project',
'app/actions/build',
'app/components/builds/list',
'templates/app/components/dashboard/index'
], function(React, Router, ProjectActions, BuildActions, BuildsList, template) {
template = template.locals({
Link: Router.Link,
BuildsList: BuildsList
});
var Component = React.createClass({
componentWillMount: function() {
ProjectActions.readAll();
BuildActions.readAll();
},
render: template
});
return Component;
});

View File

@ -1,9 +0,0 @@
.navbar.navbar-default.navbar-fixed-top
.container-fluid
.navbar-header
Link.navbar-brand(to="dashboard")
span NCI
.collapse.navbar-collapse
.navbar-form.navbar-left(style={paddingTop: "11px"})
ProjectsSelector()

View File

@ -1,20 +0,0 @@
'use strict';
define([
'react',
'react-router',
'app/components/projects/selector/index',
'templates/app/components/header/index',
'bootstrap/collapse'
], function(React, Router, ProjectsSelector, template) {
template = template.locals({
Link: Router.Link,
ProjectsSelector: ProjectsSelector
});
var Component = React.createClass({
render: template
});
return Component;
});

View File

@ -1,20 +0,0 @@
'use strict';
define([
'app/components/projects/index', 'app/components/builds/index',
'app/components/app/index', 'app/components/header/index',
'app/components/dashboard/index', 'app/components/buildLog/index'
], function(
ProjectsComponents, BuildsComponents,
App, Header,
Dashboard, BuildLogComponent
) {
return {
App: App,
Header: Header,
Project: ProjectsComponents,
Build: BuildsComponents,
Dashboard: Dashboard,
BuildLog: BuildLogComponent
};
});

View File

@ -1,11 +0,0 @@
'use strict';
define([
'app/components/projects/selector/index',
'app/components/projects/view/index'
], function(Selector, View) {
return {
Selector: Selector,
View: View
};
});

View File

@ -1,24 +0,0 @@
.projects-selector(href="javascript:void(0);")
if !this.state.showSearch
span.projects-selector_preview(onClick=this.onSearchProject)
i.fa.fa-fw.fa-bars
span.projects-selector_preview_text Select a project...
else
input.projects-selector_input(
type="text",
value=this.state.searchQuery,
onChange=this.onSearchChange,
ref=this.onInputMount,
onBlur=this.onBlurSearch
)
ul.projects-selector_items
each project in this.state.projects
li.projects-selector_item(key=project.name)
Link.projects-selector_item_link(to="project", params={name: project.name}, onMouseDown=this.onSelectProject(project.name))
Scm(scm=project.scm.type)
span
span= project.name
a.projects-selector_item_run(href="javascript:void(0);", onMouseDown=this.onRunProject(project.name))
i.fa.fa-fw.fa-play

View File

@ -1,55 +0,0 @@
'use strict';
define([
'react', 'react-router', 'reflux', 'app/actions/project',
'app/stores/projects',
'app/components/common/scm/index',
'templates/app/components/projects/selector/index'
], function(React, Router, Reflux, ProjectActions, projectsStore, Scm,
template
) {
template = template.locals({
Link: Router.Link,
Scm: Scm
});
return React.createClass({
mixins: [Reflux.ListenerMixin, Router.Navigation],
componentDidMount: function() {
this.listenTo(projectsStore, this.updateItems);
},
getInitialState: function() {
return {
showSearch: false
};
},
onRunProject: function(projectName) {
ProjectActions.run(projectName)
this.setState({showSearch: false});
},
onSelectProject: function(name) {
this.transitionTo('project', {name: name});
},
updateItems: function(projects) {
this.setState({projects: projects});
},
onSearchProject: function() {
this.setState({showSearch: true});
},
onInputMount: function(component) {
var node = React.findDOMNode(component);
if (node) {
node.focus();
}
},
onBlurSearch: function() {
this.setState({showSearch: false});
},
onSearchChange: function(event) {
var query = event.target.value;
this.setState({searchQuery: query});
ProjectActions.readAll({nameQuery: query});
},
render: template,
});
});

View File

@ -1,56 +0,0 @@
div
h1.page-header.clearfix
.pull-right
button.btn.btn-sm.btn-primary.dropdown-toggle(
data-toggle="dropdown",
aria-expanded="false",
disabled="true"
)
| target revision:
span= this.state.project.scm ? this.state.project.scm.rev : ''
|
if this.state.project.name
button.btn.btn-sm.btn-success(onClick=this.onBuildProject)
i.fa.fa-fw.fa-play
|
span Build
div
Scm(scm=this.state.project.scm ? this.state.project.scm.type : '')
span= this.state.project.name
div.text-muted
- var lastDoneBuild = this.state.project.lastDoneBuild;
p Last successfully built:
if lastDoneBuild
DateTime(value=lastDoneBuild.endDate)
|
| (build #
span= lastDoneBuild.number
| )
else
| -
p Current successfully streak:
if lastDoneBuild
span= this.state.project.doneBuildsStreak.buildsCount
else
| -
p Last build duration:
if lastDoneBuild
Duration(value=(lastDoneBuild.endDate - lastDoneBuild.startDate))
else
| -
p Average build duration:
if this.state.project.avgBuildDuration
Duration(value=this.state.project.avgBuildDuration)
else
| -
h2
i.fa.fa-fw.fa-history
span
span Build history
Builds(projectName=this.props.params.name)

View File

@ -1,51 +0,0 @@
'use strict';
define([
'react', 'reflux',
'app/actions/project',
'app/actions/build',
'app/stores/project',
'app/components/builds/list',
'app/components/common/scm/index',
'templates/app/components/projects/view/index',
'app/components/common/index',
'bootstrap/dropdown'
], function(React, Reflux, ProjectActions, BuildActions,
projectStore, Builds, Scm, template, CommonComponents
) {
template = template.locals({
Builds: Builds,
Scm: Scm,
DateTime: CommonComponents.DateTime,
Duration: CommonComponents.Duration
});
return React.createClass({
mixins: [
Reflux.connectFilter(projectStore, 'project', function(project) {
if (project.name === this.props.params.name) {
return project;
} else {
if (this.state) {
return this.state.project;
} else {
return projectStore.getInitialState();
}
}
})
],
statics: {
willTransitionTo: function(transition, params, query) {
ProjectActions.read({name: params.name});
BuildActions.readAll({projectName: params.name});
}
},
onBuildProject: function() {
if (this.state.project.name) {
console.log(this.state.project.name);
ProjectActions.run(this.state.project.name);
}
},
render: template
});
});

View File

@ -1,9 +0,0 @@
'use strict';
define([
'app/components/terminal/terminal',
], function(Console) {
return {
Console: Console
};
});

View File

@ -1,3 +0,0 @@
.terminal
pre.terminal_code
.terminal_footer

View File

@ -1,133 +0,0 @@
'use strict';
define([
'underscore',
'react',
'reflux',
'app/stores/terminal',
'app/stores/build',
'ansi_up',
'templates/app/components/terminal/terminal'
], function(
_,
React,
Reflux,
terminalStore,
buildStore,
ansiUp,
template
) {
var Component = React.createClass({
mixins: [Reflux.ListenerMixin],
shouldScrollBottom: true,
data: [],
linesCount: 0,
componentDidMount: function() {
this.listenTo(terminalStore, this.updateItems);
var node = document.getElementsByClassName('terminal')[0];
this.initialScrollPosition = node.getBoundingClientRect().top;
if (this.props.showPreloader) {
this.getTerminal().insertAdjacentHTML('afterend',
'<img src="/images/preloader.gif" class="terminal_preloader"/>'
);
this.listenTo(buildStore, function(build) {
if (build.completed) {
this.removePreloader();
}
});
}
window.onscroll = this.onScroll;
},
removePreloader: function() {
var preloader = document.getElementsByClassName(
'terminal_preloader'
)[0];
if (preloader) {
preloader.parentNode.removeChild(preloader);
}
},
componentWillUnmount: function() {
window.onscroll = null;
},
prepareRow: function(row) {
return ansiUp.ansi_to_html(row.replace('\r', ''));
},
prepareOutput: function(output) {
var self = this;
return output.map(function(row) {
return self.prepareRow(row);
});
},
getTerminal: function() {
return document.getElementsByClassName('terminal')[0];
},
getBody: function() {
return document.getElementsByTagName('body')[0];
},
onScroll: function() {
var node = this.getTerminal(),
body = this.getBody();
this.shouldScrollBottom = window.innerHeight + body.scrollTop >=
node.offsetHeight + this.initialScrollPosition;
},
ensureScrollPosition: function() {
if (this.shouldScrollBottom) {
var node = this.getTerminal(),
body = this.getBody();
body.scrollTop = this.initialScrollPosition + node.offsetHeight;
}
},
makeCodeLineContent: function(line) {
return '<span class="code-line_counter">' + '</span>' +
'<div class="code-line_body">' + this.prepareRow(line) + '</div>';
},
makeCodeLine: function(line, index) {
return '<div class="code-line" data-number="' + index + '">' +
this.makeCodeLineContent(line) + '</div>';
},
renderBuffer: _.throttle(function() {
var data = this.data,
currentLinesCount = data.length,
terminal = document.getElementsByClassName('terminal_code')[0],
rows = terminal.childNodes;
if (rows.length) {
// replace our last node
var index = this.linesCount - 1;
rows[index].innerHTML = this.makeCodeLineContent(data[index]);
}
var self = this;
terminal.insertAdjacentHTML('beforeend',
_(data.slice(this.linesCount)).map(function(line, index) {
return self.makeCodeLine(line, self.linesCount + index);
}).join('')
);
this.linesCount = currentLinesCount;
this.ensureScrollPosition();
}, 100),
updateItems: function(build) {
// listen just our console update
if (build.buildId === this.props.build) {
this.data = build.data;
this.renderBuffer();
}
if (this.props.showPreloader && build.buildCompleted) {
this.removePreloader();
}
},
shouldComponentUpdate: function() {
return false;
},
render: template
});
return Component;
});

View File

@ -1,3 +0,0 @@
p 123
Terminal(lines=this.state.lines)

View File

@ -1,19 +0,0 @@
'use strict';
define([
'react',
'../terminal',
'templates/app/components/terminal/test/index'
], function(React, TerminalComponent, template) {
template = template.locals({
Terminal: TerminalComponent
});
return React.createClass({
getInitialState: function() {
return {
lines: [1, 2, 3]
};
},
render: template
});
});

View File

@ -1,8 +0,0 @@
'use strict';
define([
'socketio', 'dataio'
], function(socketio, dataio) {
// Do it because we use connect in console store
return dataio(socketio.connect());
});

View File

@ -1,11 +0,0 @@
'use strict';
define(['app/connect'], function(connect) {
var projects = connect.resource('projects');
var builds = connect.resource('builds');
return {
projects: projects,
builds: builds
}
});

View File

@ -1,35 +0,0 @@
'use strict';
define([
'underscore',
'reflux', 'app/actions/build', 'app/resources'
], function(_, Reflux, BuildActions, resources) {
var resource = resources.builds;
var Store = Reflux.createStore({
listenables: BuildActions,
build: null,
onChange: function(data, action) {
if (this.build && (data.buildId === this.build.id)) {
_(this.build).extend(data.changes);
this.trigger(this.build);
}
},
init: function() {
resource.subscribe('change', this.onChange);
},
onRead: function(id) {
var self = this;
resource.sync('read', {id: id}, function(err, build) {
if (err) throw err;
self.build = build;
self.trigger(self.build);
});
}
});
return Store;
});

View File

@ -1,46 +0,0 @@
'use strict';
define([
'reflux', 'app/actions/buildLog', 'app/resources'
], function(
Reflux, BuildLogActions, resources
) {
var resource = resources.builds;
var Store = Reflux.createStore({
listenables: BuildLogActions,
data: {
lines: [],
total: 0
},
getInitialState: function() {
return this.data;
},
onGetTail: function(params) {
var self = this;
console.time('>>> getBuildLogTail');
resource.sync('getBuildLogTail', params, function(err, data) {
if (err) throw err;
console.timeEnd('>>> getBuildLogTail');
self.data = data;
self.trigger(self.data);
});
},
onGetLines: function(params) {
var self = this;
console.time('>>> getBuildLogLines');
resource.sync('getBuildLogLines', params, function(err, data) {
if (err) throw err;
console.timeEnd('>>> getBuildLogLines');
console.log('>>> isLast log lines = ', data.isLast);
self.data.lines = data.lines;
self.trigger(self.data);
});
}
});
return Store;
});

View File

@ -1,66 +0,0 @@
'use strict';
define([
'underscore',
'reflux', 'app/actions/build', 'app/resources'
], function(_, Reflux, BuildActions, resources) {
var resource = resources.builds;
var Store = Reflux.createStore({
listenables: BuildActions,
builds: [],
getInitialState: function() {
return this.builds;
},
onChanged: function(data) {
var oldBuild = _(this.builds).findWhere({id: data.buildId});
if (oldBuild) {
_(oldBuild).extend(data.changes);
} else {
this.builds.unshift(
_({id: data.buildId}).extend(data.changes)
);
}
this.trigger(this.builds);
},
onCancelled: function(data) {
// WORKAROUND: client that trigger `onCancel` gets one `onCancelled`
// call other clients get 2 calls (second with empty data)
if (!data) {
return;
}
var index = _(this.builds).findIndex({id: data.buildId});
if (index !== -1) {
this.builds.splice(index, 1);
}
this.trigger(this.builds);
},
init: function() {
resource.subscribe('change', this.onChanged);
resource.subscribe('cancel', this.onCancelled);
},
onReadAll: function(params) {
var self = this;
resource.sync('readAll', params, function(err, builds) {
if (err) throw err;
self.builds = builds;
self.trigger(self.builds);
});
},
onCancel: function(buildId) {
resource.sync('cancel', {buildId: buildId}, function(err) {
if (err) throw err;
});
}
});
return Store;
});

View File

@ -1,36 +0,0 @@
'use strict';
define([
'underscore',
'reflux', 'app/actions/project', 'app/resources'
], function(_, Reflux, ProjectActions, resources) {
var resource = resources.projects;
var Store = Reflux.createStore({
listenables: ProjectActions,
project: {},
getInitialState: function() {
return this.project;
},
onChange: function(data, action) {
this.trigger(data.project);
},
init: function() {
resource.subscribe('change', this.onChange);
},
onRead: function(params) {
var self = this;
resource.sync('read', params, function(err, project) {
if (err) throw err;
self.project = project;
self.trigger(self.project);
});
}
});
return Store;
});

View File

@ -1,25 +0,0 @@
'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) {
if (err) throw err;
});
},
onReadAll: function(params) {
var self = this;
resource.sync('readAll', params, function(err, projects) {
if (err) throw err;
self.trigger(projects);
});
}
});
return Store;
});

View File

@ -1,66 +0,0 @@
'use strict';
define([
'underscore', 'reflux', 'app/actions/build', 'app/connect'
], function(
_, Reflux, BuildActions, connect
) {
var Store = Reflux.createStore({
listenables: BuildActions,
init: function() {
// the only purpose of this hash to reconnect all the time
// except first, see notes at using
this.connectedResourcesHash = {};
},
onReadTerminalOutput: function(build) {
var self = this,
output = [],
resourceName = 'build' + build.id;
var connectToBuildDataResource = function() {
// reconnect for get data below (at subscribe), coz
// data emitted only once during connect
if (self.connectedResourcesHash[resourceName]) {
connect.resource(resourceName).reconnect();
} else {
self.connectedResourcesHash[resourceName] = 1;
}
connect.resource(resourceName).subscribe('data', function(data) {
var lastLine = _(self.lines).last();
if (lastLine && (_(data.lines).first().number === lastLine.number)) {
self.lines = _(self.lines).initial();
}
self.lines = self.lines.concat(data.lines);
self.trigger({
buildId: build.id,
buildCompleted: build.completed,
name: 'Console for build #' + build.id,
data: _(self.lines).pluck('text')
});
});
};
this.lines = [];
this.currentLine = '';
// create data resource for completed build
if (build.completed) {
connect.resource('projects').sync(
'createBuildDataResource',
{buildId: build.id},
function(err) {
if (err) throw err;
connectToBuildDataResource();
}
);
} else {
connectToBuildDataResource();
}
}
});
return Store;
});

View File

@ -1,9 +0,0 @@
'use strict';
define(['underscore', 'shared/utils'], function(_, sharedUtils) {
var utils = {};
_(utils).extend(sharedUtils);
return utils;
});

View File

@ -1,29 +0,0 @@
'use strict';
define(['_dataio'], function(dataio) {
return function(socket) {
var connect = dataio(socket);
/*
* Extend Resource
*/
var resource = connect.resource('__someResource__'),
resourcePrototype = Object.getPrototypeOf(resource);
resourcePrototype.disconnect = function() {
this.socket.disconnect();
this.socket.removeAllListeners();
};
resourcePrototype.connect = function() {
this.socket.connect();
};
resourcePrototype.reconnect = function() {
this.disconnect();
this.connect();
};
return connect;
};
});

View File

@ -1,17 +0,0 @@
({
mainConfigFile: 'development.js',
baseUrl: '../',
paths: {
socketio: (
'../../node_modules/socket.io/node_modules/' +
'socket.io-client/socket.io'
),
_dataio: '../../node_modules/data.io/data.io',
},
name: 'app/app',
preserveLicenseComments: false,
optimize: 'uglify2',
useStrict: true,
out: '../../js/app.build.js'
});

View File

@ -1,21 +0,0 @@
require.config({
baseUrl: '/js',
paths: {
socketio: '/socket.io/socket.io',
_dataio: '/data.io',
underscore: 'libs/underscore/underscore',
react: 'libs/react/react-with-addons',
'react-router': 'libs/react-router/build/umd/ReactRouter',
reflux: 'libs/reflux/dist/reflux',
jquery: 'libs/jquery/jquery',
ansi_up: 'libs/ansi_up/ansi_up',
moment: 'libs/moment/moment',
'bootstrap/collapse': 'libs/bootstrap/js/collapse',
'bootstrap/dropdown': 'libs/bootstrap/js/dropdown'
},
shim: {
'bootstrap/collapse': ['jquery'],
'bootstrap/dropdown': ['jquery']
}
});

View File

@ -1,3 +0,0 @@
require.config({
});

View File

@ -1,32 +0,0 @@
'use strict';
(function(root, factory) {
if (typeof module !== 'undefined' && module.exports) {
// CommonJS
module.exports = factory();
} else if (typeof define === 'function' && define.amd) {
// AMD
define(function() {
return factory();
});
}
}(this, function() {
var utils = {};
utils.prune = function(str, length) {
var result = '',
words = str.split(' ');
do {
result += words.shift() + ' ';
} while (words.length && result.length < length);
return result.replace(/ $/, words.length ? '...' : '');
};
return utils;
}));

View File

@ -1,27 +0,0 @@
doctype html
html
head
title nci
link(href="/css/index.css", rel="stylesheet", type="text/css")
if env === 'development'
script(type="text/javascript", src="/js/libs/requirejs/require.js")
else
script
include ../static/js/libs/almond/almond.js
if env === 'development'
script
include ../static/js/requirejs/development.js
else
script
include ../static/js/requirejs/production.js
script
include ../static/js/app.build.js
script(type="text/javascript").
require(['app/app']);
body
#content