From 901ba35ac550a5bbf507b380fe2407f915c81ab2 Mon Sep 17 00:00:00 2001 From: Michael Lange Date: Wed, 2 May 2018 11:21:01 -0700 Subject: [PATCH] Add shortId properties to reschedule events model --- ui/app/models/reschedule-event.js | 8 ++++++-- ui/app/serializers/reschedule-event.js | 8 +++----- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/ui/app/models/reschedule-event.js b/ui/app/models/reschedule-event.js index ae32ca3e6..911fe7898 100644 --- a/ui/app/models/reschedule-event.js +++ b/ui/app/models/reschedule-event.js @@ -1,12 +1,16 @@ import Fragment from 'ember-data-model-fragments/fragment'; import attr from 'ember-data/attr'; import { fragmentOwner } from 'ember-data-model-fragments/attributes'; +import shortUUIDProperty from '../utils/properties/short-uuid'; export default Fragment.extend({ allocation: fragmentOwner(), - previousAllocationID: attr('string'), - previousNodeID: attr('string'), + previousAllocationId: attr('string'), + previousNodeId: attr('string'), time: attr('date'), delay: attr('string'), + + previousAllocationShortId: shortUUIDProperty('previousAllocationId'), + previousNodeShortId: shortUUIDProperty('previousNodeShortId'), }); diff --git a/ui/app/serializers/reschedule-event.js b/ui/app/serializers/reschedule-event.js index 3a40cc62f..775ddac65 100644 --- a/ui/app/serializers/reschedule-event.js +++ b/ui/app/serializers/reschedule-event.js @@ -1,11 +1,6 @@ import ApplicationSerializer from './application'; export default ApplicationSerializer.extend({ - attrs: { - previousAllocationID: 'PrevAllocID', - previousNodeID: 'PrevNodeID', - }, - normalize(typeHash, hash) { // Time is in the form of nanoseconds since epoch, but JS dates // only understand time to the millisecond precision. So store @@ -14,6 +9,9 @@ export default ApplicationSerializer.extend({ hash.TimeNanos = hash.RescheduleTime % 1000000; hash.Time = Math.floor(hash.RescheduleTime / 1000000); + hash.PreviousAllocationId = hash.PrevAllocID ? hash.PrevAllocID : null; + hash.PreviousNodeId = hash.PrevNodeID ? hash.PrevNodeID : null; + return this._super(typeHash, hash); }, });