mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-01 00:08:27 +01:00
fetch seen apps instead
This commit is contained in:
parent
e9938d9a5b
commit
421a6413bf
@ -47,17 +47,17 @@ module.exports = class UnleashClientMetrics {
|
|||||||
return this.apps[appName] ? Object.keys(this.apps[appName].seenToggles) : [];
|
return this.apps[appName] ? Object.keys(this.apps[appName].seenToggles) : [];
|
||||||
}
|
}
|
||||||
|
|
||||||
getAppsFromToggleName (toggleName) {
|
getSeenAppsPerToggle () {
|
||||||
const apps = [];
|
const toggles = {};
|
||||||
Object.keys(this.apps).forEach(appName => {
|
Object.keys(this.apps).forEach(appName => {
|
||||||
const seenToggles = Object.keys(this.apps[appName].seenToggles);
|
Object.keys(this.apps[appName].seenToggles).forEach((seenToggleName) => {
|
||||||
if (seenToggles.includes(toggleName)) {
|
if (!toggles[seenToggleName]) {
|
||||||
apps.push({
|
toggles[seenToggleName] = [];
|
||||||
appName,
|
}
|
||||||
});
|
toggles[seenToggleName].push(appName);
|
||||||
}
|
});
|
||||||
});
|
});
|
||||||
return apps;
|
return toggles;
|
||||||
}
|
}
|
||||||
|
|
||||||
getTogglesMetrics () {
|
getTogglesMetrics () {
|
||||||
|
@ -20,8 +20,8 @@ module.exports = function (app, config) {
|
|||||||
res.json(seenAppToggles);
|
res.json(seenAppToggles);
|
||||||
});
|
});
|
||||||
|
|
||||||
app.get('/client/seen-apps/:name', (req, res) => {
|
app.get('/client/seen-apps', (req, res) => {
|
||||||
const seenApps = metrics.getAppsFromToggleName(req.params.name);
|
const seenApps = metrics.getSeenAppsPerToggle();
|
||||||
res.json(seenApps);
|
res.json(seenApps);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user