32 lines
598 B
JavaScript
32 lines
598 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({
|
|
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'),
|
|
});
|
|
},
|
|
});
|