Add ability to force a periodic job launch
This commit is contained in:
parent
732c61baf9
commit
abcfda9911
|
@ -65,4 +65,17 @@ export default ApplicationAdapter.extend({
|
|||
const url = this.buildURL('job', name, job, 'findRecord');
|
||||
return this.ajax(url, 'GET', { data: assign(this.buildQuery() || {}, namespaceQuery) });
|
||||
},
|
||||
|
||||
forcePeriodic(job) {
|
||||
if (job.get('periodic')) {
|
||||
const [name, namespace] = JSON.parse(job.get('id'));
|
||||
let url = `${this.buildURL('job', name, job, 'findRecord')}/periodic/force`;
|
||||
|
||||
if (namespace) {
|
||||
url += `?namespace=${namespace}`;
|
||||
}
|
||||
|
||||
return this.ajax(url, 'POST');
|
||||
}
|
||||
},
|
||||
});
|
||||
|
|
|
@ -1,3 +1,15 @@
|
|||
import AbstractJobPage from './abstract';
|
||||
import { inject as service } from '@ember/service';
|
||||
|
||||
export default AbstractJobPage.extend();
|
||||
export default AbstractJobPage.extend({
|
||||
store: service(),
|
||||
actions: {
|
||||
forceLaunch() {
|
||||
this.get('job')
|
||||
.forcePeriodic()
|
||||
.then(() => {
|
||||
this.get('store').findAll('job');
|
||||
});
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
|
@ -139,6 +139,10 @@ export default Model.extend({
|
|||
return this.store.adapterFor('job').fetchRawDefinition(this);
|
||||
},
|
||||
|
||||
forcePeriodic() {
|
||||
return this.store.adapterFor('job').forcePeriodic(this);
|
||||
},
|
||||
|
||||
statusClass: computed('status', function() {
|
||||
const classMap = {
|
||||
pending: 'is-pending',
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
{{job.name}}
|
||||
<span class="bumper-left tag {{job.statusClass}}" data-test-job-status>{{job.status}}</span>
|
||||
<span class="tag is-hollow">periodic</span>
|
||||
<button class="button is-primary" onclick={{action "forceLaunch"}}>Force Launch</button>
|
||||
</h1>
|
||||
|
||||
<div class="boxed-section job-stats">
|
||||
|
|
Loading…
Reference in a new issue