open-nomad/ui/app/serializers/task.js
Buck Doyle b9f462fdc1
ui: Add optional memory max to task details ribbon (#10459)
This is the first step in #10268. If a maximum is not specified, the
task group sum uses the memory number instead. The maximum is only
shown when it’s higher than the memory sum.
2021-04-28 15:38:14 -05:00

18 lines
574 B
JavaScript

import ApplicationSerializer from './application';
export default class Task extends ApplicationSerializer {
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;
hash.ReservedCPU = resources.CPU;
hash.ReservedDisk = resources.DiskMB;
hash.ReservedEphemeralDisk = hash.EphemeralDisk.SizeMB;
}
return super.normalize(typeHash, hash);
}
}