mirror of
https://github.com/kemko/nomad.git
synced 2026-01-06 10:25:42 +03:00
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
12 lines
351 B
JavaScript
12 lines
351 B
JavaScript
import ApplicationSerializer from './application';
|
|
import { get } from '@ember/object';
|
|
|
|
export default class JobPlan extends ApplicationSerializer {
|
|
mapToArray = ['FailedTGAllocs'];
|
|
|
|
normalize(typeHash, hash) {
|
|
hash.PreemptionIDs = (get(hash, 'Annotations.PreemptedAllocs') || []).mapBy('ID');
|
|
return super.normalize(...arguments);
|
|
}
|
|
}
|