github.com/anth0d/nomad@v0.0.0-20221214183521-ae3a0a2cad06/ui/mirage/serializers/job-scale.js (about) 1 import ApplicationSerializer from './application'; 2 import { arrToObj } from '../utils'; 3 4 export default ApplicationSerializer.extend({ 5 embed: true, 6 include: ['taskGroupScales'], 7 8 serialize() { 9 var json = ApplicationSerializer.prototype.serialize.apply(this, arguments); 10 if (json instanceof Array) { 11 json.forEach(serializeJobScale); 12 } else { 13 serializeJobScale(json); 14 } 15 return json; 16 }, 17 }); 18 19 function serializeJobScale(jobScale) { 20 jobScale.TaskGroups = jobScale.TaskGroupScales.reduce(arrToObj('Name'), {}); 21 }