github.com/hernad/nomad@v1.6.112/ui/mirage/serializers/job.js (about) 1 /** 2 * Copyright (c) HashiCorp, Inc. 3 * SPDX-License-Identifier: MPL-2.0 4 */ 5 6 import ApplicationSerializer from './application'; 7 8 export default ApplicationSerializer.extend({ 9 embed: true, 10 include: ['taskGroups', 'jobSummary'], 11 12 serialize() { 13 var json = ApplicationSerializer.prototype.serialize.apply(this, arguments); 14 if (json instanceof Array) { 15 json.forEach(serializeJob); 16 } else { 17 serializeJob(json); 18 } 19 return json; 20 }, 21 }); 22 23 function serializeJob(job) { 24 job.TaskGroups.forEach(group => { 25 if (group.Services.length === 0) { 26 group.Services = null; 27 } 28 }); 29 }