open-nomad/ui/mirage/factories/job-scale.js
2020-07-29 19:07:24 -07:00

27 lines
520 B
JavaScript

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'),
});
},
});