github.com/hspak/nomad@v0.7.2-0.20180309000617-bc4ae22a39a5/ui/app/serializers/node.js (about) 1 import { inject as service } from '@ember/service'; 2 import ApplicationSerializer from './application'; 3 4 export default ApplicationSerializer.extend({ 5 config: service(), 6 7 attrs: { 8 httpAddr: 'HTTPAddr', 9 }, 10 11 normalize(modelClass, hash) { 12 // Proxy local agent to the same proxy express server Ember is using 13 // to avoid CORS 14 if (this.get('config.isDev') && hash.HTTPAddr === '127.0.0.1:4646') { 15 hash.HTTPAddr = '127.0.0.1:4200'; 16 } 17 18 return this._super(modelClass, hash); 19 }, 20 21 extractRelationships(modelClass, hash) { 22 const { modelName } = modelClass; 23 const nodeURL = this.store 24 .adapterFor(modelName) 25 .buildURL(modelName, this.extractId(modelClass, hash), hash, 'findRecord'); 26 27 return { 28 allocations: { 29 links: { 30 related: `${nodeURL}/allocations`, 31 }, 32 }, 33 }; 34 }, 35 });