2018-04-25 22:50:15 +00:00
|
|
|
import ApplicationSerializer from './application';
|
|
|
|
|
2020-06-10 13:49:16 +00:00
|
|
|
export default class RescheduleEvent extends ApplicationSerializer {
|
2018-04-25 22:50:15 +00:00
|
|
|
normalize(typeHash, hash) {
|
|
|
|
// Time is in the form of nanoseconds since epoch, but JS dates
|
|
|
|
// only understand time to the millisecond precision. So store
|
|
|
|
// the time (precise to ms) as a date, and store the remaining ns
|
|
|
|
// as a number to deal with when it comes up.
|
|
|
|
hash.TimeNanos = hash.RescheduleTime % 1000000;
|
|
|
|
hash.Time = Math.floor(hash.RescheduleTime / 1000000);
|
|
|
|
|
2018-05-02 18:21:01 +00:00
|
|
|
hash.PreviousAllocationId = hash.PrevAllocID ? hash.PrevAllocID : null;
|
|
|
|
hash.PreviousNodeId = hash.PrevNodeID ? hash.PrevNodeID : null;
|
|
|
|
|
2020-06-10 13:49:16 +00:00
|
|
|
return super.normalize(typeHash, hash);
|
|
|
|
}
|
|
|
|
}
|