github.com/anth0d/nomad@v0.0.0-20221214183521-ae3a0a2cad06/ui/app/serializers/node.js (about)

     1  import { inject as service } from '@ember/service';
     2  import ApplicationSerializer from './application';
     3  
     4  export default class NodeSerializer extends ApplicationSerializer {
     5    @service config;
     6  
     7    attrs = {
     8      isDraining: 'Drain',
     9      httpAddr: 'HTTPAddr',
    10      resources: 'NodeResources',
    11      reserved: 'ReservedResources',
    12    };
    13  
    14    mapToArray = ['Drivers', 'HostVolumes'];
    15  
    16    extractRelationships(modelClass, hash) {
    17      const { modelName } = modelClass;
    18      const nodeURL = this.store
    19        .adapterFor(modelName)
    20        .buildURL(
    21          modelName,
    22          this.extractId(modelClass, hash),
    23          hash,
    24          'findRecord'
    25        );
    26  
    27      return {
    28        allocations: {
    29          links: {
    30            related: `${nodeURL}/allocations`,
    31          },
    32        },
    33      };
    34    }
    35  }