2017-09-19 14:47:10 +00:00
|
|
|
import ApplicationSerializer from './application';
|
|
|
|
|
|
|
|
export default ApplicationSerializer.extend({
|
|
|
|
serialize() {
|
|
|
|
var json = ApplicationSerializer.prototype.serialize.apply(this, arguments);
|
|
|
|
|
|
|
|
if (!(json instanceof Array)) {
|
|
|
|
json = [json];
|
|
|
|
}
|
|
|
|
|
|
|
|
return json
|
|
|
|
.sortBy('SubmitTime')
|
|
|
|
.reverse()
|
|
|
|
.reduce(
|
|
|
|
(hash, version) => {
|
|
|
|
hash.Diffs.push(version.Diff);
|
|
|
|
delete version.Diff;
|
|
|
|
|
2018-07-27 23:31:25 +00:00
|
|
|
// ID is used for record tracking within Mirage,
|
|
|
|
// but Nomad uses the JobID as the version ID.
|
|
|
|
version.ID = version.TempVersionID;
|
2017-09-19 14:47:10 +00:00
|
|
|
hash.Versions.push(version);
|
|
|
|
return hash;
|
|
|
|
},
|
|
|
|
{ Versions: [], Diffs: [] }
|
|
|
|
);
|
|
|
|
},
|
|
|
|
});
|