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

18 lines
574 B
JavaScript
Raw Normal View History

2017-09-19 14:47:10 +00:00
import ApplicationSerializer from './application';
export default class Task extends ApplicationSerializer {
2017-09-19 14:47:10 +00:00
normalize(typeHash, hash) {
// Lift the reserved resource numbers out of the Resources object
const resources = hash.Resources;
if (resources) {
hash.ReservedMemory = resources.MemoryMB;
hash.ReservedMemoryMax = resources.MemoryMaxMB;
2017-09-19 14:47:10 +00:00
hash.ReservedCPU = resources.CPU;
hash.ReservedDisk = resources.DiskMB;
hash.ReservedEphemeralDisk = hash.EphemeralDisk.SizeMB;
}
return super.normalize(typeHash, hash);
}
}