github.com/manicqin/nomad@v0.9.5/ui/mirage/serializers/deployment.js (about)

     1  import ApplicationSerializer from './application';
     2  import { arrToObj } from '../utils';
     3  
     4  export default ApplicationSerializer.extend({
     5    embed: true,
     6    include: ['deploymentTaskGroupSummaries'],
     7  
     8    serialize() {
     9      var json = ApplicationSerializer.prototype.serialize.apply(this, arguments);
    10      if (json instanceof Array) {
    11        json.forEach(serializeDeployment);
    12      } else {
    13        serializeDeployment(json);
    14      }
    15      return json;
    16    },
    17  });
    18  
    19  function serializeDeployment(deployment) {
    20    deployment.TaskGroups = deployment.DeploymentTaskGroupSummaries.reduce(arrToObj('Name'), {});
    21  }