github.com/anth0d/nomad@v0.0.0-20221214183521-ae3a0a2cad06/ui/mirage/factories/job-summary.js (about)

     1  import { Factory, trait } from 'ember-cli-mirage';
     2  
     3  import faker from 'nomad-ui/mirage/faker';
     4  
     5  export default Factory.extend({
     6    // Hidden property used to compute the Summary hash
     7    groupNames: [],
     8  
     9    namespace: null,
    10  
    11    withSummary: trait({
    12      Summary: function () {
    13        return this.groupNames.reduce((summary, group) => {
    14          summary[group] = {
    15            Queued: faker.random.number(10),
    16            Complete: faker.random.number(10),
    17            Failed: faker.random.number(10),
    18            Running: faker.random.number(10),
    19            Starting: faker.random.number(10),
    20            Lost: faker.random.number(10),
    21            Unknown: faker.random.number(10),
    22          };
    23          return summary;
    24        }, {});
    25      },
    26    }),
    27  
    28    withChildren: trait({
    29      Children: () => ({
    30        Pending: faker.random.number(10),
    31        Running: faker.random.number(10),
    32        Dead: faker.random.number(10),
    33      }),
    34    }),
    35  });