2019-09-26 18:47:07 +00:00
|
|
|
import { Factory } 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
|
|
|
|
2018-06-07 00:34:50 +00:00
|
|
|
const REF_TIME = new Date();
|
|
|
|
|
2017-09-19 14:47:10 +00:00
|
|
|
export default Factory.extend({
|
|
|
|
name: '',
|
|
|
|
|
2019-10-03 14:13:08 +00:00
|
|
|
autoRevert: () => faker.random.boolean(),
|
|
|
|
promoted: () => faker.random.boolean(),
|
2017-09-19 14:47:10 +00:00
|
|
|
|
2018-08-24 23:32:08 +00:00
|
|
|
requiresPromotion: false,
|
|
|
|
|
2018-06-07 00:34:50 +00:00
|
|
|
requireProgressBy: () => faker.date.past(0.5 / 365, REF_TIME),
|
|
|
|
|
2019-09-30 14:44:22 +00:00
|
|
|
desiredTotal: () => faker.random.number({ min: 1, max: 10 }),
|
2017-09-19 14:47:10 +00:00
|
|
|
|
|
|
|
desiredCanaries() {
|
|
|
|
return faker.random.number(Math.floor(this.desiredTotal / 2));
|
|
|
|
},
|
|
|
|
|
2018-05-23 17:39:43 +00:00
|
|
|
// PlacedCanaries is an array of allocation IDs. Since the IDs aren't currently
|
|
|
|
// used for associating allocations, any random value will do for now.
|
2017-09-19 14:47:10 +00:00
|
|
|
placedCanaries() {
|
2018-05-23 17:39:43 +00:00
|
|
|
return Array(faker.random.number(this.desiredCanaries))
|
|
|
|
.fill(null)
|
|
|
|
.map(() => faker.random.uuid());
|
2017-09-19 14:47:10 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
placedAllocs() {
|
|
|
|
return faker.random.number(this.desiredTotal);
|
|
|
|
},
|
|
|
|
|
|
|
|
healthyAllocs() {
|
|
|
|
return faker.random.number(this.placedAllocs);
|
|
|
|
},
|
|
|
|
|
|
|
|
unhealthyAllocs() {
|
|
|
|
return this.placedAllocs - this.healthyAllocs;
|
|
|
|
},
|
|
|
|
});
|