nci/static/js/app/stores/terminal.js

34 lines
676 B
JavaScript
Raw Normal View History

2015-05-07 21:55:40 +00:00
'use strict';
define([
'underscore',
'reflux', 'app/actions/build', 'app/connect'
], function(_, Reflux, BuildActions, connect) {
var Store = Reflux.createStore({
listenables: BuildActions,
init: function() {
console.log('init builds console output');
},
2015-05-14 20:37:44 +00:00
onReadTerminalOutput: function(build) {
var self = this,
output = '',
resourceName = 'build' + build.id;
2015-05-07 21:55:40 +00:00
2015-05-14 20:37:44 +00:00
connect.resource(resourceName).reconnect();
connect.resource(resourceName).subscribe('data', function(data) {
output += data;
2015-05-07 21:55:40 +00:00
self.trigger({
2015-05-14 20:37:44 +00:00
buildId: build.id,
name: 'Console for build #' + build.id,
data: output
2015-05-07 21:55:40 +00:00
});
});
}
});
return Store;
});