open-nomad/ui/app/serializers/job-version.js

29 lines
836 B
JavaScript
Raw Normal View History

import { assign } from '@ember/polyfills';
2017-09-19 14:47:10 +00:00
import ApplicationSerializer from './application';
export default class JobVersionSerializer extends ApplicationSerializer {
attrs = {
2017-09-19 14:47:10 +00:00
number: 'Version',
};
2017-09-19 14:47:10 +00:00
normalizeFindHasManyResponse(store, modelClass, hash, id, requestType) {
const zippedVersions = hash.Versions.map((version, index) =>
assign({}, version, {
Diff: hash.Diffs && hash.Diffs[index],
ID: `${version.ID}-${version.Version}`,
JobID: JSON.stringify([version.ID, version.Namespace || 'default']),
2017-09-19 14:47:10 +00:00
SubmitTime: Math.floor(version.SubmitTime / 1000000),
SubmitTimeNanos: version.SubmitTime % 1000000,
})
);
return super.normalizeFindHasManyResponse(
store,
modelClass,
zippedVersions,
hash,
id,
requestType
);
}
}