aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/apps/projects/store
diff options
context:
space:
mode:
authorStas Vilchik <vilchiks@gmail.com>2016-11-03 13:37:11 +0100
committerStas Vilchik <vilchiks@gmail.com>2016-11-04 09:08:46 +0100
commita0f3074ca966632ab5b9fac224c114a7f410e3e2 (patch)
tree8539fbda639bd0de7c8b3810f16af36dbaeef0e1 /server/sonar-web/src/main/js/apps/projects/store
parent489122d29fd7dadfe100a067e66ae3b1b694ce35 (diff)
downloadsonarqube-a0f3074ca966632ab5b9fac224c114a7f410e3e2.tar.gz
sonarqube-a0f3074ca966632ab5b9fac224c114a7f410e3e2.zip
SONAR-8300 display facet histogram
Diffstat (limited to 'server/sonar-web/src/main/js/apps/projects/store')
-rw-r--r--server/sonar-web/src/main/js/apps/projects/store/facets/reducer.js5
-rw-r--r--server/sonar-web/src/main/js/apps/projects/store/reducer.js4
2 files changed, 9 insertions, 0 deletions
diff --git a/server/sonar-web/src/main/js/apps/projects/store/facets/reducer.js b/server/sonar-web/src/main/js/apps/projects/store/facets/reducer.js
index 8207424a6ab..4da4c0e9fd3 100644
--- a/server/sonar-web/src/main/js/apps/projects/store/facets/reducer.js
+++ b/server/sonar-web/src/main/js/apps/projects/store/facets/reducer.js
@@ -17,6 +17,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+import flatMap from 'lodash/flatMap';
import { createMap } from '../../../../components/store/generalReducers';
import { RECEIVE_PROJECTS } from '../projects/actions';
import { mapMetricToProperty } from '../utils';
@@ -50,3 +51,7 @@ export const getFacetByProperty = (state, property) => (
state[property]
);
+export const getMaxFacetValue = state => {
+ const allValues = flatMap(Object.values(state), facet => Object.values(facet));
+ return Math.max.apply(null, allValues);
+};
diff --git a/server/sonar-web/src/main/js/apps/projects/store/reducer.js b/server/sonar-web/src/main/js/apps/projects/store/reducer.js
index 9735bfca1aa..de306baa99d 100644
--- a/server/sonar-web/src/main/js/apps/projects/store/reducer.js
+++ b/server/sonar-web/src/main/js/apps/projects/store/reducer.js
@@ -40,3 +40,7 @@ export const getFilterStatus = (state, key) => (
export const getFacetByProperty = (state, property) => (
fromFacets.getFacetByProperty(state.facets, property)
);
+
+export const getMaxFacetValue = state => (
+ fromFacets.getMaxFacetValue(state.facets)
+);