Merge pull request #702 from midoks/dev

计划任务修复
pull/710/head
Mr Chen 3 months ago committed by GitHub
commit d8891a1767
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 2
      web/admin/crontab/__init__.py
  2. 18
      web/static/app/crontab.js
  3. 2
      web/templates/default/crontab.html
  4. 2
      web/utils/crontab.py

@ -88,7 +88,7 @@ def modify_crond():
request_data['stype'] = request.form.get('stype', '') request_data['stype'] = request.form.get('stype', '')
request_data['sname'] = request.form.get('sname', '') request_data['sname'] = request.form.get('sname', '')
request_data['sbody'] = request.form.get('sbody', '') request_data['sbody'] = request.form.get('sbody', '')
request_data['url_address'] = request.form.get('urladdress', '') request_data['url_address'] = request.form.get('url_address', '')
cron_id = request.form.get('id', '') cron_id = request.form.get('id', '')
data = MwCrontab.instance().modifyCrond(cron_id,request_data) data = MwCrontab.instance().modifyCrond(cron_id,request_data)
return data return data

@ -283,16 +283,16 @@ function planAdd(){
} }
} }
var urladdress = $("#urladdress").val(); var url_address = $("#url_address").val();
if(sType == 'toUrl'){ if(sType == 'toUrl'){
if(!isURL(urladdress)){ if(!isURL(url_address)){
layer.msg('URL地址不正确!',{icon:2}); layer.msg('URL地址不正确!',{icon:2});
$("implement textarea[name='urladdress']").focus(); $("implement textarea[name='url_address']").focus();
return; return;
} }
} }
// urladdress = encodeURIComponent(urladdress); // url_address = encodeURIComponent(url_address);
$("#cronConfig input[name='urladdress']").val(urladdress); $("#cronConfig input[name='url_address']").val(url_address);
$("#cronConfig input[name='stype']").val(sType); $("#cronConfig input[name='stype']").val(sType);
$("#cronConfig textarea[name='sbody']").val(decodeURIComponent(sBody)); $("#cronConfig textarea[name='sbody']").val(decodeURIComponent(sBody));
@ -669,7 +669,7 @@ function editTaskInfo(id){
sname: rdata.sname, sname: rdata.sname,
backup_to: rdata.backup_to, backup_to: rdata.backup_to,
save: rdata.save, save: rdata.save,
urladdress: rdata.urladdress, url_address: rdata.url_address,
}, },
sTypeArray:[['toShell','Shell脚本'],['site','备份网站'],['database','备份数据库'],['logs','日志切割'],['path','备份目录'],['rememory','释放内存'],['toUrl','访问URL']], sTypeArray:[['toShell','Shell脚本'],['site','备份网站'],['database','备份数据库'],['logs','日志切割'],['path','备份目录'],['rememory','释放内存'],['toUrl','访问URL']],
cycleArray:[['day','每天'],['day-n','N天'],['hour','每小时'],['hour-n','N小时'],['minute-n','N分钟'],['week','每星期'],['month','每月']], cycleArray:[['day','每天'],['day-n','N天'],['hour','每小时'],['hour-n','N小时'],['minute-n','N分钟'],['week','每星期'],['month','每月']],
@ -814,7 +814,7 @@ function editTaskInfo(id){
</div>\ </div>\
<div class="clearfix plan ptb10" style="display:'+ (obj.from.stype == "toUrl"?'block;':'none') +'">\ <div class="clearfix plan ptb10" style="display:'+ (obj.from.stype == "toUrl"?'block;':'none') +'">\
<span class="typename controls c4 pull-left f14 text-right mr20">URL地址</span>\ <span class="typename controls c4 pull-left f14 text-right mr20">URL地址</span>\
<div style="line-height:34px"><input type="text" style="width:400px; height:34px" class="bt-input-text url_create" name="urladdress" placeholder="URL地址" value="'+ obj.from.urladdress +'"></div>\ <div style="line-height:34px"><input type="text" style="width:400px; height:34px" class="bt-input-text url_create" name="url_address" placeholder="URL地址" value="'+ obj.from.url_address +'"></div>\
</div>\ </div>\
<div class="clearfix plan ptb10">\ <div class="clearfix plan ptb10">\
<div class="bt-submit plan-submits " style="margin-left: 141px;">保存编辑</div>\ <div class="bt-submit plan-submits " style="margin-left: 141px;">保存编辑</div>\
@ -868,7 +868,7 @@ function editTaskInfo(id){
obj.from.sbody = $(this).val(); obj.from.sbody = $(this).val();
}); });
$('.url_create').blur(function () { $('.url_create').blur(function () {
obj.from.urladdress = $(this).val(); obj.from.url_address = $(this).val();
}); });
$('[aria-labelledby="cycle"] a').unbind().click(function () { $('[aria-labelledby="cycle"] a').unbind().click(function () {
@ -1070,7 +1070,7 @@ function toShell(){
//从脚本 //从脚本
function toUrl(){ function toUrl(){
var tBody = "<input type='text' style='width:400px; height:34px' class='bt-input-text' name='urladdress' id='urladdress' placeholder='"+lan.crontab.url_address+"' value='http://' />"; var tBody = "<input type='text' style='width:400px; height:34px' class='bt-input-text' name='url_address' id='url_address' placeholder='"+lan.crontab.url_address+"' value='http://' />";
$("#implement").html(tBody); $("#implement").html(tBody);
$(".planname input[name='name']").removeAttr('readonly style').val(""); $(".planname input[name='name']").removeAttr('readonly style').val("");
} }

@ -108,7 +108,7 @@
<input id="sfile" type="file" name="sfile" value="" /> <input id="sfile" type="file" name="sfile" value="" />
<input type="text" name="sname" value="" /> <input type="text" name="sname" value="" />
<input id="backup_to" type="text" name="backup_to" value="localhost" /> <input id="backup_to" type="text" name="backup_to" value="localhost" />
<input id="urladdress" type="text" name="urladdress" value="" /> <input id="url_address" type="text" name="url_address" value="" />
<input type="number" name="save" value="" /> <input type="number" name="save" value="" />
<input type="submit" /> <input type="submit" />
</form> </form>

@ -474,7 +474,7 @@ fi''' % (mw.getPanelDir(),)
shell = wheres[stype] shell = wheres[stype]
except: except:
if stype == 'toUrl': if stype == 'toUrl':
shell = head + "curl -sS --connect-timeout 10 -m 60 '" + param['urladdress'] + "'" shell = head + "curl -sS --connect-timeout 10 -m 60 '" + param['url_address'] + "'"
else: else:
shell = head + param['sbody'].replace("\r\n", "\n") shell = head + param['sbody'].replace("\r\n", "\n")

Loading…
Cancel
Save