open-nomad/ui/mirage/factories/deployment-task-group-summary.js

31 lines
648 B
JavaScript
Raw Normal View History

2017-09-19 14:47:10 +00:00
import { Factory, faker } from 'ember-cli-mirage';
export default Factory.extend({
name: '',
autoRevert: () => Math.random() > 0.5,
promoted: () => Math.random() > 0.5,
desiredTotal: faker.random.number({ min: 1, max: 10 }),
desiredCanaries() {
return faker.random.number(Math.floor(this.desiredTotal / 2));
},
placedCanaries() {
return faker.random.number(this.desiredCanaries);
},
placedAllocs() {
return faker.random.number(this.desiredTotal);
},
healthyAllocs() {
return faker.random.number(this.placedAllocs);
},
unhealthyAllocs() {
return this.placedAllocs - this.healthyAllocs;
},
});