2017-12-15 21:39:18 +00:00
|
|
|
import { assign } from '@ember/polyfills';
|
2017-09-19 14:47:10 +00:00
|
|
|
import ApplicationSerializer from './application';
|
|
|
|
|
2020-06-11 21:23:00 +00:00
|
|
|
export default class JobVersionSerializer extends ApplicationSerializer {
|
|
|
|
attrs = {
|
2017-09-19 14:47:10 +00:00
|
|
|
number: 'Version',
|
2020-06-11 21:23:00 +00:00
|
|
|
};
|
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}`,
|
2018-02-27 22:57:19 +00:00
|
|
|
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,
|
|
|
|
})
|
|
|
|
);
|
2020-06-11 21:23:00 +00:00
|
|
|
return super.normalizeFindHasManyResponse(
|
|
|
|
store,
|
|
|
|
modelClass,
|
|
|
|
zippedVersions,
|
|
|
|
hash,
|
|
|
|
id,
|
|
|
|
requestType
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|