open-nomad/ui/mirage/factories/task-group-scale.js
2023-04-10 15:36:59 +00:00

32 lines
599 B
JavaScript

/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: MPL-2.0
*/
import { Factory, trait } from 'ember-cli-mirage';
import faker from 'nomad-ui/mirage/faker';
export default Factory.extend({
name() {
return this.id;
},
desired: 1,
placed: 1,
running: 1,
healthy: 1,
unhealthy: 1,
shallow: false,
afterCreate(taskGroupScale, server) {
if (!taskGroupScale.shallow) {
const events = server.createList('scale-event', faker.random.number({ min: 1, max: 10 }));
taskGroupScale.update({
eventIds: events.mapBy('id'),
});
}
},
});