aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/apps/overview/helpers
diff options
context:
space:
mode:
authorStas Vilchik <vilchiks@gmail.com>2015-10-23 16:09:18 +0200
committerStas Vilchik <vilchiks@gmail.com>2015-10-26 11:45:00 +0100
commit3c38542ce87deca7dab67fbe7cc87a3b4692beb7 (patch)
tree730ac92a05f9fdd98a4a249a0b88a7e1951464d4 /server/sonar-web/src/main/js/apps/overview/helpers
parent81c7de07a6766809f7610a51883608f99f639af6 (diff)
downloadsonarqube-3c38542ce87deca7dab67fbe7cc87a3b4692beb7.tar.gz
sonarqube-3c38542ce87deca7dab67fbe7cc87a3b4692beb7.zip
SONAR-6357 add detailed "Size" panel for the "Overview" main page
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.js21
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);
+ });
+}