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,
status: instance.status,
healthy: instance.healthy,
watchers: instance.watchers,
watches: instance.watches,
jobs: instance.jobs
};
};
@ -191,7 +191,7 @@ exports.toInstance = function (clientInstance) {
service_id: clientInstance.serviceId,
status: clientInstance.status,
healthy: clientInstance.healthy,
watchers: clientInstance.watchers,
watches: clientInstance.watches,
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) {
return cb();
}
@ -274,7 +274,7 @@ module.exports = class ContainerPilotWatcher extends Events {
this._data.updateInstance({
id,
healthy,
watchers,
watches,
jobs
}, cb);
}
@ -438,12 +438,15 @@ module.exports = class ContainerPilotWatcher extends Events {
services: ForceArray(dg.services).map((service) => {
return Object.assign({}, service, {
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, {
healthy: this._resolveInstanceHealth(service, instance),
jobs: Get(instance, 'cp.Services', []).map(({ Name }) => {
return Name;
}),
watches: Get(instance, 'cp.Watches', [])
jobs,
watches
});
})
});