mirror of
https://gitlab.silvrtree.co.uk/martind2000/nci.git
synced 2025-02-14 21:39:16 +00:00
update project info changes on the fly
This commit is contained in:
parent
2958e5ff84
commit
ed2e9cea4f
@ -38,7 +38,7 @@ Ui fixes
|
|||||||
* speed up build points animation at ff
|
* speed up build points animation at ff
|
||||||
* current successfully streak icons at project page
|
* current successfully streak icons at project page
|
||||||
* don't appear build from other project on project page
|
* don't appear build from other project on project page
|
||||||
* update project info changes (avg duration, etc) on the fly - project page
|
* ~~update project info changes (avg duration, etc) on the fly - project page~~
|
||||||
* long commit comment breakes build card makeup
|
* long commit comment breakes build card makeup
|
||||||
* ~~comment start/duration should be on same place during all steps~~
|
* ~~comment start/duration should be on same place during all steps~~
|
||||||
|
|
||||||
|
@ -88,6 +88,13 @@ exports.init = function(app, callback) {
|
|||||||
createBuildDataResource(build.id);
|
createBuildDataResource(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({name: build.project.name});
|
||||||
|
}
|
||||||
|
|
||||||
buildsResource.clientEmitSync('change', {
|
buildsResource.clientEmitSync('change', {
|
||||||
buildId: build.id, changes: changes
|
buildId: build.id, changes: changes
|
||||||
});
|
});
|
||||||
|
@ -22,11 +22,11 @@ module.exports = function(app) {
|
|||||||
res.send(app.projects);
|
res.send(app.projects);
|
||||||
});
|
});
|
||||||
|
|
||||||
resource.use('read', function(req, res) {
|
var getProject = function(params, callback) {
|
||||||
var project;
|
var project;
|
||||||
Steppy(
|
Steppy(
|
||||||
function() {
|
function() {
|
||||||
project = _(app.projects).findWhere(req.data);
|
project = _(app.projects).findWhere(params.condition);
|
||||||
|
|
||||||
getAvgProjectBuildDuration(project.name, this.slot());
|
getAvgProjectBuildDuration(project.name, this.slot());
|
||||||
|
|
||||||
@ -69,6 +69,37 @@ module.exports = function(app) {
|
|||||||
project.avgBuildDuration = avgProjectBuildDuration;
|
project.avgBuildDuration = avgProjectBuildDuration;
|
||||||
project.doneBuildsStreak = doneBuildsStreak;
|
project.doneBuildsStreak = doneBuildsStreak;
|
||||||
|
|
||||||
|
this.pass(project);
|
||||||
|
},
|
||||||
|
callback
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
// resource custom method which finds project by condition
|
||||||
|
// and emits event about it change to clients
|
||||||
|
resource.clientEmitSyncChange = function(condition) {
|
||||||
|
Steppy(
|
||||||
|
function() {
|
||||||
|
getProject({condition: condition}, this.slot());
|
||||||
|
},
|
||||||
|
function(err, project) {
|
||||||
|
resource.clientEmitSync('change', project);
|
||||||
|
},
|
||||||
|
function(err) {
|
||||||
|
console.error(
|
||||||
|
'Error during sync project change occurred:',
|
||||||
|
err.stack || err
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
resource.use('read', function(req, res) {
|
||||||
|
Steppy(
|
||||||
|
function() {
|
||||||
|
getProject({condition: req.data}, this.slot());
|
||||||
|
},
|
||||||
|
function(err, project) {
|
||||||
res.send(project);
|
res.send(project);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -10,7 +10,8 @@ define([
|
|||||||
listenables: ProjectActions,
|
listenables: ProjectActions,
|
||||||
project: null,
|
project: null,
|
||||||
|
|
||||||
onChange: function(data, action) {
|
onChange: function(project, action) {
|
||||||
|
this.trigger(project);
|
||||||
},
|
},
|
||||||
|
|
||||||
init: function() {
|
init: function() {
|
||||||
|
Loading…
Reference in New Issue
Block a user