|
|
@ -68,7 +68,7 @@ def home():
|
|
|
|
apps = []
|
|
|
|
apps = []
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
#
|
|
|
|
#
|
|
|
|
# The user must pass a key in heref
|
|
|
|
# The user must pass a key in href
|
|
|
|
key = request.header['key']
|
|
|
|
key = request.header['key']
|
|
|
|
args= dict(p)
|
|
|
|
args= dict(p)
|
|
|
|
args['uid'] = key
|
|
|
|
args['uid'] = key
|
|
|
@ -76,12 +76,13 @@ def home():
|
|
|
|
gReader = factory.instance(type=class_read,args=p)
|
|
|
|
gReader = factory.instance(type=class_read,args=p)
|
|
|
|
apps = gReader.view('summary/nodes',key=p['uid'])
|
|
|
|
apps = gReader.view('summary/nodes',key=p['uid'])
|
|
|
|
|
|
|
|
|
|
|
|
except Exception, e:
|
|
|
|
except Exception as e:
|
|
|
|
print (e)
|
|
|
|
print (e)
|
|
|
|
return render_template('dashboard.html',context=context,title=title,app_names=apps)
|
|
|
|
return render_template('dashboard.html',context=context,title=title,app_names=apps)
|
|
|
|
|
|
|
|
|
|
|
|
@app.route('/register',methods=['POST'])
|
|
|
|
|
|
|
|
def register() :
|
|
|
|
@app.route('/register', methods=['POST'])
|
|
|
|
|
|
|
|
def register():
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
This function registers a user and provides
|
|
|
|
This function registers a user and provides
|
|
|
|
"""
|
|
|
|
"""
|
|
|
@ -123,10 +124,10 @@ def get_nodes():
|
|
|
|
r = []
|
|
|
|
r = []
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
app_key = request.headers['key']
|
|
|
|
app_key = request.headers['key']
|
|
|
|
gReader = factory.instance(type=class_read,args=p)
|
|
|
|
gReader = factory.instance(type=class_read, args=p)
|
|
|
|
r = gReader.view('summary/nodes',key=app_key)
|
|
|
|
r = gReader.view('summary/nodes', key=app_key)
|
|
|
|
session['default.node'] = r[0]
|
|
|
|
session['default.node'] = r[0]
|
|
|
|
except Exception,e:
|
|
|
|
except Exception as e:
|
|
|
|
print (e)
|
|
|
|
print (e)
|
|
|
|
return json.dumps(r)
|
|
|
|
return json.dumps(r)
|
|
|
|
|
|
|
|
|
|
|
@ -143,7 +144,7 @@ def get_apps():
|
|
|
|
r = gReader.view('summary/app_names',key=p['uid'])
|
|
|
|
r = gReader.view('summary/app_names',key=p['uid'])
|
|
|
|
r = r[node_id]
|
|
|
|
r = r[node_id]
|
|
|
|
session['default.app'] = r[0]
|
|
|
|
session['default.app'] = r[0]
|
|
|
|
except Exception,e:
|
|
|
|
except Exception as e:
|
|
|
|
print (e)
|
|
|
|
print (e)
|
|
|
|
return json.dumps(r)
|
|
|
|
return json.dumps(r)
|
|
|
|
|
|
|
|
|
|
|
@ -183,7 +184,7 @@ def get_logs() :
|
|
|
|
for id in session['logs'] :
|
|
|
|
for id in session['logs'] :
|
|
|
|
r[id] = session['logs'][id]
|
|
|
|
r[id] = session['logs'][id]
|
|
|
|
# r[id] = r[node_id]
|
|
|
|
# r[id] = r[node_id]
|
|
|
|
except Exception,e:
|
|
|
|
except Exception as e:
|
|
|
|
print (e)
|
|
|
|
print (e)
|
|
|
|
return json.dumps(r)
|
|
|
|
return json.dumps(r)
|
|
|
|
@app.route("/1/set/logs",methods=['PUT'])
|
|
|
|
@app.route("/1/set/logs",methods=['PUT'])
|
|
|
@ -231,7 +232,7 @@ def get_usage_trend():
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
gReader = factory.instance(type=class_read,args=p)
|
|
|
|
gReader = factory.instance(type=class_read,args=p)
|
|
|
|
r = gReader.view('summary/resource_usage_trend',key=p['uid'])
|
|
|
|
r = gReader.view('summary/resource_usage_trend',key=p['uid'])
|
|
|
|
except Exception,e:
|
|
|
|
except Exception as e:
|
|
|
|
print (e)
|
|
|
|
print (e)
|
|
|
|
return json.dumps(r)
|
|
|
|
return json.dumps(r)
|
|
|
|
|
|
|
|
|
|
|
@ -269,7 +270,7 @@ def get_usage_detail():
|
|
|
|
else :
|
|
|
|
else :
|
|
|
|
r = r[id]
|
|
|
|
r = r[id]
|
|
|
|
|
|
|
|
|
|
|
|
except Exception,e:
|
|
|
|
except Exception as e:
|
|
|
|
print ' *** ',(e)
|
|
|
|
print ' *** ',(e)
|
|
|
|
return json.dumps(r)
|
|
|
|
return json.dumps(r)
|
|
|
|
|
|
|
|
|
|
|
@ -295,7 +296,7 @@ def app_status() :
|
|
|
|
print[nid,aid]
|
|
|
|
print[nid,aid]
|
|
|
|
r = r[nid][aid]
|
|
|
|
r = r[nid][aid]
|
|
|
|
|
|
|
|
|
|
|
|
except Exception,e:
|
|
|
|
except Exception as e:
|
|
|
|
print e
|
|
|
|
print e
|
|
|
|
|
|
|
|
|
|
|
|
return json.dumps(r)
|
|
|
|
return json.dumps(r)
|
|
|
@ -464,7 +465,7 @@ def sandbox():
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
handler.init(conf[id])
|
|
|
|
handler.init(conf[id])
|
|
|
|
r.append (dict(handler.composite(),**{"label":id}))
|
|
|
|
r.append (dict(handler.composite(),**{"label":id}))
|
|
|
|
except Exception,e:
|
|
|
|
except Exception as e:
|
|
|
|
pass
|
|
|
|
pass
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
|
|
|
|
|
|
|
@ -579,7 +580,7 @@ def user():
|
|
|
|
#_info = params[name]
|
|
|
|
#_info = params[name]
|
|
|
|
#try:
|
|
|
|
#try:
|
|
|
|
#xo = ML.Filter('label',name,d)
|
|
|
|
#xo = ML.Filter('label',name,d)
|
|
|
|
#except Exception,e:
|
|
|
|
#except Exception as e:
|
|
|
|
#xo = []
|
|
|
|
#xo = []
|
|
|
|
##print name,e
|
|
|
|
##print name,e
|
|
|
|
#if len(xo) == 0:
|
|
|
|
#if len(xo) == 0:
|
|
|
|