github.com/hspak/nomad@v0.7.2-0.20180309000617-bc4ae22a39a5/ui/mirage/factories/job-summary.js (about)

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