CO - Bug fix with api

community
Steve L. Nyemba 7 years ago
parent a453d9d2aa
commit 1dae493121

@ -62,6 +62,8 @@ def home():
title = 'Dashboard'
apps = []
try:
#
# The user must pass a key in heref
gReader = factory.instance(type=class_read,args=p)
apps = gReader.view('summary/nodes',key=p['uid'])
@ -79,6 +81,7 @@ def get_nodes():
try:
gReader = factory.instance(type=class_read,args=p)
r = gReader.view('summary/nodes',key=p['uid'])
session['default.node'] = r[0]
except Exception,e:
print (e)
return json.dumps(r)
@ -95,7 +98,7 @@ def get_apps():
gReader = factory.instance(type=class_read,args=p)
r = gReader.view('summary/app_names',key=p['uid'])
r = r[node_id]
print r
session['default.app'] = r[0]
except Exception,e:
print (e)
return json.dumps(r)
@ -152,10 +155,21 @@ def get_usage_detail():
"""
r = {}
try:
id = request.args['id'] if 'id' in request.args else request.args.get('node')
app_id = request.args.get('app')
if 'id' not in request.args and 'node' not in request.args :
id = session['default.node']
else:
id = request.args['id'] if 'id' in request.args else request.args.get('node')
if 'app' not in request.args :
app_id = session['default.app']
else:
app_id = request.args.get('app')
#
# removing trailing white spaces
id = id.strip()
app_id = app_id.strip()
gReader = factory.instance(type=class_read,args=p)
r = gReader.view('summary/app_resource_usage_details',key=p['uid'])
print r.keys()
r = r[id][app_id]
except Exception,e:
print (e)

Loading…
Cancel
Save