mirror of
https://github.com/kemko/nomad.git
synced 2026-01-03 17:05:43 +03:00
New scale action for jobs (and a convenience task group method)
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user