4394c5b9ff
This extracts some common API-idiosyncracy-handling patterns from model serialisers into properties that are processed by the application serialiser: * arrayNullOverrides converts a null property value to an empty array * mapToArray converts a map to an array of maps, using the original map keys as Name properties on the array maps * separateNanos splits nanosecond-containing timestamps into millisecond timestamps and separate nanosecond properties
19 lines
494 B
JavaScript
19 lines
494 B
JavaScript
import { copy } from 'ember-copy';
|
|
import ApplicationSerializer from './application';
|
|
|
|
export default class TaskGroup extends ApplicationSerializer {
|
|
arrayNullOverrides = ['Services'];
|
|
mapToArray = ['Volumes'];
|
|
|
|
normalize(typeHash, hash) {
|
|
// Provide EphemeralDisk to each task
|
|
hash.Tasks.forEach(task => {
|
|
task.EphemeralDisk = copy(hash.EphemeralDisk);
|
|
});
|
|
|
|
hash.ReservedEphemeralDisk = hash.EphemeralDisk.SizeMB;
|
|
|
|
return super.normalize(typeHash, hash);
|
|
}
|
|
}
|