From cdd6d98af444e33f8380df68823772436e61e3ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Se=CC=81rgio=20Ramos?= Date: Wed, 19 Jul 2017 16:55:24 +0100 Subject: [PATCH] feat(portal-api): rename watchers to watches --- packages/portal-api/lib/data/transform.js | 4 ++-- packages/portal-api/lib/watch/container-pilot.js | 15 +++++++++------ 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/packages/portal-api/lib/data/transform.js b/packages/portal-api/lib/data/transform.js index 6c612dc8..4631da57 100644 --- a/packages/portal-api/lib/data/transform.js +++ b/packages/portal-api/lib/data/transform.js @@ -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 }); }; diff --git a/packages/portal-api/lib/watch/container-pilot.js b/packages/portal-api/lib/watch/container-pilot.js index 37e25aee..cdd4c8f7 100644 --- a/packages/portal-api/lib/watch/container-pilot.js +++ b/packages/portal-api/lib/watch/container-pilot.js @@ -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 }); }) });