Support pausing jobs #104313
@ -2,6 +2,7 @@ import { defineStore } from 'pinia';
|
|||||||
|
|
||||||
import * as API from '@/manager-api';
|
import * as API from '@/manager-api';
|
||||||
import { getAPIClient } from '@/api-client';
|
import { getAPIClient } from '@/api-client';
|
||||||
|
import { useJobs } from '@/stores/jobs';
|
||||||
|
|
||||||
const jobsAPI = new API.JobsApi(getAPIClient());
|
const jobsAPI = new API.JobsApi(getAPIClient());
|
||||||
|
|
||||||
@ -19,6 +20,14 @@ export const useTasks = defineStore('tasks', {
|
|||||||
}),
|
}),
|
||||||
getters: {
|
getters: {
|
||||||
canCancel() {
|
canCancel() {
|
||||||
|
const jobs = useJobs();
|
||||||
|
const activeJob = jobs.activeJob;
|
||||||
|
|
||||||
|
// Check if the job status is 'pause-requested'
|
||||||
|
if (activeJob && activeJob.status === 'pause-requested') {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
// Allow cancellation for specified task statuses
|
||||||
return this._anyTaskWithStatus(['queued', 'active', 'soft-failed']);
|
return this._anyTaskWithStatus(['queued', 'active', 'soft-failed']);
|
||||||
},
|
},
|
||||||
canRequeue() {
|
canRequeue() {
|
||||||
|
Loading…
Reference in New Issue
Block a user