open-nomad/ui/app/serializers/job-version.js
Buck Doyle cd11cd290c Add manually-converted classes
I don’t know why the codemod ignored these files 🧐
2020-06-15 10:14:26 -05:00

29 lines
836 B
JavaScript

import { assign } from '@ember/polyfills';
import ApplicationSerializer from './application';
export default class JobVersionSerializer extends ApplicationSerializer {
attrs = {
number: 'Version',
};
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']),
SubmitTime: Math.floor(version.SubmitTime / 1000000),
SubmitTimeNanos: version.SubmitTime % 1000000,
})
);
return super.normalizeFindHasManyResponse(
store,
modelClass,
zippedVersions,
hash,
id,
requestType
);
}
}