diff --git a/plugins/gitea/index.py b/plugins/gitea/index.py index ad56f1c87..fb54066f8 100755 --- a/plugins/gitea/index.py +++ b/plugins/gitea/index.py @@ -639,7 +639,7 @@ def projectScriptUnload(): name = args['name'] + '.git' post_receive = getRootPath() + '/' + user + '/' + name + \ - '/custom_hooks/post-receive' + '/hooks/post-receive.d/post-receive' mw.execShell('rm -f ' + post_receive) commit = getRootPath() + '/' + user + '/' + name + \ diff --git a/plugins/gitea/js/gitea.js b/plugins/gitea/js/gitea.js index ffdab52e1..0b8b28e2d 100755 --- a/plugins/gitea/js/gitea.js +++ b/plugins/gitea/js/gitea.js @@ -176,6 +176,28 @@ function giteaUserList(page, search) { } function userProjectList(user, search){ + var loadOpen = layer.open({ + type: 1, + title: '用户('+user+')项目列表', + area: '500px', + content:"
\ +
\ +
\ + \ + \ + \ +
项目操作
\ + \ +
\ +
\ +
", + success:function(){ + userProjectListPost(user,search); + } + }); +} + +function userProjectListPost(user, search){ var req = {}; if (!isNaN(user)){ req['page'] = user; @@ -216,24 +238,10 @@ function userProjectList(user, search){ '; } - var page = ''; + $('#gitea_table tbody').html(list); - var loadOpen = layer.open({ - type: 1, - title: '用户('+user+')项目列表', - area: '500px', - content:"
\ -
\ -
\ - \ - \ - " + list + "\ -
项目操作
" + - page + - "
" - }); + var page = rdata['data']['list']; + $('#gitea_table .gitea_page').html(page); }); } @@ -242,23 +250,41 @@ function projectScript(user, name,has_hook){ // console.log(user,name,has_hook); var html = ''; if (has_hook){ - html += ''; - html += ''; - html += ''; - html += ''; + html += ''; + html += ''; + html += ''; + html += ''; } else { - html += ''; + html += ''; } var loadOpen = layer.open({ type: 1, title: '['+user+']['+name+']脚本设置', area: '240px', - content:'
'+html+'
' + content:'
'+html+'
', + success:function(layero,index) { + + $('.hook_edit').click(function(){ + projectScriptEdit(user,name,index); + }); + + $('.hook_log').click(function(){ + projectScriptDebug(user,name,index); + }); + + $('.hook_load').click(function(){ + projectScriptLoad(user,name,index); + }); + + $('.hook_unload').click(function(){ + projectScriptUnload(user,name,index); + }); + } }); } -function projectScriptEdit(user,name){ +function projectScriptEdit(user,name,index){ gogsPost('project_script_edit', {'user':user,'name':name}, function(data){ var rdata = $.parseJSON(data.data); if (rdata['status']){ @@ -269,7 +295,7 @@ function projectScriptEdit(user,name){ }); } -function projectScriptLoad(user,name){ +function projectScriptLoad(user,name,index){ gogsPost('project_script_load', {'user':user,'name':name}, function(data){ if (data.data != 'ok'){ layer.msg(data.data,{icon:0,time:2000,shade: [0.3, '#000']}); @@ -277,32 +303,34 @@ function projectScriptLoad(user,name){ } showMsg('加载成功!',function(){ - userProjectList(1); + layer.close(index); + userProjectListPost(1); },{icon:1,time:2000,shade: [0.3, '#000']},2000); }); } -function projectScriptUnload(user,name){ +function projectScriptUnload(user,name,index){ gogsPost('project_script_unload', {'user':user,'name':name}, function(data){ if (data.data != 'ok'){ layer.msg(data.data,{icon:0,time:2000,shade: [0.3, '#000']}); return; } - layer.msg('卸载成功!',{icon:1,time:2000,shade: [0.3, '#000']}); - setTimeout(function(){ - userProjectList(1); - }, 2000); + showMsg('卸载成功!',function(){ + layer.close(index); + userProjectListPost(1); + },{icon:1,time:2000,shade: [0.3, '#000']},2000); }); } -function projectScriptDebug(user,name){ +function projectScriptDebug(user,name,index){ gogsPost('project_script_debug', {'user':user,'name':name}, function(data){ var rdata = $.parseJSON(data.data); if (rdata['status']){ onlineEditFile(0, rdata['path']); } else { - layer.msg(rdata.msg,{icon:1,time:2000,shade: [0.3, '#000']}); + showMsg(rdata.msg,function(){ + },{icon:1,time:2000,shade: [0.3, '#000']},2000); } }); }