Reflux.createStore({ listenables: ProjectActions, onRun: function(projectName, buildParams) { resource.sync('run', { projectName: projectName, buildParams: buildParams }, 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); }); } })
Reflux.createStore({ listenables: BuildActions, build: null, onChange: function(data) { 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); }); } })
Reflux.createStore({ listenables: ProjectActions, project: {}, getInitialState: function() { return this.project; }, onChange: function(data) { 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); }); } })
self.trigger({ buildId: build.id, buildCompleted: build.completed,
Reflux.createStore({ listenables: BuildLogActions, data: { lines: [], total: 0 }, getInitialState: function() { return this.data; }, onGetTail: function(params) { var self = this; resource.sync('getBuildLogTail', params, function(err, data) { if (err) throw err; self.data = data; self.trigger(self.data); }); }, onGetLines: function(params) { var self = this; resource.sync('getBuildLogLines', params, function(err, data) { if (err) throw err; self.data.lines = data.lines; self.trigger(self.data); }); } })