mirror of
https://github.com/midoks/mdserver-web.git
synced 2026-10-18 23:45:52 +08:00
update
This commit is contained in:
+10
-6
@@ -2,6 +2,7 @@
|
|||||||
<div class="bt-w-main">
|
<div class="bt-w-main">
|
||||||
<div class="bt-w-menu">
|
<div class="bt-w-menu">
|
||||||
<p class="bgw" onclick="readme();">插件说明</p>
|
<p class="bgw" onclick="readme();">插件说明</p>
|
||||||
|
<p onclick="projectList();">项目列表</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="bt-w-con pd15">
|
<div class="bt-w-con pd15">
|
||||||
@@ -12,12 +13,15 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
$.getScript( "/plugins/file?name=gae&f=js/gae.js");
|
||||||
|
|
||||||
function readme() {
|
readme();
|
||||||
$('.bt-w-main .soft-man-con').hide();
|
function readme(){
|
||||||
$('.bt-w-main .v0').show();
|
var html = '<p>开发文档:https://cloud.google.com/sdk/docs/</p>';
|
||||||
|
html += '<p>* 注意:本插件通过Google <a class="btlink" target="_blank" href="https://cloud.google.com/sdk/docs/scripting-gcloud">JSON 格式</a>赋权免交互式</p>';
|
||||||
|
html += '<p>* 注意:添加:gcloud auth activate-service-account --key-file [KEY_FILE] << y</p>';
|
||||||
|
|
||||||
|
html += '<p>* 注意:设置后,一般同步项目命令:gcloud app deploy << y</p>';
|
||||||
|
$('.bt-w-main .soft-man-con').html(html);
|
||||||
}
|
}
|
||||||
|
|
||||||
//../google-cloud-sdk/bin/gcloud app deploy << y
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
@@ -11,10 +11,97 @@ sys.path.append(os.getcwd() + "/class/core")
|
|||||||
import public
|
import public
|
||||||
|
|
||||||
|
|
||||||
|
def getPluginName():
|
||||||
|
return 'gae'
|
||||||
|
|
||||||
|
|
||||||
|
def getPluginDir():
|
||||||
|
return public.getPluginDir() + '/' + getPluginName()
|
||||||
|
|
||||||
|
|
||||||
|
def getServerDir():
|
||||||
|
return public.getServerDir() + '/' + getPluginName()
|
||||||
|
|
||||||
|
|
||||||
|
def getInitDFile():
|
||||||
|
if app_debug:
|
||||||
|
return '/tmp/' + getPluginName()
|
||||||
|
return '/etc/init.d/' + getPluginName()
|
||||||
|
|
||||||
|
|
||||||
|
def getArgs():
|
||||||
|
args = sys.argv[2:]
|
||||||
|
tmp = {}
|
||||||
|
args_len = len(args)
|
||||||
|
|
||||||
|
if args_len == 1:
|
||||||
|
t = args[0].strip('{').strip('}')
|
||||||
|
t = t.split(':')
|
||||||
|
tmp[t[0]] = t[1]
|
||||||
|
elif args_len > 1:
|
||||||
|
for i in range(len(args)):
|
||||||
|
t = args[i].split(':')
|
||||||
|
tmp[t[0]] = t[1]
|
||||||
|
|
||||||
|
return tmp
|
||||||
|
|
||||||
|
|
||||||
def status():
|
def status():
|
||||||
return 'start'
|
return 'start'
|
||||||
|
|
||||||
|
|
||||||
|
def getAllProjectList(search):
|
||||||
|
path = public.getWwwDir()
|
||||||
|
dlist = []
|
||||||
|
if os.path.exists(path):
|
||||||
|
for filename in os.listdir(path):
|
||||||
|
tmp = {}
|
||||||
|
filePath = path + '/' + filename
|
||||||
|
if os.path.isdir(filePath):
|
||||||
|
if search == '':
|
||||||
|
tmp['name'] = filename
|
||||||
|
tmp['dir'] = filePath
|
||||||
|
dlist.append(tmp)
|
||||||
|
else:
|
||||||
|
if filename.find(search) != -1:
|
||||||
|
tmp['name'] = filename
|
||||||
|
tmp['dir'] = filePath
|
||||||
|
dlist.append(tmp)
|
||||||
|
return dlist
|
||||||
|
|
||||||
|
|
||||||
|
def projectList():
|
||||||
|
args = getArgs()
|
||||||
|
|
||||||
|
page = 1
|
||||||
|
page_size = 10
|
||||||
|
search = ''
|
||||||
|
if 'page' in args:
|
||||||
|
page = int(args['page'])
|
||||||
|
|
||||||
|
if 'page_size' in args:
|
||||||
|
page_size = int(args['page_size'])
|
||||||
|
|
||||||
|
if 'search' in args:
|
||||||
|
search = args['search']
|
||||||
|
|
||||||
|
dlist = getAllProjectList(search)
|
||||||
|
dlist_sum = len(dlist)
|
||||||
|
|
||||||
|
start = (page - 1) * page_size
|
||||||
|
ret_data = dlist[start:start + page_size]
|
||||||
|
|
||||||
|
data = {}
|
||||||
|
data['data'] = ret_data
|
||||||
|
data['list'] = public.getPage(
|
||||||
|
{'count': dlist_sum, 'p': page, 'row': 10, 'tojs': 'projectList'})
|
||||||
|
return public.getJson(data)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
func = sys.argv[1]
|
func = sys.argv[1]
|
||||||
if func == 'status':
|
if func == 'status':
|
||||||
print status()
|
print status()
|
||||||
|
elif func == 'project_list':
|
||||||
|
print projectList()
|
||||||
|
else:
|
||||||
|
print 'error'
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
"title":"GAE",
|
"title":"GAE",
|
||||||
"tip":"soft",
|
"tip":"soft",
|
||||||
"name":"gae",
|
"name":"gae",
|
||||||
"ps":"GAE 英文全称为 Google App Engine。它是 Google 管理的数据中心中用于 WEB 应用程序的开发和托管的平台",
|
"ps":"GAE 英文全称为Google App Engine。它是Google管理的数据中心中用于WEB应用程序的开发和托管的平台",
|
||||||
"versions": "0.1",
|
"versions": "0.1",
|
||||||
"shell":"install.sh",
|
"shell":"install.sh",
|
||||||
"checks":"server/gae",
|
"checks":"server/gae",
|
||||||
|
|||||||
Executable
+90
@@ -0,0 +1,90 @@
|
|||||||
|
function gaePost(method,args,callback){
|
||||||
|
var loadT = layer.msg('正在获取...', { icon: 16, time: 0, shade: 0.3 });
|
||||||
|
$.post('/plugins/run', {name:'gae', func:method, args:JSON.stringify(args)}, function(data) {
|
||||||
|
layer.close(loadT);
|
||||||
|
if (!data.status){
|
||||||
|
layer.msg(data.msg,{icon:0,time:2000,shade: [0.3, '#000']});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(typeof(callback) == 'function'){
|
||||||
|
callback(data);
|
||||||
|
}
|
||||||
|
},'json');
|
||||||
|
}
|
||||||
|
|
||||||
|
function projectList(page, search){
|
||||||
|
var _data = {};
|
||||||
|
_data['page_size'] = 10;
|
||||||
|
if (typeof(search) != 'undefined'){
|
||||||
|
_data['search'] = search;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof(page) != 'undefined'){
|
||||||
|
_data['page'] = page;
|
||||||
|
setCookie('gaeProjectListPage',page);
|
||||||
|
} else {
|
||||||
|
_data['page'] = 1;
|
||||||
|
cookie_page = getCookie('gaeProjectListPage')
|
||||||
|
if (cookie_page >0){
|
||||||
|
_data['page'] = cookie_page;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
gaePost('project_list', _data, function(data){
|
||||||
|
|
||||||
|
var rdata = $.parseJSON($.trim(data.data));
|
||||||
|
// console.log(rdata);
|
||||||
|
|
||||||
|
content = '<div><input class="bt-input-text mr5" type="text" placeholder="查找项目" id="project_find" style="height: 28px; border-radius: 3px;width: 435px;">';
|
||||||
|
content += '<button class="btn btn-success btn-sm" onclick="projectListFind();">查找</button></div>';
|
||||||
|
|
||||||
|
content += '<div class="divtable" style="margin-top:5px;"><table class="table table-hover" width="100%" cellspacing="0" cellpadding="0" border="0">';
|
||||||
|
content += '<thead><tr>';
|
||||||
|
content += '<th>项目名</th>';
|
||||||
|
content += '<th>地址</th>';
|
||||||
|
content += '<th>操作</th>';
|
||||||
|
content += '</tr></thead>';
|
||||||
|
content += '<tbody>';
|
||||||
|
|
||||||
|
|
||||||
|
ulist = rdata.data;
|
||||||
|
for (i in ulist){
|
||||||
|
content += '<tr><td>'+ulist[i]['name']+'</td>'+
|
||||||
|
'<td>'+ulist[i]['dir']+'</td><td>'+
|
||||||
|
'<a class="btlink" onclick="gaeSetProject(\''+ulist[i]['name']+'\')">设置</a> | ' +
|
||||||
|
'<a class="btlink" onclick="csvnAclProject(\''+ulist[i]['name']+'\')">同步</a> | ' +
|
||||||
|
'<a class="btlink" target="_blank" href="' + '' +'">查看命令</a>' +
|
||||||
|
'</td></tr>';
|
||||||
|
}
|
||||||
|
|
||||||
|
content += '</tbody>';
|
||||||
|
content += '</table></div>';
|
||||||
|
|
||||||
|
page = '<div class="dataTables_paginate paging_bootstrap pagination" style="margin-top:0px;"><ul id="softPage" class="page"><div>';
|
||||||
|
page += rdata.list;
|
||||||
|
page += '</div></ul></div>';
|
||||||
|
|
||||||
|
content += page;
|
||||||
|
$(".soft-man-con").html(content);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function projectListFind(){
|
||||||
|
var search = $('#project_find').val();
|
||||||
|
if (search == ''){
|
||||||
|
layer.msg('查找字符不能为空!',{icon:0,time:2000,shade: [0.3, '#000']});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
projectList(1, search);
|
||||||
|
}
|
||||||
|
|
||||||
|
function gaeSetProject(name){
|
||||||
|
gaePost('project_list_set', '', function(data){
|
||||||
|
console.log
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -12,14 +12,6 @@
|
|||||||
<div class="clearfix bgw mtb15 pd15">
|
<div class="clearfix bgw mtb15 pd15">
|
||||||
<div class="safe-port pull-left">
|
<div class="safe-port pull-left">
|
||||||
|
|
||||||
|
|
||||||
<div class="ss-text pull-left mr50">
|
|
||||||
<em>自动更新</em>
|
|
||||||
<div class='ssh-item'>
|
|
||||||
<input class='btswitch btswitch-ios' id='autoUpdate' type='checkbox' $data['panel']['auto'] >
|
|
||||||
<label class='btswitch-btn' for='autoUpdate' onclick="SetPanelAutoUpload()"></label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="ss-text pull-left mr50">
|
<div class="ss-text pull-left mr50">
|
||||||
<em class="btlink" style="color: #20a53a;" onclick="GetPanelSSL()" title="点击自定义面板证书">面板SSL</em>
|
<em class="btlink" style="color: #20a53a;" onclick="GetPanelSSL()" title="点击自定义面板证书">面板SSL</em>
|
||||||
<div class='ssh-item'>
|
<div class='ssh-item'>
|
||||||
|
|||||||
Reference in New Issue
Block a user