community
Gogs 6 years ago
parent 64911f6e83
commit c2d188d556

@ -102,8 +102,6 @@ def update_plan(uid,plan,auid=None):
httpclient = requests.session()
r = httpclient.post(url,headers=headers)
#r = requests.post(url,headers=headers)
print url
print [r.text,r.status_code]
return json.loads( r.text)
except Exception,e:
@ -821,7 +819,6 @@ def InitCollector():
# The database name will be overriden by the user's current plan
#
#global class_write,class_read,CONFIG
print 'plan' in session,CONFIG['store']['args']
if 'plan' not in session :
config = json.loads(json.dumps(CONFIG))
plan = config['plan']
@ -1106,8 +1103,9 @@ def prepare_plot(id):
q = [{"info":"Monitoring RAM consumption trends","ylabel":"% used","node":node, "x":XRAM,"labels":np.arange(1,xn).tolist(),"series":names,"title":"RAM Usage"}]
q.append({"info":"Monitoring CPU consumption trends","ylabel":"% used","node":node,"type":"bar","x":XCPU,"labels":np.arange(1,xn_).tolist(),"series":names,"title":"CPU Usage"})
key = 'app.trend.'+node
key = 'apps@'+node
session[key] = q
print session.keys()
return (key,200)
except Exception,e:
print (e)
@ -1118,6 +1116,11 @@ def prepare_plot(id):
@app.route("/1/plot/<format>/<id>/<key>",methods=['GET'])
def get_charts(format,id,key):
print session.keys()
if key not in session :
context = SYS_ARGS.PARAMS['context'] if 'context' in SYS_ARGS.PARAMS else ''
return render_template('error.html',context=context,caption='404',msg='Session key NOT set in session')
remove = request.args['no'].split(',') if 'no' in request.args else []
series = ['series_1']
@ -1150,7 +1153,7 @@ if __name__== '__main__':
SESSION_PERMANENT=True
app.config['SESSION_TYPE'] = 'filesystem'
app.config['MAX_CONTENT_LENGTH'] = 1600 * 1024 * 1024
app.config['MAX_CONTENT_LENGTH'] = 9600 * 1024 * 1024
app.secret_key = '360-8y-[0v@t10n]+kr81v17y'
if 'port' not in SYS_ARGS.PARAMS :
SYS_ARGS.PARAMS['port'] = 8484

@ -248,7 +248,7 @@
}else{
var uri = '/monitor/1/plot/apps'
var uri = '{{context|safe}}/1/plot/apps'
var body = {node:_id.replace(/app_grid_/,'')}
body.names = jx.utils.patterns.visitor(keys,function(id){
return selected[id].name
@ -260,7 +260,7 @@
if(x.status == 200){
var key = x.responseText.trim()
jx.modal.show({url:'/monitor/1/plot/html/line/'+key+'?draw-all' })
jx.modal.show({url:'{{context|safe}}/1/plot/html/line/'+key+'?draw-all' })
}else{
console.log(x.status)
}

@ -0,0 +1,52 @@
<link href="{{context}}/static/css/default.css" rel="stylesheet">
<link href="{{context}}/static/css/fa/css/font-awesome.css" rel="stylesheet" type="text/css">
<link href="{{context}}/static/css/fa/font-awesome-animation.css" rel="stylesheet" type="text/css">
<script src="{{context}}/static/js/jquery/jquery.min.js"></script>
<script src="{{context}}/static/js/jx/rpc.js"></script>
<script>
var Proceed = function(){
try{
p = urlparser(window.location.search)
var url=([window.location.protocol,"//",window.location.hostname,"{{context|safe}}/"+p.state+"/set/authentication"]).join("")
var httpclient = HttpClient.instance()
httpclient.setHeader('code',encodeURIComponent(p.code))
httpclient.setHeader('pid','authentication')
httpclient.setHeader('platform','web')
httpclient.post(url,function(x){
window.close()
})
}catch(error){
window.close()
}
}
</script>
<body>
<div align="center" style="height:100%;width:80%; display:flex; align-items:center; width:auto; justify-content:center">
<div style="display:grid; grid-template-columns:35% auto; ">
<div style="display:flex; align-items:center; ">
<span class="fa-stack fa-3x">
<i class="fa fa-times fa-stack-2x" style="color:maroon"></i>
<i class="fa fa-cog fa-stack-1x fa-inverse fa-spin" style="color:#d3d3d3"></i>
</span>
</div>
<div style="display:flex; align-items:center;">
<div>
<div class="" style="font-family:verdana; font-size:18px; ffont-weight:bold; text-transform:capitalize">{{caption}}</div>
<div class="small" style="font-size:12px; margin:4px">{{msg}}</div>
</div>
</div>
<div class="small" align="center" style="font-family:verdana; font-size:10px; border-top:1px solid #CAD5E0; padding-top:10px; margin-top:10px; grid-column:1 / span 2">the-phi.com</div>
</div>
</div>
</body>
Loading…
Cancel
Save