github.com/DerekStrickland/consul@v1.4.5/ui-v2/app/components/healthchecked-resource.js (about) 1 import Component from '@ember/component'; 2 import { computed, get } from '@ember/object'; 3 import style from 'ember-computed-style'; 4 export default Component.extend({ 5 classNames: ['healthchecked-resource'], 6 attributeBindings: ['style'], 7 style: style('gridRowEnd'), 8 unhealthy: computed.filter(`checks.@each.Status`, function(item) { 9 const status = get(item, 'Status'); 10 return status === 'critical' || status === 'warning'; 11 }), 12 healthy: computed.filter(`checks.@each.Status`, function(item) { 13 const status = get(item, 'Status'); 14 return status === 'passing'; 15 }), 16 gridRowEnd: computed('UnhealthyChecks', function() { 17 let spans = 3; 18 if (get(this, 'service')) { 19 spans++; 20 } 21 if (get(this, 'healthy.length') > 0) { 22 spans++; 23 } 24 return { 25 gridRow: `auto / span ${spans + (get(this, 'unhealthy.length') || 0)}`, 26 }; 27 }), 28 });