consul/ui-v2/app/utils/sumOfUnhealthy.js

8 lines
241 B
JavaScript

import { get } from '@ember/object';
export default function(items) {
return items.reduce(function(sum, check) {
const status = get(check, 'Status');
return status === 'critical' || status === 'warning' ? sum + 1 : sum;
}, 0);
}