2017-09-19 14:47:10 +00:00
|
|
|
import ApplicationSerializer from './application';
|
|
|
|
|
|
|
|
export default ApplicationSerializer.extend({
|
|
|
|
embed: true,
|
|
|
|
include: ['task_groups', 'job_summary'],
|
2019-09-13 22:42:14 +00:00
|
|
|
|
|
|
|
serialize() {
|
|
|
|
var json = ApplicationSerializer.prototype.serialize.apply(this, arguments);
|
|
|
|
if (json instanceof Array) {
|
|
|
|
json.forEach(serializeJob);
|
|
|
|
} else {
|
|
|
|
serializeJob(json);
|
|
|
|
}
|
|
|
|
return json;
|
|
|
|
},
|
2017-09-19 14:47:10 +00:00
|
|
|
});
|
2019-09-13 22:42:14 +00:00
|
|
|
|
|
|
|
function serializeJob(job) {
|
|
|
|
job.TaskGroups.forEach(group => {
|
|
|
|
if (group.Services.length === 0) {
|
|
|
|
group.Services = null;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|