github.com/iqoqo/nomad@v0.11.3-0.20200911112621-d7021c74d101/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 JobID: '', 10 namespace: null, 11 12 withSummary: trait({ 13 Summary: function() { 14 return this.groupNames.reduce((summary, group) => { 15 summary[group] = { 16 Queued: faker.random.number(10), 17 Complete: faker.random.number(10), 18 Failed: faker.random.number(10), 19 Running: faker.random.number(10), 20 Starting: faker.random.number(10), 21 Lost: 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 });