github.com/anuvu/nomad@v0.8.7-atom1/ui/mirage/factories/deployment-task-group-summary.js (about)

     1  import { Factory, faker } from 'ember-cli-mirage';
     2  
     3  const REF_TIME = new Date();
     4  
     5  export default Factory.extend({
     6    name: '',
     7  
     8    autoRevert: () => Math.random() > 0.5,
     9    promoted: () => Math.random() > 0.5,
    10  
    11    requireProgressBy: () => faker.date.past(0.5 / 365, REF_TIME),
    12  
    13    desiredTotal: faker.random.number({ min: 1, max: 10 }),
    14  
    15    desiredCanaries() {
    16      return faker.random.number(Math.floor(this.desiredTotal / 2));
    17    },
    18  
    19    // PlacedCanaries is an array of allocation IDs. Since the IDs aren't currently
    20    // used for associating allocations, any random value will do for now.
    21    placedCanaries() {
    22      return Array(faker.random.number(this.desiredCanaries))
    23        .fill(null)
    24        .map(() => faker.random.uuid());
    25    },
    26  
    27    placedAllocs() {
    28      return faker.random.number(this.desiredTotal);
    29    },
    30  
    31    healthyAllocs() {
    32      return faker.random.number(this.placedAllocs);
    33    },
    34  
    35    unhealthyAllocs() {
    36      return this.placedAllocs - this.healthyAllocs;
    37    },
    38  });