github.com/emate/nomad@v0.8.2-wo-binpacking/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    distributionBarData: computed(() => {
    21      return [
    22        { label: 'one', value: 10 },
    23        { label: 'two', value: 20 },
    24        { label: 'three', value: 30 },
    25      ];
    26    }),
    27  
    28    distributionBarDataWithClasses: computed(() => {
    29      return [
    30        { label: 'Queued', value: 10, className: 'queued' },
    31        { label: 'Complete', value: 20, className: 'complete' },
    32        { label: 'Failed', value: 30, className: 'failed' },
    33      ];
    34    }),
    35  
    36    distributionBarDataRotating: computed('timerTicks', () => {
    37      return [
    38        { label: 'one', value: Math.round(Math.random() * 50) },
    39        { label: 'two', value: Math.round(Math.random() * 50) },
    40        { label: 'three', value: Math.round(Math.random() * 50) },
    41      ];
    42    }),
    43  });