16f7a3f31b
Protect against case where an alloc has no services and avoid dereferencing null. Here, we ensure that the model and test serializers mimic the API by having nil TaskGroup.Services instead of an empty array.
17 lines
451 B
JavaScript
17 lines
451 B
JavaScript
import { copy } from 'ember-copy';
|
|
import ApplicationSerializer from './application';
|
|
|
|
export default ApplicationSerializer.extend({
|
|
normalize(typeHash, hash) {
|
|
// Provide EphemeralDisk to each task
|
|
hash.Tasks.forEach(task => {
|
|
task.EphemeralDisk = copy(hash.EphemeralDisk);
|
|
});
|
|
|
|
hash.ReservedEphemeralDisk = hash.EphemeralDisk.SizeMB;
|
|
hash.Services = hash.Services || [];
|
|
|
|
return this._super(typeHash, hash);
|
|
},
|
|
});
|