github.com/blixtra/nomad@v0.7.2-0.20171221000451-da9a1d7bb050/ui/app/controllers/freestyle.js (about) 1 import Ember from 'ember'; 2 import FreestyleController from 'ember-freestyle/controllers/freestyle'; 3 4 const { inject, computed } = Ember; 5 6 export default FreestyleController.extend({ 7 emberFreestyle: inject.service(), 8 9 timerTicks: 0, 10 11 startTimer: function() { 12 this.set( 13 'timer', 14 setInterval(() => { 15 this.incrementProperty('timerTicks'); 16 }, 500) 17 ); 18 }.on('init'), 19 20 stopTimer: function() { 21 clearInterval(this.get('timer')); 22 }.on('willDestroy'), 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 });