Fix scale and summary adapters to correct live reloading

This commit is contained in:
Michael Lange 2020-07-28 18:24:24 -07:00
parent 602b6771ba
commit b0f2a9f51d
4 changed files with 16 additions and 7 deletions

View File

@ -1,3 +1,7 @@
import WatchableNamespaceIDs from './watchable-namespace-ids';
export default class JobScaleAdapter extends WatchableNamespaceIDs {}
export default class JobScaleAdapter extends WatchableNamespaceIDs {
urlForFindRecord(id, type, hash) {
return super.urlForFindRecord(id, 'job', hash, 'scale');
}
}

View File

@ -1,3 +1,7 @@
import WatchableNamespaceIDs from './watchable-namespace-ids';
export default class JobSummaryAdapter extends WatchableNamespaceIDs {}
export default class JobSummaryAdapter extends WatchableNamespaceIDs {
urlForFindRecord(id, type, hash) {
return super.urlForFindRecord(id, 'job', hash, 'summary');
}
}

View File

@ -35,9 +35,10 @@ export default class WatchableNamespaceIDs extends Watchable {
return associateNamespace(url, namespace);
}
urlForFindRecord(id, type, hash) {
urlForFindRecord(id, type, hash, pathSuffix) {
const [name, namespace] = JSON.parse(id);
let url = super.urlForFindRecord(name, type, hash);
if (pathSuffix) url += `/${pathSuffix}`;
return associateNamespace(url, namespace);
}

View File

@ -55,8 +55,8 @@ export default class TaskGroupRoute extends Route.extend(WithWatchers) {
const job = model.get('job');
controller.set('watchers', {
job: this.watchJob.perform(job),
summary: this.watchSummary.perform(job),
scale: this.watchScale.perform(job),
summary: this.watchSummary.perform(job.get('summary')),
scale: this.watchScale.perform(job.get('scaleState')),
allocations: this.watchAllocations.perform(job),
latestDeployment: job.get('supportsDeployments') && this.watchLatestDeployment.perform(job),
});
@ -64,8 +64,8 @@ export default class TaskGroupRoute extends Route.extend(WithWatchers) {
}
@watchRecord('job') watchJob;
@watchRelationship('job-summary') watchSummary;
@watchRelationship('job-scale') watchScale;
@watchRecord('job-summary') watchSummary;
@watchRecord('job-scale') watchScale;
@watchRelationship('allocations') watchAllocations;
@watchRelationship('latestDeployment') watchLatestDeployment;