debian-mirror-gitlab/app/assets/javascripts/admin/statistics_panel/store/getters.js
2020-10-24 23:57:45 +05:30

16 lines
474 B
JavaScript

/**
* Merges the statisticsLabels with the state's data
* and returns an array of the following form:
* [{ key: "forks", label: "Forks", value: 50 }]
*/
// eslint-disable-next-line import/prefer-default-export
export const getStatistics = state => labels =>
Object.keys(labels).map(key => {
const result = {
key,
label: labels[key],
value: state.statistics && state.statistics[key] ? state.statistics[key] : null,
};
return result;
});