open-nomad/ui/app/serializers/node.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

36 lines
765 B
JavaScript
Raw Normal View History

import { inject as service } from '@ember/service';
2017-09-19 14:47:10 +00:00
import ApplicationSerializer from './application';
export default class NodeSerializer extends ApplicationSerializer {
@service config;
attrs = {
isDraining: 'Drain',
2017-09-19 14:47:10 +00:00
httpAddr: 'HTTPAddr',
resources: 'NodeResources',
reserved: 'ReservedResources',
};
2017-09-19 14:47:10 +00:00
mapToArray = ['Drivers', 'HostVolumes'];
2017-09-19 14:47:10 +00:00
extractRelationships(modelClass, hash) {
const { modelName } = modelClass;
const nodeURL = this.store
.adapterFor(modelName)
2021-12-28 16:08:12 +00:00
.buildURL(
modelName,
this.extractId(modelClass, hash),
hash,
'findRecord'
);
2017-09-19 14:47:10 +00:00
return {
allocations: {
links: {
related: `${nodeURL}/allocations`,
},
},
};
}
}