github.com/anth0d/nomad@v0.0.0-20221214183521-ae3a0a2cad06/ui/mirage/factories/job-scale.js (about) 1 import { Factory, trait } from 'ember-cli-mirage'; 2 import faker from 'nomad-ui/mirage/faker'; 3 4 export default Factory.extend({ 5 groupNames: [], 6 7 jobId: '', 8 JobID() { 9 return this.jobId; 10 }, 11 namespace: null, 12 shallow: false, 13 14 afterCreate(jobScale, server) { 15 const groups = jobScale.groupNames.map(group => 16 server.create('task-group-scale', { 17 id: group, 18 shallow: jobScale.shallow, 19 }) 20 ); 21 22 jobScale.update({ 23 taskGroupScaleIds: groups.mapBy('id'), 24 }); 25 }, 26 });