update
This commit is contained in:
parent
9ef6f691e9
commit
b23938986e
|
|
@ -73,15 +73,65 @@ def getAllProjectList(search):
|
|||
def checkProjectListIsSet(data):
|
||||
dlen = len(data)
|
||||
for x in range(dlen):
|
||||
path = getServerDir() + data[x]['name'] + '.json'
|
||||
path = getServerDir() + '/' + data[x]['name'] + '.json'
|
||||
if os.path.exists(path):
|
||||
data[x]['isset'] = True
|
||||
if os.path.getsize(path) == 0:
|
||||
data[x]['isset'] = False
|
||||
else:
|
||||
data[x]['isset'] = True
|
||||
else:
|
||||
data[x]['isset'] = False
|
||||
|
||||
return data
|
||||
|
||||
|
||||
def projectListEdit():
|
||||
args = getArgs()
|
||||
if not 'name' in args:
|
||||
return 'missing name!'
|
||||
|
||||
file = getServerDir() + '/' + args['name'] + '.json'
|
||||
if not os.path.exists(file):
|
||||
public.execShell('touch ' + file)
|
||||
return file
|
||||
|
||||
|
||||
def projectListDel():
|
||||
args = getArgs()
|
||||
if not 'name' in args:
|
||||
return 'missing name!'
|
||||
|
||||
file = getServerDir() + '/' + args['name'] + '.json'
|
||||
if os.path.exists(file):
|
||||
public.execShell('rm -rf ' + file)
|
||||
return 'ok'
|
||||
|
||||
|
||||
def projectListAsync():
|
||||
import subprocess
|
||||
args = getArgs()
|
||||
if not 'name' in args:
|
||||
return 'missing name!'
|
||||
|
||||
file = getServerDir() + '/' + args['name'] + '.json'
|
||||
if not os.path.exists(file):
|
||||
return 'file not exists!'
|
||||
|
||||
content = public.readFile(file)
|
||||
contentObj = json.loads(content)
|
||||
asyncUser = contentObj['client_email']
|
||||
cmd = getServerDir() + '/google-cloud-sdk/bin/'
|
||||
projectDir = public.getWwwDir() + '/' + args['name']
|
||||
|
||||
public.execShell(cmd + 'gcloud config set account ' + asyncUser)
|
||||
asyncCmd = 'cd ' + projectDir + ' && ' + cmd + 'gcloud app deploy << y &'
|
||||
public.execShell(asyncCmd)
|
||||
|
||||
# subprocess.Popen(asyncCmd,
|
||||
# stdout=subprocess.PIPE, shell=True)
|
||||
return 'ok'
|
||||
|
||||
|
||||
def projectList():
|
||||
args = getArgs()
|
||||
|
||||
|
|
@ -116,5 +166,11 @@ if __name__ == "__main__":
|
|||
print status()
|
||||
elif func == 'project_list':
|
||||
print projectList()
|
||||
elif func == 'project_list_edit':
|
||||
print projectListEdit()
|
||||
elif func == 'project_list_del':
|
||||
print projectListDel()
|
||||
elif func == 'project_list_async':
|
||||
print projectListAsync()
|
||||
else:
|
||||
print 'error'
|
||||
|
|
|
|||
|
|
@ -81,9 +81,7 @@ function projectListFind(){
|
|||
}
|
||||
|
||||
function gaeSetProject(pname,isset){
|
||||
|
||||
var html = '';
|
||||
|
||||
if (isset){
|
||||
html += '<button onclick="gaeProjectDel(\''+pname+'\')" class="btn btn-default btn-sm">删除</button>';
|
||||
}
|
||||
|
|
@ -98,7 +96,26 @@ function gaeSetProject(pname,isset){
|
|||
}
|
||||
|
||||
function gaeProjectEdit(pname){
|
||||
|
||||
gaePost('project_list_edit', {'name':pname}, function(data){
|
||||
onlineEditFile(0,data.data);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function gaeProjectDel(pname){
|
||||
gaePost('project_list_del', {'name':pname}, function(data){
|
||||
layer.msg('删除成功!',{icon:0,time:2000,shade: [0.3, '#000']});
|
||||
projectList();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function gaeAsyncProject(pname){
|
||||
console.log(pname);
|
||||
gaePost('project_list_async', {'name':pname}, function(data){
|
||||
console.log(data);
|
||||
// layer.msg('同步成功!',{icon:0,time:2000,shade: [0.3, '#000']});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue