nci/static/js/app/stores/project.js

26 lines
582 B
JavaScript
Raw Normal View History

2015-05-03 23:04:51 +00:00
'use strict';
define([
'reflux', 'app/actions/project', 'app/resources'
], function(Reflux, ProjectActions, resources) {
2015-05-07 20:53:46 +00:00
var resource = resources.projects;
2015-05-03 23:04:51 +00:00
var Store = Reflux.createStore({
2015-05-07 20:53:46 +00:00
listenables: ProjectActions,
onRun: function(projectName) {
resource.sync('run', {projectName: projectName}, function(err, result) {
console.log('run project, shoould get queue');
});
2015-05-03 23:04:51 +00:00
},
2015-05-07 20:53:46 +00:00
onReadAll: function() {
2015-05-04 20:50:02 +00:00
var self = this;
2015-05-07 20:53:46 +00:00
resource.sync('read', function(err, projects) {
2015-05-15 05:43:57 +00:00
if (err) throw err;
2015-05-04 20:50:02 +00:00
self.trigger(projects);
2015-05-03 23:04:51 +00:00
});
}
});
return Store;
});