diff options
Diffstat (limited to 'server/sonar-web/src/main/js/apps/overview/helpers')
-rw-r--r-- | server/sonar-web/src/main/js/apps/overview/helpers/metrics.js | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/server/sonar-web/src/main/js/apps/overview/helpers/metrics.js b/server/sonar-web/src/main/js/apps/overview/helpers/metrics.js new file mode 100644 index 00000000000..1a1dcefcc47 --- /dev/null +++ b/server/sonar-web/src/main/js/apps/overview/helpers/metrics.js @@ -0,0 +1,21 @@ +function hasRightDomain (metric, domains) { + return domains.indexOf(metric.domain) !== -1; +} + +function isNotHidden (metric) { + return !metric.hidden; +} + +function hasSimpleType (metric) { + return metric.type !== 'DATA' && metric.type !== 'DISTRIB'; +} + +function isNotDifferential (metric) { + return metric.key.indexOf('new_') !== 0; +} + +export function filterMetricsForDomains (metrics, domains) { + return metrics.filter(metric => { + return hasRightDomain(metric, domains) && isNotHidden(metric) && hasSimpleType(metric) && isNotDifferential(metric); + }); +} |