feat(portal-api): rename watchers to watches

This commit is contained in:
Sérgio Ramos 2017-07-19 16:55:24 +01:00 committed by Judit Greskovits
parent 2ece20ead9
commit cdd6d98af4
2 changed files with 11 additions and 8 deletions

View File

@ -176,7 +176,7 @@ exports.fromInstance = function (instance) {
deploymentGroupId: instance.deployment_group_id, deploymentGroupId: instance.deployment_group_id,
status: instance.status, status: instance.status,
healthy: instance.healthy, healthy: instance.healthy,
watchers: instance.watchers, watches: instance.watches,
jobs: instance.jobs jobs: instance.jobs
}; };
}; };
@ -191,7 +191,7 @@ exports.toInstance = function (clientInstance) {
service_id: clientInstance.serviceId, service_id: clientInstance.serviceId,
status: clientInstance.status, status: clientInstance.status,
healthy: clientInstance.healthy, healthy: clientInstance.healthy,
watchers: clientInstance.watchers, watches: clientInstance.watches,
jobs: clientInstance.jobs jobs: clientInstance.jobs
}); });
}; };

View File

@ -266,7 +266,7 @@ module.exports = class ContainerPilotWatcher extends Events {
}); });
} }
_saveInstance ({ id, healthy, watchers, jobs }, cb) { _saveInstance ({ id, healthy, watches, jobs }, cb) {
if (!id) { if (!id) {
return cb(); return cb();
} }
@ -274,7 +274,7 @@ module.exports = class ContainerPilotWatcher extends Events {
this._data.updateInstance({ this._data.updateInstance({
id, id,
healthy, healthy,
watchers, watches,
jobs jobs
}, cb); }, cb);
} }
@ -438,12 +438,15 @@ module.exports = class ContainerPilotWatcher extends Events {
services: ForceArray(dg.services).map((service) => { services: ForceArray(dg.services).map((service) => {
return Object.assign({}, service, { return Object.assign({}, service, {
instances: ForceArray(service.instances).map((instance) => { instances: ForceArray(service.instances).map((instance) => {
const watches = Get(instance, 'cp.Watches', []);
const jobs = Get(instance, 'cp.Services', []).map(({ Name }) => {
return Name;
});
return Object.assign({}, instance, { return Object.assign({}, instance, {
healthy: this._resolveInstanceHealth(service, instance), healthy: this._resolveInstanceHealth(service, instance),
jobs: Get(instance, 'cp.Services', []).map(({ Name }) => { jobs,
return Name; watches
}),
watches: Get(instance, 'cp.Watches', [])
}); });
}) })
}); });