1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-01 00:08:27 +01:00

check toggles and strategies in clientapps

This commit is contained in:
sveisvei 2016-12-13 22:43:24 +01:00
parent 5a27da0efe
commit d4ddb24b1d

View File

@ -11,6 +11,8 @@ module.exports = function (app, config) {
clientMetricsStore,
clientInstanceStore,
clientApplicationsStore,
strategyStore,
featureToggleStore,
} = config.stores;
const metrics = new ClientMetrics(clientMetricsStore);
@ -129,8 +131,10 @@ module.exports = function (app, config) {
Promise.all([
clientApplicationsStore.getApplication(appName),
clientInstanceStore.getByAppName(appName),
strategyStore.getStrategies(),
featureToggleStore.getFeatures(),
])
.then(([application, instances]) => {
.then(([application, instances, strategies, features]) => {
const appDetails = {
appName: application.appName,
createdAt: application.createdAt,
@ -138,9 +142,21 @@ module.exports = function (app, config) {
url: application.url,
color: application.color,
icon: application.icon,
strategies: application.strategies,
strategies: application.strategies.map(name => {
const found = strategies.find((feature) => feature.name === name);
if (found) {
return found;
}
return { name, notFound: true };
}),
instances,
seenToggles,
seenToggles: seenToggles.map(name => {
const found = features.find((feature) => feature.name === name);
if (found) {
return found;
}
return { name, notFound: true };
}),
links: {
self: `/api/client/applications/${application.appName}`,
},