github.com/anth0d/nomad@v0.0.0-20221214183521-ae3a0a2cad06/ui/mirage/factories/task-group-scale.js (about)

     1  import { Factory, trait } from 'ember-cli-mirage';
     2  import faker from 'nomad-ui/mirage/faker';
     3  
     4  export default Factory.extend({
     5    name() {
     6      return this.id;
     7    },
     8  
     9    desired: 1,
    10    placed: 1,
    11    running: 1,
    12    healthy: 1,
    13    unhealthy: 1,
    14  
    15    shallow: false,
    16  
    17    afterCreate(taskGroupScale, server) {
    18      if (!taskGroupScale.shallow) {
    19        const events = server.createList('scale-event', faker.random.number({ min: 1, max: 10 }));
    20  
    21        taskGroupScale.update({
    22          eventIds: events.mapBy('id'),
    23        });
    24      }
    25    },
    26  });