open-nomad/ui/mirage/factories/job-scale.js

27 lines
520 B
JavaScript
Raw Normal View History

2020-07-25 04:36:43 +00:00
import { Factory, trait } from 'ember-cli-mirage';
import faker from 'nomad-ui/mirage/faker';
export default Factory.extend({
groupNames: [],
jobId: '',
JobID() {
return this.jobId;
},
namespace: null,
shallow: false,
afterCreate(jobScale, server) {
const groups = jobScale.groupNames.map(group =>
server.create('task-group-scale', {
id: group,
shallow: jobScale.shallow,
})
);
jobScale.update({
taskGroupScaleIds: groups.mapBy('id'),
});
},
});