github.com/zoomfoo/nomad@v0.8.5-0.20180907175415-f28fd3a1a056/ui/app/components/freestyle/sg-distribution-bar.js (about) 1 import Component from '@ember/component'; 2 import { computed } from '@ember/object'; 3 4 export default Component.extend({ 5 timerTicks: 0, 6 7 startTimer: function() { 8 this.set( 9 'timer', 10 setInterval(() => { 11 this.incrementProperty('timerTicks'); 12 }, 500) 13 ); 14 }.on('init'), 15 16 willDestroy() { 17 clearInterval(this.get('timer')); 18 }, 19 20 distributionBarDatum: computed(() => { 21 return [{ label: 'one', value: 10 }]; 22 }), 23 24 distributionBarData: computed(() => { 25 return [ 26 { label: 'one', value: 10 }, 27 { label: 'two', value: 20 }, 28 { label: 'three', value: 30 }, 29 ]; 30 }), 31 32 distributionBarDataWithClasses: computed(() => { 33 return [ 34 { label: 'Queued', value: 10, className: 'queued' }, 35 { label: 'Complete', value: 20, className: 'complete' }, 36 { label: 'Failed', value: 30, className: 'failed' }, 37 ]; 38 }), 39 40 distributionBarDataRotating: computed('timerTicks', () => { 41 return [ 42 { label: 'one', value: Math.round(Math.random() * 50) }, 43 { label: 'two', value: Math.round(Math.random() * 50) }, 44 { label: 'three', value: Math.round(Math.random() * 50) }, 45 ]; 46 }), 47 });