mirror of
https://github.com/midoks/mdserver-web.git
synced 2026-10-11 07:19:26 +08:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
42edf12d01 | ||
|
|
d6799e89c4 | ||
|
|
4b4006c9da | ||
|
|
33bb042b41 | ||
|
|
be2e91b9ce | ||
|
|
db424f8912 | ||
|
|
bfca2e313a | ||
|
|
1de51747e6 | ||
|
|
8a623b490b | ||
|
|
b5b8ef7e46 | ||
|
|
daa561b6c4 | ||
|
|
9bc30db1ad | ||
|
|
1a9d506d61 | ||
|
|
62b5d812e2 | ||
|
|
433c9ab5ea | ||
|
|
a7a6976204 |
+3
-3
@@ -128,6 +128,7 @@ lib/python*
|
||||
bin
|
||||
pyvenv.cfg
|
||||
include
|
||||
share
|
||||
pip-selfcheck.json
|
||||
|
||||
scripts/mdserver-web
|
||||
@@ -141,15 +142,14 @@ data/ssl.pl
|
||||
data/edate.pl
|
||||
data/osname.pl
|
||||
data/system.db-journal
|
||||
data/hook_*.json
|
||||
|
||||
plugins/l2tp
|
||||
plugins/openlitespeed
|
||||
plugins/gdrive
|
||||
plugins/mtproxy
|
||||
plugins/zimg
|
||||
plugins/bk_demo
|
||||
debug.out
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
### mdserver-web 0.9.5
|
||||
### mdserver-web 0.9.6
|
||||
|
||||
简单的Linux面板,感谢BT.CN写出如此好的web管理软件。我一看到,就知道这是我一直想要的页面化管理方式。
|
||||
复制了后台管理界面,按照自己想要的方式写了一版。
|
||||
@@ -71,13 +71,11 @@ docker run -itd --name mw-server --privileged=true -p 7200:7200 -p 80:80 -p 443:
|
||||
```
|
||||
|
||||
|
||||
### 版本更新 0.9.5
|
||||
### 版本更新 0.9.6
|
||||
|
||||
* 页面更新优化[2].
|
||||
* 修复maridb的用户管理[2].
|
||||
* Gogs初始化提示更人性.
|
||||
* MySQL&&MariaDB修改密码修复.
|
||||
* MySQL&&MariaDB导入修复.
|
||||
* 增加插件备份功能.
|
||||
* supervisor增加错误日志查看.
|
||||
* MariaDB安装源优化.
|
||||
|
||||
|
||||
### JSDelivr安装地址
|
||||
@@ -127,13 +125,12 @@ curl -fsSL https://raw.githubusercontent.com/midoks/mdserver-web/dev/scripts/up
|
||||
```
|
||||
|
||||
### 微信赞助
|
||||
[](/route/static/img/weixin_zz.jpg)
|
||||
[](https://cdn.jsdelivr.net/gh/midoks/mdserver-web@latest/route/static/img/weixin_zz.jpg)
|
||||
|
||||
|
||||
### 无图不真相
|
||||
|
||||
[](/route/static/mdw.jpg)
|
||||
|
||||
[](https://cdn.jsdelivr.net/gh/midoks/mdserver-web@latest/route/static/mdw.jpg)
|
||||
|
||||
|
||||
### Stargazers over time
|
||||
|
||||
+18
-11
@@ -295,9 +295,18 @@ class crontab_api:
|
||||
# 取数据列表
|
||||
def getDataListApi(self):
|
||||
stype = request.form.get('type', '')
|
||||
|
||||
bak_data = []
|
||||
|
||||
if stype == 'sites' or stype == 'databases':
|
||||
hookPath = mw.getPanelDataDir() + "/hook_backup.json"
|
||||
if os.path.exists(hookPath):
|
||||
t = mw.readFile(hookPath)
|
||||
bak_data = json.loads(t)
|
||||
|
||||
if stype == 'databases':
|
||||
db_list = {}
|
||||
db_list['orderOpt'] = []
|
||||
db_list['orderOpt'] = bak_data
|
||||
path = mw.getServerDir() + '/mysql'
|
||||
if not os.path.exists(path + '/mysql.db'):
|
||||
db_list['data'] = []
|
||||
@@ -307,8 +316,9 @@ class crontab_api:
|
||||
return mw.getJson(db_list)
|
||||
|
||||
data = {}
|
||||
data['orderOpt'] = bak_data
|
||||
|
||||
data['data'] = mw.M(stype).field('name,ps').select()
|
||||
data['orderOpt'] = []
|
||||
return mw.getJson(data)
|
||||
##### ----- start ----- ###
|
||||
|
||||
@@ -411,16 +421,13 @@ class crontab_api:
|
||||
'rememory': head + "/bin/bash " + script_dir + '/rememory.sh'
|
||||
}
|
||||
if param['backup_to'] != 'localhost':
|
||||
cfile = mw.getServerDir() + "/mdserver-web/plugin/" + \
|
||||
param['backup_to'] + "/" + param['backup_to'] + "_main.py"
|
||||
if not os.path.exists(cfile):
|
||||
cfile = script_dir + "/backup_" + \
|
||||
param['backup_to'] + ".py"
|
||||
cfile = mw.getPluginDir() + "/" + \
|
||||
param['backup_to'] + "/index.py"
|
||||
wheres = {
|
||||
'path': head + "python " + cfile + " path " + param['sname'] + " " + str(param['save']),
|
||||
'site': head + "python " + cfile + " site " + param['sname'] + " " + str(param['save']),
|
||||
'database': head + "python " + cfile + " database " + param['sname'] + " " + str(param['save']),
|
||||
'logs': head + "python " + script_dir + "/logs_backup.py " + param['sname'] + log + " " + str(param['save']),
|
||||
'path': head + "python3 " + cfile + " path " + param['sname'] + " " + str(param['save']),
|
||||
'site': head + "python3 " + cfile + " site " + param['sname'] + " " + str(param['save']),
|
||||
'database': head + "python3 " + cfile + " database " + param['sname'] + " " + str(param['save']),
|
||||
'logs': head + "python3 " + script_dir + "/logs_backup.py " + param['sname'] + log + " " + str(param['save']),
|
||||
'rememory': head + "/bin/bash " + script_dir + '/rememory.sh'
|
||||
}
|
||||
try:
|
||||
|
||||
@@ -676,8 +676,7 @@ class files_api:
|
||||
data['encoding'] = 'utf-8'
|
||||
if char['encoding'] == 'Big5':
|
||||
data['encoding'] = 'BIG5'
|
||||
if not char['encoding'] in ['GBK', 'utf-8',
|
||||
'BIG5']:
|
||||
if not char['encoding'] in ['GBK', 'utf-8', 'BIG5']:
|
||||
data['encoding'] = 'utf-8'
|
||||
try:
|
||||
if sys.version_info[0] == 2:
|
||||
|
||||
+12
-8
@@ -57,10 +57,22 @@ def getPluginDir():
|
||||
return getRunDir() + '/plugins'
|
||||
|
||||
|
||||
def getPanelDataDir():
|
||||
return getRunDir() + '/data'
|
||||
|
||||
|
||||
def getServerDir():
|
||||
return getRootDir() + '/server'
|
||||
|
||||
|
||||
def getLogsDir():
|
||||
return getRootDir() + '/wwwlogs'
|
||||
|
||||
|
||||
def getBackupDir():
|
||||
return getRootDir() + '/backup'
|
||||
|
||||
|
||||
def getWwwDir():
|
||||
file = getRunDir() + '/data/site.pl'
|
||||
if os.path.exists(file):
|
||||
@@ -73,14 +85,6 @@ def setWwwDir(wdir):
|
||||
return writeFile(file, wdir)
|
||||
|
||||
|
||||
def getLogsDir():
|
||||
return getRootDir() + '/wwwlogs'
|
||||
|
||||
|
||||
def getBackupDir():
|
||||
return getRootDir() + '/backup'
|
||||
|
||||
|
||||
def setBackupDir(bdir):
|
||||
file = getRunDir() + '/data/backup.pl'
|
||||
return writeFile(file, bdir)
|
||||
|
||||
@@ -114,6 +114,7 @@ class plugins_api:
|
||||
return mw.returnJson(False, '配置文件不存在!', ())
|
||||
|
||||
pluginInfo = json.loads(mw.readFile(infoJsonPos))
|
||||
self.hookInstall(pluginInfo)
|
||||
|
||||
execstr = "cd " + os.getcwd() + "/plugins/" + \
|
||||
name + " && /bin/bash " + pluginInfo["shell"] \
|
||||
@@ -131,6 +132,55 @@ class plugins_api:
|
||||
mw.triggerTask()
|
||||
return mw.returnJson(True, '已将安装任务添加到队列!')
|
||||
|
||||
def hookInstallFile(self, hook_name, info):
|
||||
hookPath = mw.getPanelDataDir() + "/hook_" + hook_name + ".json"
|
||||
data = []
|
||||
if os.path.exists(hookPath):
|
||||
t = mw.readFile(hookPath)
|
||||
data = json.loads(t)
|
||||
|
||||
isNeedAdd = True
|
||||
for x in range(len(data)):
|
||||
if data[x]['title'] == info['title'] and data[x]['name'] == info['name']:
|
||||
isNeedAdd = False
|
||||
|
||||
if isNeedAdd:
|
||||
tmp = {}
|
||||
tmp['title'] = info['title']
|
||||
tmp['name'] = info['name']
|
||||
data.append(tmp)
|
||||
mw.writeFile(hookPath, json.dumps(data))
|
||||
|
||||
def hookUninstallFile(self, hook_name, info):
|
||||
hookPath = mw.getPanelDataDir() + "/hook_" + hook_name + ".json"
|
||||
data = []
|
||||
if os.path.exists(hookPath):
|
||||
t = mw.readFile(hookPath)
|
||||
data = json.loads(t)
|
||||
|
||||
for idx in range(len(data)):
|
||||
if data[idx]['title'] == info['title'] and data[idx]['name'] == info['name']:
|
||||
data.remove(data[idx])
|
||||
mw.writeFile(hookPath, json.dumps(data))
|
||||
|
||||
def hookInstall(self, info):
|
||||
if 'hook' in info:
|
||||
hooks = info['hook']
|
||||
for x in hooks:
|
||||
if x in ['backup']:
|
||||
self.hookInstallFile(x, info)
|
||||
return True
|
||||
return False
|
||||
|
||||
def hookUninstall(self, info):
|
||||
if 'hook' in info:
|
||||
hooks = info['hook']
|
||||
for x in hooks:
|
||||
if x in ['backup']:
|
||||
self.hookUninstallFile(x, info)
|
||||
return True
|
||||
return False
|
||||
|
||||
def uninstallOldApi(self):
|
||||
rundir = mw.getRunDir()
|
||||
name = request.form.get('name', '')
|
||||
@@ -147,7 +197,6 @@ class plugins_api:
|
||||
return mw.returnJson(False, "配置文件不存在!", ())
|
||||
|
||||
pluginInfo = json.loads(mw.readFile(infoJsonPos))
|
||||
|
||||
execstr = "cd " + os.getcwd() + "/plugins/" + \
|
||||
name + " && /bin/bash " + pluginInfo["shell"] \
|
||||
+ " uninstall " + version
|
||||
@@ -175,13 +224,13 @@ class plugins_api:
|
||||
return mw.returnJson(False, "配置文件不存在!", ())
|
||||
|
||||
pluginInfo = json.loads(mw.readFile(infoJsonPos))
|
||||
|
||||
self.hookUninstall(pluginInfo)
|
||||
execstr = "cd " + os.getcwd() + "/plugins/" + \
|
||||
name + " && /bin/bash " + pluginInfo["shell"] \
|
||||
+ " uninstall " + version
|
||||
|
||||
data = mw.execShell(execstr)
|
||||
if mw.isAppleSystem():
|
||||
if mw.isDebugMode():
|
||||
print(execstr)
|
||||
print(data[0], data[1])
|
||||
self.removeIndex(name, version)
|
||||
@@ -793,7 +842,7 @@ class plugins_api:
|
||||
print('getIndexList:', e)
|
||||
|
||||
# 使用gevent模式时,无法使用多进程
|
||||
#plist = self.checkStatusMProcess(plist)
|
||||
# plist = self.checkStatusMProcess(plist)
|
||||
plist = self.checkStatusMThreads(plist)
|
||||
return plist
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ sysName=`uname`
|
||||
install_tmp=${rootPath}/tmp/mw_install.pl
|
||||
mariadbDir=${serverPath}/source/mariadb
|
||||
|
||||
MY_VER=10.6.8
|
||||
MY_VER=10.6.9
|
||||
|
||||
Install_app()
|
||||
{
|
||||
@@ -57,10 +57,15 @@ Install_app()
|
||||
fi
|
||||
# ----- cpu end ------
|
||||
|
||||
# https://mirrors.aliyun.com/mariadb/mariadb-10.8.3/source/mariadb-10.8.3.tar.gz
|
||||
if [ ! -f ${mariadbDir}/mariadb-${MY_VER}.tar.gz ];then
|
||||
# https://mirrors.aliyun.com/mariadb/mariadb-10.8.3/source/mariadb-10.8.3.tar.gz
|
||||
wget -O ${mariadbDir}/mariadb-${MY_VER}.tar.gz --tries=3 https://mirrors.aliyun.com/mariadb/mariadb-${MY_VER}/source/mariadb-${MY_VER}.tar.gz
|
||||
# wget -O ${mariadbDir}/mariadb-${MY_VER}.tar.gz --tries=3 https://downloads.mariadb.org/interstitial/mariadb-${MY_VER}/source/mariadb-${MY_VER}.tar.gz
|
||||
wget --no-check-certificate -O ${mariadbDir}/mariadb-${MY_VER}.tar.gz --tries=3 https://mirrors.aliyun.com/mariadb/mariadb-${MY_VER}/source/mariadb-${MY_VER}.tar.gz
|
||||
|
||||
fi
|
||||
|
||||
# https://downloads.mariadb.org/interstitial/mariadb-10.6.8/source/mariadb-10.6.8.tar.gz
|
||||
if [ "$?" != "0" ];then
|
||||
wget --no-check-certificate -O ${mariadbDir}/mariadb-${MY_VER}.tar.gz --tries=3 https://downloads.mariadb.org/interstitial/mariadb-${MY_VER}/source/mariadb-${MY_VER}.tar.gz
|
||||
fi
|
||||
|
||||
if [ ! -d ${mariadbDir}/mariadb-${MY_VER} ];then
|
||||
|
||||
@@ -14,7 +14,7 @@ sysName=`uname`
|
||||
install_tmp=${rootPath}/tmp/mw_install.pl
|
||||
mariadbDir=${serverPath}/source/mariadb
|
||||
|
||||
MY_VER=10.7.4
|
||||
MY_VER=10.7.5
|
||||
|
||||
Install_app()
|
||||
{
|
||||
@@ -58,14 +58,16 @@ Install_app()
|
||||
# ----- cpu end ------
|
||||
|
||||
if [ ! -f ${mariadbDir}/mariadb-${MY_VER}.tar.gz ];then
|
||||
wget -O ${mariadbDir}/mariadb-${MY_VER}.tar.gz --tries=3 https://mirrors.aliyun.com/mariadb/mariadb-${MY_VER}/source/mariadb-${MY_VER}.tar.gz
|
||||
# wget -O ${mariadbDir}/mariadb-${MY_VER}.tar.gz --tries=3 https://downloads.mariadb.org/interstitial/mariadb-${MY_VER}/source/mariadb-${MY_VER}.tar.gz
|
||||
wget --no-check-certificate -O ${mariadbDir}/mariadb-${MY_VER}.tar.gz --tries=3 https://mirrors.aliyun.com/mariadb/mariadb-${MY_VER}/source/mariadb-${MY_VER}.tar.gz
|
||||
fi
|
||||
|
||||
if [ "$?" != "0" ];then
|
||||
wget --no-check-certificate -O ${mariadbDir}/mariadb-${MY_VER}.tar.gz --tries=3 https://downloads.mariadb.org/interstitial/mariadb-${MY_VER}/source/mariadb-${MY_VER}.tar.gz
|
||||
fi
|
||||
|
||||
if [ ! -d ${mariadbDir}/mariadb-${MY_VER} ];then
|
||||
cd ${mariadbDir} && tar -zxvf ${mariadbDir}/mariadb-${MY_VER}.tar.gz
|
||||
fi
|
||||
|
||||
|
||||
if [ ! -d $serverPath/mariadb ];then
|
||||
cd ${mariadbDir}/mariadb-${MY_VER} && cmake \
|
||||
|
||||
@@ -14,7 +14,7 @@ sysName=`uname`
|
||||
install_tmp=${rootPath}/tmp/mw_install.pl
|
||||
mariadbDir=${serverPath}/source/mariadb
|
||||
|
||||
MY_VER=10.8.3
|
||||
MY_VER=10.8.4
|
||||
|
||||
Install_app()
|
||||
{
|
||||
@@ -58,8 +58,11 @@ Install_app()
|
||||
# ----- cpu end ------
|
||||
|
||||
if [ ! -f ${mariadbDir}/mariadb-${MY_VER}.tar.gz ];then
|
||||
wget -O ${mariadbDir}/mariadb-${MY_VER}.tar.gz --tries=3 https://mirrors.aliyun.com/mariadb/mariadb-${MY_VER}/source/mariadb-${MY_VER}.tar.gz
|
||||
# wget -O ${mariadbDir}/mariadb-${MY_VER}.tar.gz --tries=3 https://downloads.mariadb.org/interstitial/mariadb-${MY_VER}/source/mariadb-${MY_VER}.tar.gz
|
||||
wget --no-check-certificate -O ${mariadbDir}/mariadb-${MY_VER}.tar.gz --tries=3 https://mirrors.aliyun.com/mariadb/mariadb-${MY_VER}/source/mariadb-${MY_VER}.tar.gz
|
||||
fi
|
||||
|
||||
if [ "$?" != "0" ];then
|
||||
wget --no-check-certificate -O ${mariadbDir}/mariadb-${MY_VER}.tar.gz --tries=3 https://downloads.mariadb.org/interstitial/mariadb-${MY_VER}/source/mariadb-${MY_VER}.tar.gz
|
||||
fi
|
||||
|
||||
if [ ! -d ${mariadbDir}/mariadb-${MY_VER} ];then
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
.conf_p span {
|
||||
display: inline-block;
|
||||
margin-right: 10px;
|
||||
width: 95px;
|
||||
width: 135px;
|
||||
text-align: right;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -39,7 +39,11 @@ if [ ! -d $sourcePath/php/php${PHP_VER} ];then
|
||||
mv $sourcePath/php/php-${version} $sourcePath/php/php${PHP_VER}
|
||||
fi
|
||||
|
||||
|
||||
if [ ! -d $sourcePath/php/php${PHP_VER} ];then
|
||||
rm -rf $sourcePath/php/php-${version}.tar.xz
|
||||
echo "reinstall php${version}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cd $sourcePath/php/php${PHP_VER}
|
||||
|
||||
|
||||
@@ -339,7 +339,10 @@ function createSendTask(name = ''){
|
||||
layer.msg(rdata.msg,{icon:rdata.status?1:2,time:2000,shade: [0.3, '#000']});
|
||||
|
||||
if (rdata.status){
|
||||
setTimeout(function(){layer.close(index);},2000);
|
||||
setTimeout(function(){
|
||||
layer.close(index);
|
||||
lsyncdSend();
|
||||
},2000);
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -477,6 +477,28 @@ def readConfigLogTpl():
|
||||
return mw.returnJson(False, 'OK', '')
|
||||
|
||||
|
||||
def readConfigLogErrorTpl():
|
||||
args = getArgs()
|
||||
data = checkArgs(args, ['file'])
|
||||
if not data[0]:
|
||||
return data[1]
|
||||
file_log = args['file']
|
||||
line_log = args['line']
|
||||
|
||||
with open(file_log, "r") as fr:
|
||||
infos = fr.readlines()
|
||||
|
||||
stderr_logfile = ''
|
||||
for line in infos:
|
||||
if "stderr_logfile=" in line.strip():
|
||||
stderr_logfile = line.strip().split('=')[1]
|
||||
|
||||
if stderr_logfile != '':
|
||||
data = mw.getNumLines(stderr_logfile, int(line_log))
|
||||
return mw.returnJson(True, 'OK', data)
|
||||
return mw.returnJson(False, 'OK', '')
|
||||
|
||||
|
||||
def supClearLog():
|
||||
args = getArgs()
|
||||
data = checkArgs(args, ['file'])
|
||||
@@ -529,6 +551,8 @@ if __name__ == "__main__":
|
||||
print(readConfigTpl())
|
||||
elif func == 'read_config_log_tpl':
|
||||
print(readConfigLogTpl())
|
||||
elif func == 'read_config_log_error_tpl':
|
||||
print(readConfigLogErrorTpl())
|
||||
elif func == 'sup_clear_log':
|
||||
print(supClearLog())
|
||||
elif func == 'conf':
|
||||
|
||||
@@ -405,7 +405,7 @@ function supConfigTpl(_name, version, func, config_tpl_func, read_config_tpl_fun
|
||||
return;
|
||||
}
|
||||
|
||||
$("#textBody").empty().text(rdata.data);
|
||||
$("#textBody").empty().html(rdata.data);
|
||||
$(".CodeMirror").remove();
|
||||
var editor = CodeMirror.fromTextArea(document.getElementById("textBody"), {
|
||||
extraKeys: {
|
||||
@@ -424,7 +424,7 @@ function supConfigTpl(_name, version, func, config_tpl_func, read_config_tpl_fun
|
||||
$(".CodeMirror-scroll").css({"height":"300px","margin":0,"padding":0});
|
||||
$("#onlineEditFileBtn").unbind('click');
|
||||
$("#onlineEditFileBtn").click(function(){
|
||||
$("#textBody").text(editor.getValue());
|
||||
$("#textBody").html(editor.getValue());
|
||||
pluginConfigSave(fileName);
|
||||
});
|
||||
},'json');
|
||||
@@ -474,6 +474,7 @@ function supLogs(_name, config_tpl_func, read_config_tpl_func,line){
|
||||
|
||||
var con = '<div><select id="config_tpl" class="bt-input-text mr20" style="width:30%;margin-bottom: 3px;"><option value="0">请选择</option></select>\
|
||||
<button id="sup_clear_log" class="btn btn-success btn-sm clear_logs mr5">清理日志</button>\
|
||||
<button id="sup_error_log" class="btn btn-success btn-sm clear_logs mr5">查看错误日志</button>\
|
||||
</div>';
|
||||
con += '<textarea readonly="" style="margin: 0px;width: 100%;height: 520px;background-color: #333;color:#fff; padding:0 5px" id="info_log"></textarea>';
|
||||
$(".soft-man-con").html(con);
|
||||
@@ -489,6 +490,21 @@ function supLogs(_name, config_tpl_func, read_config_tpl_func,line){
|
||||
});
|
||||
}
|
||||
|
||||
function errorLog(file,file_line){
|
||||
$('#sup_error_log').click(function(){
|
||||
var _args = JSON.stringify({file:file,line:file_line});
|
||||
$.post('/plugins/run', {name:_name, func:'read_config_log_error_tpl',args:_args}, function(data){
|
||||
var rdata = $.parseJSON(data.data);
|
||||
if (!rdata.status){
|
||||
layer.msg(rdata.msg,{icon:0,time:2000,shade: [0.3, '#000']});
|
||||
return;
|
||||
}
|
||||
|
||||
$("#info_log").empty().html(rdata.data);
|
||||
},'json');
|
||||
});
|
||||
}
|
||||
|
||||
var loadT = layer.msg('日志路径获取中...',{icon:16,time:0,shade: [0.3, '#000']});
|
||||
$.post('/plugins/run', {name:_name, func:_config_tpl_func},function (data) {
|
||||
layer.close(loadT);
|
||||
@@ -517,10 +533,11 @@ function supLogs(_name, config_tpl_func, read_config_tpl_func,line){
|
||||
return;
|
||||
}
|
||||
|
||||
$("#info_log").empty().text(rdata.data);
|
||||
$("#info_log").empty().html(rdata.data);
|
||||
},'json');
|
||||
|
||||
clearLog(selected);
|
||||
errorLog(selected,file_line);
|
||||
///
|
||||
});
|
||||
|
||||
|
||||
+16
-11
@@ -203,6 +203,7 @@ function planAdd(){
|
||||
$("#set-Config input[name='type']").val(type);
|
||||
|
||||
var where1 = $("#ptime input[name='where1']").val();
|
||||
|
||||
var is1;
|
||||
var is2 = 1;
|
||||
switch(type){
|
||||
@@ -226,6 +227,7 @@ function planAdd(){
|
||||
return;
|
||||
}
|
||||
|
||||
where1 = $('#excode_week b').attr('val');
|
||||
$("#set-Config input[name='where1']").val(where1);
|
||||
|
||||
var hour = $("#ptime input[name='hour']").val();
|
||||
@@ -305,7 +307,9 @@ function planAdd(){
|
||||
|
||||
$("#set-Config input[name='sName']").val(sName);
|
||||
layer.msg('正在添加,请稍候...!',{icon:16,time:0,shade: [0.3, '#000']});
|
||||
var data= $("#set-Config").serialize() + '&sBody='+sBody + '&urladdress=' + urladdress;
|
||||
var data = $("#set-Config").serialize() + '&sBody='+sBody + '&urladdress=' + urladdress;
|
||||
|
||||
console.log(data);
|
||||
$.post('/crontab/add',data,function(rdata){
|
||||
if(!rdata.status) {
|
||||
layer.msg(rdata.msg,{icon:2, time:2000});
|
||||
@@ -469,9 +473,9 @@ function toBackup(type){
|
||||
sOpt += '<li><a role="menuitem" tabindex="-1" href="javascript:;" value="'+rdata.data[i].name+'">'+rdata.data[i].name+'['+rdata.data[i].ps+']</a></li>';
|
||||
}
|
||||
|
||||
var orderOpt = ''
|
||||
var orderOpt = '';
|
||||
for (var i=0;i<rdata.orderOpt.length;i++){
|
||||
orderOpt += '<li><a role="menuitem" tabindex="-1" href="javascript:;" value="'+rdata.orderOpt[i].value+'">'+rdata.orderOpt[i].name+'</a></li>'
|
||||
orderOpt += '<li><a role="menuitem" tabindex="-1" href="javascript:;" value="'+rdata.orderOpt[i].name+'">'+rdata.orderOpt[i].title+'</a></li>'
|
||||
}
|
||||
|
||||
|
||||
@@ -514,7 +518,7 @@ function editTaskInfo(id){
|
||||
layer.msg('正在获取,请稍候...',{icon:16,time:0,shade: [0.3, '#000']});
|
||||
$.post('/crontab/get_crond_find',{id:id},function(rdata){
|
||||
layer.closeAll();
|
||||
// console.log('init:', rdata);
|
||||
// console.log('get_crond_find:', rdata);
|
||||
var sTypeName = '',sTypeDom = '',cycleName = '',cycleDom = '',weekName = '',weekDom = '',sNameName ='',sNameDom = '',backupsName = '',backupsDom ='';
|
||||
obj = {
|
||||
from:{
|
||||
@@ -557,10 +561,11 @@ function editTaskInfo(id){
|
||||
|
||||
if(obj.from.stype == 'site' || obj.from.stype == 'database' || obj.from.stype == 'path' || obj.from.stype == 'logs'){
|
||||
$.post('/crontab/get_data_list',{type:obj.from.stype == 'databases'?'database':'sites'},function(rdata){
|
||||
// console.log(rdata);
|
||||
obj.sNameArray = rdata.data;
|
||||
obj.sNameArray.unshift({name:'ALL',ps:'所有'});
|
||||
obj.backupsArray = rdata.orderOpt;
|
||||
obj.backupsArray.unshift({name:'服务器磁盘',value:'localhost'});
|
||||
obj.backupsArray.unshift({title:'服务器磁盘',name:'localhost'});
|
||||
for(var i = 0; i <obj['sNameArray'].length; i++){
|
||||
if(obj.from['sname'] == obj['sNameArray'][i]['name']){
|
||||
sNameName = obj['sNameArray'][i]['ps'];
|
||||
@@ -568,10 +573,10 @@ function editTaskInfo(id){
|
||||
sNameDom += '<li><a role="menuitem" href="javascript:;" value="'+ obj['sNameArray'][i]['name'] +'">'+ obj['sNameArray'][i]['ps'] +'</a></li>';
|
||||
}
|
||||
for(var i = 0; i <obj['backupsArray'].length; i++){
|
||||
if(obj.from['backup_to'] == obj['backupsArray'][i]['value']) {
|
||||
backupsName = obj['backupsArray'][i]['name'];
|
||||
if(obj.from['backup_to'] == obj['backupsArray'][i]['name']) {
|
||||
backupsName = obj['backupsArray'][i]['title'];
|
||||
}
|
||||
backupsDom += '<li><a role="menuitem" href="javascript:;" value="'+ obj['backupsArray'][i]['value'] +'">'+ obj['backupsArray'][i]['name'] +'</a></li>';
|
||||
backupsDom += '<li><a role="menuitem" href="javascript:;" value="'+ obj['backupsArray'][i]['name'] +'">'+ obj['backupsArray'][i]['title'] +'</a></li>';
|
||||
}
|
||||
callback();
|
||||
},'json');
|
||||
@@ -629,7 +634,7 @@ function editTaskInfo(id){
|
||||
<span class="typename controls c4 pull-left f14 text-right mr20">'+ sTypeName +'</span>\
|
||||
<div style="line-height:34px"><div class="dropdown pull-left mr20 sName_btn" style="display:'+ (obj.from.sType != "path"?'block;':'none') +'">\
|
||||
<button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown" style="width:auto" disabled="disabled">\
|
||||
<b id="sName" val="'+ obj.from.sname +'">'+ sNameName +'</b>\
|
||||
<b id="sName" val="'+ obj.from.sname +'">'+ obj.from.sname +'</b>\
|
||||
<span class="caret"></span>\
|
||||
</button>\
|
||||
<ul class="dropdown-menu" role="menu" aria-labelledby="sName">'+ sNameDom +'</ul>\
|
||||
@@ -835,10 +840,10 @@ function closeOpt(){
|
||||
//星期
|
||||
function toWeek(){
|
||||
var mBody = '<div class="dropdown planweek pull-left mr20">\
|
||||
<button class="btn btn-default dropdown-toggle" type="button" id="excode" data-toggle="dropdown">\
|
||||
<button class="btn btn-default dropdown-toggle" type="button" id="excode_week" data-toggle="dropdown">\
|
||||
<b val="1">周一</b> <span class="caret"></span>\
|
||||
</button>\
|
||||
<ul class="dropdown-menu" role="menu" aria-labelledby="excode">\
|
||||
<ul class="dropdown-menu" role="menu" aria-labelledby="excode_week">\
|
||||
<li><a role="menuitem" tabindex="-1" href="javascript:;" value="1">周一</a></li>\
|
||||
<li><a role="menuitem" tabindex="-1" href="javascript:;" value="2">周二</a></li>\
|
||||
<li><a role="menuitem" tabindex="-1" href="javascript:;" value="3">周三</a></li>\
|
||||
|
||||
Reference in New Issue
Block a user