mirror of
https://github.com/kemko/nomad.git
synced 2026-01-07 19:05:42 +03:00
Treat job-summary like a typical relationship rather than a custom link
This way ED doesn't eagerly fetch the job summary even when it's already in the store due to the jobs list endpoint
This commit is contained in:
12
ui/app/adapters/job-summary.js
Normal file
12
ui/app/adapters/job-summary.js
Normal file
@@ -0,0 +1,12 @@
|
||||
import Watchable from './watchable';
|
||||
|
||||
export default Watchable.extend({
|
||||
urlForFindRecord(id, type, hash) {
|
||||
const [name, namespace] = JSON.parse(id);
|
||||
let url = this._super(name, 'job', hash) + '/summary';
|
||||
if (namespace && namespace !== 'default') {
|
||||
url += `?namespace=${namespace}`;
|
||||
}
|
||||
return url;
|
||||
},
|
||||
});
|
||||
@@ -21,6 +21,10 @@ export default ApplicationSerializer.extend({
|
||||
hash.ParentID = JSON.stringify([hash.ParentID, hash.NamespaceID || 'default']);
|
||||
}
|
||||
|
||||
// Job Summary is always at /:job-id/summary, but since it can also come from
|
||||
// the job list, it's better for Ember Data to be linked by ID association.
|
||||
hash.SummaryID = hash.ID;
|
||||
|
||||
// Periodic is a boolean on list and an object on single
|
||||
if (hash.Periodic instanceof Object) {
|
||||
hash.PeriodicDetails = hash.Periodic;
|
||||
@@ -55,11 +59,6 @@ export default ApplicationSerializer.extend({
|
||||
.split('?');
|
||||
|
||||
return assign(this._super(...arguments), {
|
||||
summary: {
|
||||
links: {
|
||||
related: buildURL(`${jobURL}/summary`, { namespace: namespace }),
|
||||
},
|
||||
},
|
||||
allocations: {
|
||||
links: {
|
||||
related: buildURL(`${jobURL}/allocations`, { namespace: namespace }),
|
||||
|
||||
Reference in New Issue
Block a user