[dashboard v0.3.9] 手动即时触发计划任务

This commit is contained in:
naiba
2021-01-24 09:41:35 +08:00
parent 175eb996d3
commit a957b21265
10 changed files with 195 additions and 116 deletions

View File

@@ -149,7 +149,7 @@ function addOrEditCron(cron) {
modal.find('input[name=ID]').val(cron ? cron.ID : null)
modal.find('input[name=Name]').val(cron ? cron.Name : null)
modal.find('input[name=Scheduler]').val(cron ? cron.Scheduler : null)
modal.find('a.ui.label.visible').each((i,el) => {
modal.find('a.ui.label.visible').each((i, el) => {
el.remove()
})
var servers
@@ -192,6 +192,42 @@ function deleteRequest(api) {
});
}
function manualTrigger(btn, cronId) {
$(btn).toggleClass('loading')
$.ajax({
url: '/api/cron/' + cronId + '/manual',
type: 'GET',
}).done(resp => {
$(btn).toggleClass('loading')
if (resp.code == 200) {
$.suiAlert({
title: '触发成功,等待执行结果',
type: 'success',
description: resp.message,
time: '3',
position: 'top-center',
});
} else {
$.suiAlert({
title: '触发失败 ',
type: 'error',
description: resp.code + '' + resp.message,
time: '3',
position: 'top-center',
});
}
}).fail(err => {
$(btn).toggleClass('loading')
$.suiAlert({
title: '触发失败 ',
type: 'error',
description: '网络错误:' + err.responseText,
time: '3',
position: 'top-center',
});
});
}
function logout(id) {
$.post('/api/logout', JSON.stringify({ id: id })).done(function (resp) {
if (resp.code == 200) {