'init'
This commit is contained in:
37
static/js/scheduler.js
Normal file
37
static/js/scheduler.js
Normal file
@@ -0,0 +1,37 @@
|
||||
// 启动调度器
|
||||
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');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user