github.com/manicqin/nomad@v0.9.5/ui/mirage/factories/deployment-task-group-summary.js (about)

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