38 lines
1.0 KiB
JavaScript
38 lines
1.0 KiB
JavaScript
|
|
// 启动调度器
|
||
|
|
async function startScheduler() {
|
||
|
|
try {
|
||
|
|
const response = await fetch(`${API_BASE}/api/scheduler/start`, {
|
||
|
|
method: 'POST'
|
||
|
|
});
|
||
|
|
const data = await response.json();
|
||
|
|
|
||
|
|
if (data.success) {
|
||
|
|
showToast('调度器已启动', 'success');
|
||
|
|
getSchedulerStatus();
|
||
|
|
} else {
|
||
|
|
showToast(data.message || '启动失败', 'error');
|
||
|
|
}
|
||
|
|
} catch (error) {
|
||
|
|
showToast('启动失败: ' + error.message, 'error');
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
// 停止调度器
|
||
|
|
async function stopScheduler() {
|
||
|
|
try {
|
||
|
|
const response = await fetch(`${API_BASE}/api/scheduler/stop`, {
|
||
|
|
method: 'POST'
|
||
|
|
});
|
||
|
|
const data = await response.json();
|
||
|
|
|
||
|
|
if (data.success) {
|
||
|
|
showToast('调度器已停止', 'success');
|
||
|
|
getSchedulerStatus();
|
||
|
|
} else {
|
||
|
|
showToast(data.message || '停止失败', 'error');
|
||
|
|
}
|
||
|
|
} catch (error) {
|
||
|
|
showToast('停止失败: ' + error.message, 'error');
|
||
|
|
}
|
||
|
|
}
|