Skip to content

Commit

Permalink
增加一键部署中导入的自定义项目的删除功能
Browse files Browse the repository at this point in the history
  • Loading branch information
showpy committed Jun 21, 2019
1 parent b9f97ab commit d451880
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
18 changes: 16 additions & 2 deletions BTPanel/static/js/soft.js
Original file line number Diff line number Diff line change
Expand Up @@ -350,24 +350,38 @@ var soft = {
<th>简介</th>\
<th>支持PHP版本</th>\
<th>提供者</th>\
<th style="text-align: right;" width="80">操作</th>\
<th style="text-align: right;" width="120">操作</th>\
</tr>\
</thead>';
for (var i = 0; i < rdata.list.length; i++) {
var remove_opt = '';
if (rdata.list[i].id === 0) {
remove_opt = ' | <a class="btlink" onclick="soft.remove_other_dep(\'' + rdata.list[i].name + '\')">删除</a>';
}
zbody += '<tr>'
+ '<td><img src="'+rdata.list[i].min_image+'">' + rdata.list[i].title + '</td>'
+ '<td>' + rdata.list[i].version + '</td>'
+ '<td>' + rdata.list[i].ps + '</td>'
+ '<td>' + rdata.list[i].php + '</td>'
+ '<td><a class="btlink" target="_blank" href="' + rdata.list[i].official + '">' + (rdata.list[i].author == '宝塔' ? rdata.list[i].title : rdata.list[i].author) + '</a></td>'
+ '<td class="text-right"><a href="javascript:onekeyCodeSite(\'' + rdata.list[i].name + '\',\'' + rdata.list[i].php + '\',\'' + rdata.list[i].title + '\',\'' + rdata.list[i].enable_functions + '\');" class="btlink">一键部署</a></td>'
+ '<td class="text-right"><a href="javascript:onekeyCodeSite(\'' + rdata.list[i].name + '\',\'' + rdata.list[i].php + '\',\'' + rdata.list[i].title + '\',\'' + rdata.list[i].enable_functions + '\');" class="btlink">一键部署</a>' + remove_opt+'</td>'
+ '</tr>'
}
$("#softList").html(zbody);
$(".searchInput").val('');

});
},
remove_other_dep: function (name) {
bt.show_confirm('删除自定义项目', '您真的要删除[' + name + ']吗?', function () {
var loadT = layer.msg('正在删除,请稍候...', { icon: 16, time: 0, shade: 0.3 });
$.post('/deployment?action=DelPackage', { dname: name }, function (rdata) {
layer.close(loadT);
if (rdata.status) soft.get_dep_list();
setTimeout(function () { layer.msg(rdata.msg, { icon: rdata.status ? 1 : 2 }); }, 1000);
});
});
},
input_package: function () {
var con = '<form class="bt-form pd20 pb70" id="input_package">\
<div class="line"><span class="tname">英文名</span>\
Expand Down
4 changes: 2 additions & 2 deletions BTPanel/templates/default/firewall.html
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ <h3 class="f16">{{data['lan']['H4']}}</h3>
content: '<div class="setchmod bt-form pb70">'
+ '<pre class="crontab-log" style="overflow: auto; border: 0px none; line-height:23px;padding: 15px; margin: 0px; white-space: pre-wrap; height: 405px; background-color: rgb(51,51,51);color:#f1f1f1;border-radius:0px;font-family: \"微软雅黑\"">' + (rdata.msg == '' ? '当前日志为空' : rdata.msg) + '</pre>'
+ '<div class="bt-form-submit-btn" style="margin-top: 0px;">'
+ '<button type="button" class="btn btn-danger btn-sm btn-title" style="margin-right:15px;" onclick="firewalld.clean_panel_error_logs()">' + lan.public.empty + '</button>'
+ '<button type="button" class="btn btn-danger btn-sm btn-title" style="margin-right:15px;" onclick="firewall.clean_panel_error_logs()">' + lan.public.empty + '</button>'
+ '<button type="button" class="btn btn-success btn-sm btn-title" onclick="layer.closeAll()">' + lan.public.close + '</button>'
+ '</div>'
+ '</div>'
Expand All @@ -328,7 +328,7 @@ <h3 class="f16">{{data['lan']['H4']}}</h3>
layer.msg(lan.public.the_get, { icon: 16, time: 0, shade: [0.3, '#000'] });
$.post('/config?action=clean_panel_error_logs', {}, function (rdata) {
layer.closeAll();
layer.msg(rdata.msg, { icon: 2 });
layer.msg(rdata.msg, { icon: 1 });
});
}
}
Expand Down
2 changes: 1 addition & 1 deletion class/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -900,4 +900,4 @@ def clean_panel_error_logs(self,get):
filename = 'logs/error.log'
public.writeFile(filename,'')
public.WriteLog('面板配置','清空面板运行日志')
public.returnMsg(True,'已清空!')
return public.returnMsg(True,'已清空!')

0 comments on commit d451880

Please sign in to comment.