2019-09-26 18:47:07 +00:00
|
|
|
import { Factory, trait } from 'ember-cli-mirage';
|
|
|
|
|
2019-10-03 14:13:08 +00:00
|
|
|
import faker from 'nomad-ui/mirage/faker';
|
2017-09-19 14:47:10 +00:00
|
|
|
|
|
|
|
export default Factory.extend({
|
|
|
|
// Hidden property used to compute the Summary hash
|
|
|
|
groupNames: [],
|
|
|
|
|
2018-02-16 02:55:59 +00:00
|
|
|
namespace: null,
|
2017-09-19 14:47:10 +00:00
|
|
|
|
2018-01-30 21:19:24 +00:00
|
|
|
withSummary: trait({
|
|
|
|
Summary: function() {
|
|
|
|
return this.groupNames.reduce((summary, group) => {
|
|
|
|
summary[group] = {
|
|
|
|
Queued: faker.random.number(10),
|
|
|
|
Complete: faker.random.number(10),
|
|
|
|
Failed: faker.random.number(10),
|
|
|
|
Running: faker.random.number(10),
|
|
|
|
Starting: faker.random.number(10),
|
|
|
|
Lost: faker.random.number(10),
|
|
|
|
};
|
|
|
|
return summary;
|
|
|
|
}, {});
|
|
|
|
},
|
|
|
|
}),
|
|
|
|
|
|
|
|
withChildren: trait({
|
|
|
|
Children: () => ({
|
|
|
|
Pending: faker.random.number(10),
|
|
|
|
Running: faker.random.number(10),
|
|
|
|
Dead: faker.random.number(10),
|
|
|
|
}),
|
|
|
|
}),
|
2017-09-19 14:47:10 +00:00
|
|
|
});
|