github.com/Ilhicas/nomad@v1.0.4-0.20210304152020-e86851182bc3/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 }; 22 return summary; 23 }, {}); 24 }, 25 }), 26 27 withChildren: trait({ 28 Children: () => ({ 29 Pending: faker.random.number(10), 30 Running: faker.random.number(10), 31 Dead: faker.random.number(10), 32 }), 33 }), 34 });