New scale action for jobs (and a convenience task group method)
This commit is contained in:
parent
57f4e9a62e
commit
aebc896ff6
|
@ -68,4 +68,20 @@ export default class JobAdapter extends WatchableNamespaceIDs {
|
|||
},
|
||||
});
|
||||
}
|
||||
|
||||
scale(job, group, count, reason) {
|
||||
const url = addToPath(this.urlForFindRecord(job.get('id'), 'job'), '/scale');
|
||||
return this.ajax(url, 'POST', {
|
||||
data: {
|
||||
Count: count,
|
||||
Reason: reason,
|
||||
Target: {
|
||||
Group: group,
|
||||
},
|
||||
Meta: {
|
||||
Source: 'nomad-ui',
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -245,6 +245,10 @@ export default class Job extends Model {
|
|||
return promise;
|
||||
}
|
||||
|
||||
scale(group, count, reason = 'Manual scaling event from the Nomad UI') {
|
||||
return this.store.adapterFor('job').scale(this, group, count, reason);
|
||||
}
|
||||
|
||||
setIdByPayload(payload) {
|
||||
const namespace = payload.Namespace || 'default';
|
||||
const id = payload.Name;
|
||||
|
|
|
@ -53,4 +53,8 @@ export default class TaskGroup extends Fragment {
|
|||
get summary() {
|
||||
return maybe(this.get('job.taskGroupSummaries')).findBy('name', this.name);
|
||||
}
|
||||
|
||||
scale(count, reason) {
|
||||
return this.job.scale(this.name, count, reason);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue