Merge pull request #263 from zhongyehong/master
change the format of url, place the masterip on the second field
This commit is contained in:
commit
1afa2b5fa7
|
@ -173,12 +173,12 @@ function plot_graph(container,url,processData,getY) {
|
|||
var host = window.location.host;
|
||||
|
||||
var node_name = $("#node_name").html();
|
||||
var url = "http://" + host + "/monitor/vnodes/" + node_name;
|
||||
var masterip = $("#masterip").html();
|
||||
var url = "http://" + host + "/monitor/" + masterip + "/vnodes/" + node_name;
|
||||
|
||||
function processDiskData()
|
||||
{
|
||||
$.post(url+"/disk_use/"+masterip+"/",{},function(data){
|
||||
$.post(url+"/disk_use/",{},function(data){
|
||||
var diskuse = data.monitor.disk_use;
|
||||
var usedp = diskuse.percent;
|
||||
var total = diskuse.total/1024.0/1024.0;
|
||||
|
@ -191,7 +191,7 @@ setInterval(processDiskData,1000);
|
|||
|
||||
function processBasicInfo()
|
||||
{
|
||||
$.post(url+"/basic_info/"+masterip+"/",{},function(data){
|
||||
$.post(url+"/basic_info/",{},function(data){
|
||||
basic_info = data.monitor.basic_info;
|
||||
state = basic_info.State;
|
||||
if(state == 'STOPPED')
|
||||
|
@ -216,5 +216,5 @@ function processBasicInfo()
|
|||
},"json");
|
||||
}
|
||||
setInterval(processBasicInfo,1000);
|
||||
plot_graph($("#mem-chart"),url + "/mem_use/"+masterip+"/",processMemData,getMemY);
|
||||
plot_graph($("#cpu-chart"),url + "/cpu_use/"+masterip+"/",processCpuData,getCpuY);
|
||||
plot_graph($("#mem-chart"),url + "/mem_use/",processMemData,getMemY);
|
||||
plot_graph($("#cpu-chart"),url + "/cpu_use/",processCpuData,getCpuY);
|
||||
|
|
|
@ -210,12 +210,12 @@ function plot_graph(container,url,processData,getY) {
|
|||
var host = window.location.host;
|
||||
|
||||
var com_ip = $("#com_ip").html();
|
||||
var url = "http://" + host + "/monitor/hosts/"+com_ip;
|
||||
var masterip = $("#masterip").html();
|
||||
var url = "http://" + host + "/monitor/" + masterip + "/hosts/"+com_ip;
|
||||
|
||||
function processStatus()
|
||||
{
|
||||
$.post(url+"/status/"+masterip+"/",{},function(data){
|
||||
$.post(url+"/status/",{},function(data){
|
||||
var state = data.monitor.status;
|
||||
if(state == 'RUNNING')
|
||||
is_running = true;
|
||||
|
@ -225,8 +225,8 @@ function processStatus()
|
|||
}
|
||||
setInterval(processStatus,1000);
|
||||
|
||||
plot_graph($("#mem-chart"), url + "/meminfo/" + masterip + "/",processMemData,getMemY);
|
||||
plot_graph($("#cpu-chart"), url + "/cpuinfo/" + masterip + "/",processCpuData,getCpuY);
|
||||
plot_graph($("#mem-chart"), url + "/meminfo/" ,processMemData,getMemY);
|
||||
plot_graph($("#cpu-chart"), url + "/cpuinfo/",processCpuData,getCpuY);
|
||||
//plot_graph($("#disk-chart"), url + "/diskinfo",processDiskData,getDiskY);
|
||||
$.post(url+"/diskinfo/"+masterip+"/",{},processDiskData,"json");
|
||||
$.post(url+"/diskinfo/",{},processDiskData,"json");
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
<form id="form" class="form-horizontal" action="/workspace/add/{{masterips[0].split("@")[0]}}/" method="POST">
|
||||
<form id="form" class="form-horizontal" action="/workspace/{{masterips[0].split("@")[0]}}/add/" method="POST">
|
||||
|
||||
<div class="form-group"><label class="col-sm-2 control-label">Workspace Name</label>
|
||||
<div class="col-sm-10"><input type="text" class="form-control" name="clusterName" id="clusterName"></div>
|
||||
|
@ -81,7 +81,7 @@
|
|||
<td>{{image['name']}}</td>
|
||||
<td>private</td>
|
||||
<td>{{user}}</td>
|
||||
<td><a href="/image/description/{{image['name']}}_{{user}}_private/{{masterips[0].split("@")[1]}}/" target="_blank">{{image['description']}}</a></td>
|
||||
<td><a href="/image/{{masterips[0].split("@")[1]}}/description/{{image['name']}}_{{user}}_private/" target="_blank">{{image['description']}}</a></td>
|
||||
<td><div class="i-checks"><label><input type="radio" name="image" value="{{image['name']}}_{{user}}_private"></label></div></td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
@ -91,7 +91,7 @@
|
|||
<td>{{image['name']}}</td>
|
||||
<td>public</td>
|
||||
<td>{{p_user}}</td>
|
||||
<td><a href="/image/description/{{image['name']}}_{{p_user}}_public/{{masterips[0].split("@")[1]}}/" target="_blank">{{image['description']}}</a></td>
|
||||
<td><a href="/image/{{masterips[0].split("@")[1]}}/description/{{image['name']}}_{{p_user}}_public/" target="_blank">{{image['description']}}</a></td>
|
||||
<td><div class="i-checks"><label><input type="radio" name="image" value="{{image['name']}}_{{p_user}}_public"></label></div></td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
@ -173,12 +173,12 @@
|
|||
var masterip=$(this).children('option:selected').val();
|
||||
var mastername=$(this).children('option:selected').html();
|
||||
console.log(masterip);
|
||||
document.getElementById("form").action="/workspace/add/"+masterip+"/";
|
||||
document.getElementById("form").action="/workspace/"+masterip+"/add/";
|
||||
var host = window.location.host;
|
||||
$.post("http://"+host+"/getmasterdesc/"+mastername+"/", {}, function(data) {
|
||||
$("#masterdesc").html(data);
|
||||
});
|
||||
$.post("http://"+host+"/image/list/"+masterip+"/",{},function(data){
|
||||
$.post("http://"+host+"/image/"+masterip+"/list/",{},function(data){
|
||||
var images = data.images;
|
||||
var imagehtml =
|
||||
"<thread>"
|
||||
|
@ -205,7 +205,7 @@
|
|||
+"<td>"+image.name+"</td>"
|
||||
+"<td>private</td>"
|
||||
+"<td>{{user}}</td>"
|
||||
+'<td><a href="/image/description/' + image.name + "_{{user}}_private/" + masterip + '/" target="_blank">' + image.description + '</a></td>'
|
||||
+'<td><a href="/image/' + masterip + '/description/' + image.name + '_' + {{user}} + '_private/" target="_blank">' + image.description + '</a></td>'
|
||||
+'<td><div class="i-checks"><label><input type="radio" name="image" value="' + image.name + '_{{user}}_private"><label></div></td>'
|
||||
+"</tr>";
|
||||
}
|
||||
|
@ -217,7 +217,7 @@
|
|||
+"<td>"+image.name+"</td>"
|
||||
+"<td>public</td>"
|
||||
+"<td>" + p_user + "</td>"
|
||||
+'<td><a href="/image/description/' + image.name + "_" + p_user + "_ublic/" + masterip + '/" target="_blank">' + image.description + '</a></td>'
|
||||
+'<td><a href="/image/' + masterip + '/description/' + image.name + "_" + p_user + '_public/" target="_blank">' + image.description + '</a></td>'
|
||||
+'<td><div class="i-checks"><label><input type="radio" name="image" value="' + image.name + "_" + p_user + '_public"><label></div></td>';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -73,7 +73,7 @@
|
|||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="form-group">
|
||||
<form action="/workspace/scaleout/{{ clustername }}/{{master.split("@")[0]}}/" method="POST" >
|
||||
<form action="/workspace/{{master.split("@")[0]}}/scaleout/{{ clustername }}/" method="POST" >
|
||||
<table class="table table-striped table-bordered table-hover table-image">
|
||||
<thead>
|
||||
<tr>
|
||||
|
@ -181,7 +181,7 @@
|
|||
{% if container['containername'][-2:] == '-0' %}
|
||||
<td><button class="btn btn-xs btn-default">Delete</button></td>
|
||||
{% else %}
|
||||
<td><a class="btn btn-xs btn-danger" href="/workspace/scalein/{{ clustername }}/{{ container['containername'] }}/{{master.split("@")[0]}}/">Delete</a></td>
|
||||
<td><a class="btn btn-xs btn-danger" href="/workspace/{{master.split("@")[0]}}/scalein/{{ clustername }}/{{ container['containername'] }}/">Delete</a></td>
|
||||
{% endif %}
|
||||
<div class="modal inmodal" id="DelModal_{{ container['containername'] }}_{{master.split("@")[1]}}" tabindex="-1" role="dialog" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
|
@ -194,7 +194,7 @@
|
|||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="form-group">
|
||||
<form action="/workspace/save/{{ clustername }}/{{ container['containername'] }}/{{master.split("@")[0]}}/" method="POST" id="saveImage">
|
||||
<form action="/workspace/{{master.split("@")[0]}}/save/{{ clustername }}/{{ container['containername'] }}/" method="POST" id="saveImage">
|
||||
<label>Image Name</label>
|
||||
<input type="text" placeholder="Enter Image Name" class="form-control" name="ImageName" id="ImageName"/>
|
||||
<br/>
|
||||
|
@ -235,11 +235,11 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
<form action="/addproxy/{{ clustername }}/{{master.split("@")[0]}}/" id="addproxy" method="POST">
|
||||
<form action="/addproxy/{{master.split("@")[0]}}/{{ clustername }}/" id="addproxy" method="POST">
|
||||
{% if 'proxy_ip' in clusterinfo %}
|
||||
<p>ip:<input type="text" id="proxy_ip" name="proxy_ip" value={{ clusterinfo['proxy_ip'][:clusterinfo['proxy_ip'].index(':')] }} readonly="true"/>port:<input type="text" id="proxy_port" name="proxy_port" value={{ clusterinfo['proxy_ip'][clusterinfo['proxy_ip'].index(':')+1:] }} readonly="true"/>
|
||||
<button type="button" class="btn-xs btn-default">enable</button>
|
||||
<a href="/deleteproxy/{{ clustername }}/{{master.split("@")[0]}}"><button type="button" class="btn-xs btn-danger">disable</button></a></p>
|
||||
<a href="/deleteproxy/{{master.split("@")[0]}}/{{ clustername }}/"><button type="button" class="btn-xs btn-danger">disable</button></a></p>
|
||||
{% else %}
|
||||
<p>ip:<input type="text" id="proxy_ip" name="proxy_ip" value={{ clusterinfo["containers"][0]["ip"][:clusterinfo["containers"][0]["ip"].index("/")] }} />port:<input type="text" id="proxy_port" name="proxy_port" value="80"/>
|
||||
<button type="submit" class="btn-xs btn-success">enable</button>
|
||||
|
@ -300,19 +300,19 @@
|
|||
<td>private</td>
|
||||
<td>{{mysession['username']}}</td>
|
||||
<td>{{image['time']}}</td>
|
||||
<td><a href="/image/description/{{image['name']}}_{{mysession['username']}}_private/{{master.split("@")[0]}}/" target="_blank">{{image['description']}}</a></td>
|
||||
<td><a href="/image/{{master.split("@")[0]}}/description/{{image['name']}}_{{mysession['username']}}_private/" target="_blank">{{image['description']}}</a></td>
|
||||
<td>{{master.split("@")[1]}}</td>
|
||||
{% if image['isshared'] == 'false' %}
|
||||
<td>unshared</td>
|
||||
<td>
|
||||
<a href="/image/share/{{ image['name'] }}/{{master.split("@")[0]}}/"><button type="button" class="btn btn-xs btn-success">share</button></a>
|
||||
<a href="/image/delete/{{ image['name'] }}/{{master.split("@")[0]}}/"><button type="button" class="btn btn-xs btn-danger">delete</button></a>
|
||||
<a href="/image/{{master.split("@")[0]}}/share/{{ image['name'] }}/"><button type="button" class="btn btn-xs btn-success">share</button></a>
|
||||
<a href="/image/{{master.split("@")[0]}}/delete/{{ image['name'] }}/"><button type="button" class="btn btn-xs btn-danger">delete</button></a>
|
||||
</td>
|
||||
{% else %}
|
||||
<td>shared</td>
|
||||
<td>
|
||||
<a href="/image/unshare/{{ image['name'] }}/{{master.split("@")[0]}}/"><button type="button" class="btn btn-xs btn-warning">unshare</button></a>
|
||||
<a href="/image/delete/{{ image['name'] }}/{{master.split("@")[0]}}/"><button type="button" class="btn btn-xs btn-danger">delete</button></a>
|
||||
<a href="/image/{{master.split("@")[0]}}/unshare/{{ image['name'] }}/"><button type="button" class="btn btn-xs btn-warning">unshare</button></a>
|
||||
<a href="/image/{{master.split("@")[0]}}/delete/{{ image['name'] }}/"><button type="button" class="btn btn-xs btn-danger">delete</button></a>
|
||||
</td>
|
||||
{% endif %}
|
||||
</tr>
|
||||
|
@ -324,11 +324,11 @@
|
|||
<td>public</td>
|
||||
<td>{{p_user}}</td>
|
||||
<td>{{image['time']}}</td>
|
||||
<td><a href="/image/description/{{image['name']}}_{{p_user}}_public/{{master.split("@")[0]}}/" target="_blank">{{image['description']}}</a></td>
|
||||
<td><a href="/image/{{master.split("@")[0]}}/description/{{image['name']}}_{{p_user}}_public/" target="_blank">{{image['description']}}</a></td>
|
||||
<td>{{master.split("@")[1]}}</td>
|
||||
<td></td>
|
||||
{% if p_user == mysession['username'] %}
|
||||
<td><a href="/image/unshare/{{ image['name'] }}/{{master.split("@")[0]}}/"><button type="button" class="btn btn-xs btn-warning">unshare</button></a></td>
|
||||
<td><a href="/image/{{master.split("@")[0]}}/unshare/{{ image['name'] }}/"><button type="button" class="btn btn-xs btn-warning">unshare</button></a></td>
|
||||
{% else %}
|
||||
<td></td>
|
||||
{% endif %}
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
{% if cluster['status'] == 'running' %}
|
||||
<td><a href="/vclusters/"><div class="text-success"><i class="fa fa-play"></i> Running</div></a></td>
|
||||
<td>
|
||||
<a href="/workspace/stop/{{ cluster['name'] }}/{{master.split("@")[0]}}/"><button type="button" class="btn btn-xs btn-warning"> Stop </button></a>
|
||||
<a href="/workspace/{{master.split("@")[0]}}/stop/{{ cluster['name'] }}/"><button type="button" class="btn btn-xs btn-warning"> Stop </button></a>
|
||||
<button type="button" class="btn btn-xs btn-default"> Delete </button>
|
||||
</td>
|
||||
<td>
|
||||
|
@ -60,8 +60,8 @@
|
|||
{% else %}
|
||||
<td><a href="/vclusters/"><div class="text-warning"><i class="fa fa-stop "></i> Stopped</div></a></td>
|
||||
<td>
|
||||
<a href="/workspace/start/{{ cluster['name'] }}/{{master.split("@")[0]}}/"><button type="button" class="btn btn-xs btn-success"> Start </button></a>
|
||||
<a href="/workspace/delete/{{ cluster['name'] }}/{{master.split("@")[0]}}/"><button type="button" class="btn btn-xs btn-danger">Delete</button></a>
|
||||
<a href="/workspace/{{master.split("@")[0]}}/start/{{ cluster['name'] }}/"><button type="button" class="btn btn-xs btn-success"> Start </button></a>
|
||||
<a href="/workspace/{{master.split("@")[0]}}/delete/{{ cluster['name'] }}/"><button type="button" class="btn btn-xs btn-danger">Delete</button></a>
|
||||
</td>
|
||||
<td>
|
||||
<button type="button" class="btn btn-xs btn-default"> Go </button>
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
<th>{{ vnode.name }}</th>
|
||||
<th>{{ vnode.billing }} beans</th>
|
||||
<th>{{ master.split("@")[1] }}</th>
|
||||
<td><a class="btn btn-info btn-xs" href='/history/{{ vnode.name }}/{{master.split("@")[0]}}/'>History</a></td>
|
||||
<td><a class="btn btn-info btn-xs" href='/history/{{master.split("@")[0]}}/{{ vnode.name }}/'>History</a></td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
|
|
|
@ -74,12 +74,12 @@
|
|||
{% endif %}
|
||||
<td>
|
||||
<label id='{{master.split("@")[1]}}_{{ loop.index }}_conrunning'>{{ phym['containers']['running'] }}</label> /
|
||||
<a href='/hosts/{{ phym['ip'] }}/containers/{{master.split("@")[0]}}/' id='{{master.split("@")[1]}}_{{ loop.index }}_contotal' >{{ phym['containers']['total'] }}</a>
|
||||
<a href='/hosts/{{master.split("@")[0]}}/{{ phym['ip'] }}/containers/' id='{{master.split("@")[1]}}_{{ loop.index }}_contotal' >{{ phym['containers']['total'] }}</a>
|
||||
</td>
|
||||
<td id='{{master.split("@")[1]}}_{{ loop.index }}_cpu'>--</td>
|
||||
<td id='{{master.split("@")[1]}}_{{ loop.index }}_mem'>--</td>
|
||||
<td id='{{master.split("@")[1]}}_{{ loop.index }}_disk'>--</td>
|
||||
<td><a class="btn btn-info btn-xs" href='/hosts/{{ phym['ip'] }}/{{master.split("@")[0]}}/'>Realtime</a></td>
|
||||
<td><a class="btn btn-info btn-xs" href='/hosts/{{master.split("@")[0]}}/{{ phym['ip'] }}/'>Realtime</a></td>
|
||||
<td><button class="btn btn-xs btn-default">Delete</button></td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
@ -96,11 +96,11 @@
|
|||
|
||||
{% block script_src %}
|
||||
<script type='text/javascript'>
|
||||
function update(url,masterip,index)
|
||||
function update(url,index)
|
||||
{
|
||||
|
||||
var MB = 1024;
|
||||
$.post(url+"/status/"+masterip+"/",{},function(data){
|
||||
$.post(url+"/status/",{},function(data){
|
||||
console.log(data);
|
||||
var status = data.monitor.status;
|
||||
if(status == 'RUNNING')
|
||||
|
@ -118,7 +118,7 @@
|
|||
tmp.html("Stopped");
|
||||
}
|
||||
|
||||
$.post(url+"/containers/"+masterip+"/",{},function(data){
|
||||
$.post(url+"/containers/",{},function(data){
|
||||
var containers = data.monitor.containers;
|
||||
$("#"+index+"_contotal").html(containers.total);
|
||||
$("#"+index+"_conrunning").html(containers.running);
|
||||
|
@ -132,20 +132,20 @@
|
|||
return;
|
||||
}
|
||||
|
||||
$.post(url+"/cpuinfo/"+masterip+"/",{},function(data){
|
||||
$.post(url+"/cpuinfo/",{},function(data){
|
||||
var idle = data.monitor.cpuinfo.idle;
|
||||
var usedp = (100 - idle).toFixed(2);
|
||||
$("#"+index+"_cpu").html(String(usedp)+"%");
|
||||
},"json");
|
||||
|
||||
$.post(url+"/meminfo/"+masterip+"/",{},function(data){
|
||||
$.post(url+"/meminfo/",{},function(data){
|
||||
var used = data.monitor.meminfo.used;
|
||||
var total = data.monitor.meminfo.total;
|
||||
var usedp = String(((used/total)*100).toFixed(2))+"%";
|
||||
$("#"+index+"_mem").html(usedp);
|
||||
},"json");
|
||||
|
||||
$.post(url+"/diskinfo/"+masterip+"/",{},function(data){
|
||||
$.post(url+"/diskinfo/",{},function(data){
|
||||
var val = data.monitor.diskinfo;
|
||||
var usedp = val[0].percent;
|
||||
$("#"+index+"_disk").html(String(usedp)+"%");
|
||||
|
@ -156,11 +156,12 @@
|
|||
function updateAll()
|
||||
{
|
||||
var host = window.location.host;
|
||||
var url0 = "http://" + host + "/monitor/hosts/";
|
||||
// var url0 = "http://" + host + "/monitor/hosts/";
|
||||
{% for master in allmachines %}
|
||||
{% for phym in allmachines[master] %}
|
||||
url = url0 + '{{ phym['ip'] }}';
|
||||
update(url,'{{master.split("@")[0]}}','{{master.split("@")[1]}}_{{ loop.index }}');
|
||||
url = "http://" + host + "/monitor/" + '{{master.split("@")[0]}}' + "/hosts/" + '{{phym["ip"]}}';
|
||||
// url = url0 + '{{ phym['ip'] }}';
|
||||
update(url,'{{master.split("@")[1]}}_{{ loop.index }}');
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
}
|
||||
|
|
|
@ -84,10 +84,10 @@
|
|||
|
||||
{% block script_src %}
|
||||
<script type='text/javascript'>
|
||||
function update(url,masterip,name)
|
||||
function update(url,name)
|
||||
{
|
||||
|
||||
$.post(url+"/basic_info/"+masterip+"/",{},function(data){
|
||||
$.post(url+"/basic_info/",{},function(data){
|
||||
var state = data.monitor.basic_info.State;
|
||||
if(state == 'RUNNING')
|
||||
{
|
||||
|
@ -111,7 +111,7 @@
|
|||
return;
|
||||
}
|
||||
|
||||
$.post(url+"/cpu_use/"+masterip+"/",{},function(data){
|
||||
$.post(url+"/cpu_use/",{},function(data){
|
||||
var val = (data.monitor.cpu_use.val).toFixed(2);
|
||||
var unit = data.monitor.cpu_use.unit;
|
||||
var hostpercent = data.monitor.cpu_use.hostpercent;
|
||||
|
@ -121,7 +121,7 @@
|
|||
},"json");
|
||||
|
||||
|
||||
$.post(url+"/mem_use/"+masterip+"/",{},function(data){
|
||||
$.post(url+"/mem_use/",{},function(data){
|
||||
var val = data.monitor.mem_use.val;
|
||||
var unit = data.monitor.mem_use.unit
|
||||
$("#"+name+"_mem").html(val+" "+unit);
|
||||
|
@ -133,13 +133,13 @@
|
|||
function updateAll()
|
||||
{
|
||||
var host = window.location.host;
|
||||
var url0 = "http://" + host + "/monitor/vnodes/";
|
||||
// var url0 = "http://" + host + "/monitor/vnodes/";
|
||||
|
||||
{% for container in containerslist %}
|
||||
url = url0 + '{{ container['Name'] }}';
|
||||
update(url,'{{masterip}}','{{ container['Name'] }}');
|
||||
url = "http://" + host + "/monitor/" + '{{masterip}}' + "/vnodes/" + '{{container["Name"]}}';
|
||||
//url = url0 + '{{ container['Name'] }}';
|
||||
update(url,'{{ container['Name'] }}');
|
||||
{% endfor %}
|
||||
url = "http://" + host + "/monitor/hosts/" + "{{ com_ip }}";
|
||||
/*$.post(url+"/concpuinfo/",{},function(data){
|
||||
var info = data.monitor.concpuinfo;
|
||||
for(container in info)
|
||||
|
|
|
@ -110,7 +110,7 @@
|
|||
<td id='{{master.split("@")[1]}}_{{clustername}}_{{ loop.index }}_disk'>--</td>
|
||||
<td id='{{master.split("@")[1]}}_{{clustername}}_{{ loop.index }}_billing'>--</td>
|
||||
<td id='{{master.split("@")[1]}}_{{clustername}}_{{ loop.index }}_billingthishour'>--</td>
|
||||
<td><a class="btn btn-info btn-xs" href='/vclusters/{{ clustername }}/{{ container['containername'] }}/{{master.split("@")[0]}}/'>Realtime</a></td>
|
||||
<td><a class="btn btn-info btn-xs" href='/vclusters/{{master.split("@")[0]}}/{{ clustername }}/{{ container['containername'] }}/'>Realtime</a></td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
|
@ -127,12 +127,12 @@
|
|||
|
||||
{% block script_src %}
|
||||
<script type='text/javascript'>
|
||||
function update(url,masterip,index)
|
||||
function update(url,index)
|
||||
{
|
||||
|
||||
$.post(url+"/basic_info/"+masterip+"/",{},function(data){
|
||||
$.post(url+"/basic_info/",{},function(data){
|
||||
|
||||
$.post(url+"/disk_use/"+masterip+"/",{},function(data){
|
||||
$.post(url+"/disk_use/",{},function(data){
|
||||
var diskuse = data.monitor.disk_use;
|
||||
var usedp = diskuse.percent;
|
||||
var total = diskuse.total/1024.0/1024.0;
|
||||
|
@ -172,7 +172,7 @@
|
|||
return;
|
||||
}
|
||||
|
||||
$.post(url+"/cpu_use/"+masterip+"/",{},function(data){
|
||||
$.post(url+"/cpu_use/",{},function(data){
|
||||
var usedp = data.monitor.cpu_use.usedp;
|
||||
var quota = data.monitor.cpu_use.quota.cpu;
|
||||
var quotaout = "("+quota;
|
||||
|
@ -183,7 +183,7 @@
|
|||
$("#"+index+"_cpu").html((usedp/0.01).toFixed(2)+"%<br/>"+quotaout);
|
||||
},"json");
|
||||
|
||||
$.post(url+"/mem_use/"+masterip+"/",{},function(data){
|
||||
$.post(url+"/mem_use/",{},function(data){
|
||||
var usedp = data.monitor.mem_use.usedp;
|
||||
var unit = data.monitor.mem_use.unit;
|
||||
var quota = data.monitor.mem_use.quota.memory/1024.0;
|
||||
|
@ -198,14 +198,14 @@
|
|||
function updateAll()
|
||||
{
|
||||
var host = window.location.host;
|
||||
var url0 = "http://" + host + "/monitor/vnodes/";
|
||||
var masterip;
|
||||
//var url0 = "http://" + host + "/monitor/vnodes/";
|
||||
|
||||
{% for master in allcontainers %}
|
||||
{% for clustername, clusterinfo in allcontainers[master].items() %}
|
||||
{% for container in clusterinfo['containers'] %}
|
||||
url = url0 + '{{ container['containername'] }}';
|
||||
update(url,'{{master.split("@")[0]}}','{{master.split("@")[1]}}_{{clustername}}_{{ loop.index }}');
|
||||
//url = url0 + '{{ container['containername'] }}';
|
||||
url = "http://" + host + "/monitor/" + '{{master.split("@")[0]}}' + "/vnodes/" + '{{container["containername"]}}' ;
|
||||
update(url,'{{master.split("@")[1]}}_{{clustername}}_{{ loop.index }}');
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
{% block content %}
|
||||
<div class="box-body text-center p-md">
|
||||
<form action="/workspace/save/{{ clustername }}/{{ containername }}/force/" method="POST">
|
||||
<form action="/workspace/{{masterip}}/save/{{ clustername }}/{{ containername }}/force/" method="POST">
|
||||
<label>Image:</label>
|
||||
<input type="text" name="ImageName" id="ImageName" readonly="true" value="{{ image }}"/>
|
||||
<label> exists, are you sure to overwrite it?</label>
|
||||
|
|
57
web/web.py
57
web/web.py
|
@ -125,13 +125,13 @@ def config():
|
|||
def addCluster():
|
||||
return addClusterView.as_view()
|
||||
|
||||
@app.route("/workspace/list/<masterip>/", methods=['GET'])
|
||||
@app.route("/workspace/<masterip>/list/", methods=['GET'])
|
||||
@login_required
|
||||
def listCluster(masterip):
|
||||
listClusterView.masterip = masterip
|
||||
return listClusterView.as_view()
|
||||
|
||||
@app.route("/workspace/add/<masterip>/", methods=['POST'])
|
||||
@app.route("/workspace/<masterip>/add/", methods=['POST'])
|
||||
@login_required
|
||||
def createCluster(masterip):
|
||||
createClusterView.clustername = request.form["clusterName"]
|
||||
|
@ -139,7 +139,7 @@ def createCluster(masterip):
|
|||
createClusterView.masterip = masterip
|
||||
return createClusterView.as_view()
|
||||
|
||||
@app.route("/workspace/scaleout/<clustername>/<masterip>/", methods=['POST'])
|
||||
@app.route("/workspace/<masterip>/scaleout/<clustername>/", methods=['POST'])
|
||||
@login_required
|
||||
def scaleout(clustername,masterip):
|
||||
scaleoutView.image = request.form["image"]
|
||||
|
@ -147,7 +147,7 @@ def scaleout(clustername,masterip):
|
|||
scaleoutView.clustername = clustername
|
||||
return scaleoutView.as_view()
|
||||
|
||||
@app.route("/workspace/scalein/<clustername>/<containername>/<masterip>/", methods=['GET'])
|
||||
@app.route("/workspace/<masterip>/scalein/<clustername>/<containername>/", methods=['GET'])
|
||||
@login_required
|
||||
def scalein(clustername,containername,masterip):
|
||||
scaleinView.clustername = clustername
|
||||
|
@ -155,42 +155,42 @@ def scalein(clustername,containername,masterip):
|
|||
scaleinView.masterip = masterip
|
||||
return scaleinView.as_view()
|
||||
|
||||
@app.route("/workspace/start/<clustername>/<masterip>/", methods=['GET'])
|
||||
@app.route("/workspace/<masterip>/start/<clustername>/", methods=['GET'])
|
||||
@login_required
|
||||
def startClustet(clustername,masterip):
|
||||
startClusterView.clustername = clustername
|
||||
startClusterView.masterip = masterip
|
||||
return startClusterView.as_view()
|
||||
|
||||
@app.route("/workspace/stop/<clustername>/<masterip>/", methods=['GET'])
|
||||
@app.route("/workspace/<masterip>/stop/<clustername>/", methods=['GET'])
|
||||
@login_required
|
||||
def stopClustet(clustername,masterip):
|
||||
stopClusterView.clustername = clustername
|
||||
stopClusterView.masterip = masterip
|
||||
return stopClusterView.as_view()
|
||||
|
||||
@app.route("/workspace/delete/<clustername>/<masterip>/", methods=['GET'])
|
||||
@app.route("/workspace/<masterip>/delete/<clustername>/", methods=['GET'])
|
||||
@login_required
|
||||
def deleteClustet(clustername,masterip):
|
||||
deleteClusterView.clustername = clustername
|
||||
deleteClusterView.masterip = masterip
|
||||
return deleteClusterView.as_view()
|
||||
|
||||
@app.route("/workspace/detail/<clustername>/<masterip>/", methods=['GET'])
|
||||
@app.route("/workspace/<masterip>/detail/<clustername>/", methods=['GET'])
|
||||
@login_required
|
||||
def detailCluster(clustername,masterip):
|
||||
detailClusterView.clustername = clustername
|
||||
detailClusterView.masterip = masterip
|
||||
return detailClusterView.as_view()
|
||||
|
||||
@app.route("/workspace/flush/<clustername>/<containername>/<masterip>", methods=['GET'])
|
||||
@app.route("/workspace/<masterip>/flush/<clustername>/<containername>/", methods=['GET'])
|
||||
@login_required
|
||||
def flushCluster(clustername,containername):
|
||||
flushClusterView.clustername = clustername
|
||||
flushClusterView.containername = containername
|
||||
return flushClusterView.as_view()
|
||||
|
||||
@app.route("/workspace/save/<clustername>/<containername>/<masterip>/", methods=['POST'])
|
||||
@app.route("/workspace/<masterip>/save/<clustername>/<containername>/", methods=['POST'])
|
||||
@login_required
|
||||
def saveImage(clustername,containername,masterip):
|
||||
saveImageView.clustername = clustername
|
||||
|
@ -201,7 +201,7 @@ def saveImage(clustername,containername,masterip):
|
|||
saveImageView.description = request.form['description']
|
||||
return saveImageView.as_view()
|
||||
|
||||
@app.route("/workspace/save/<clustername>/<containername>/force/<masterip>/", methods=['POST'])
|
||||
@app.route("/workspace/<masterip>/save/<clustername>/<containername>/force/", methods=['POST'])
|
||||
@login_required
|
||||
def saveImage_force(clustername,containername,masterip):
|
||||
saveImageView.clustername = clustername
|
||||
|
@ -212,7 +212,7 @@ def saveImage_force(clustername,containername,masterip):
|
|||
saveImageView.description = request.form['description']
|
||||
return saveImageView.as_view()
|
||||
|
||||
@app.route("/addproxy/<clustername>/<masterip>/", methods=['POST'])
|
||||
@app.route("/addproxy/<masterip>/<clustername>/", methods=['POST'])
|
||||
@login_required
|
||||
def addproxy(clustername,masterip):
|
||||
addproxyView.clustername = clustername
|
||||
|
@ -221,7 +221,7 @@ def addproxy(clustername,masterip):
|
|||
addproxyView.port = request.form['proxy_port']
|
||||
return addproxyView.as_view()
|
||||
|
||||
@app.route("/deleteproxy/<clustername>/<masterip>/", methods=['GET'])
|
||||
@app.route("/deleteproxy/<masterip>/<clustername>/", methods=['GET'])
|
||||
@login_required
|
||||
def deleteproxy(clustername,masterip):
|
||||
deleteproxyView.clustername = clustername
|
||||
|
@ -239,7 +239,7 @@ def masterdesc(mastername):
|
|||
descriptionMasterView.desc=env.getenv(mastername+"_desc")[1:-1]
|
||||
return descriptionMasterView.as_view()
|
||||
|
||||
@app.route("/image/list/<masterip>/", methods=['POST'])
|
||||
@app.route("/image/<masterip>/list/", methods=['POST'])
|
||||
@login_required
|
||||
def image_list(masterip):
|
||||
data = {
|
||||
|
@ -251,35 +251,35 @@ def image_list(masterip):
|
|||
logger.debug("image" + str(type(result)))
|
||||
return json.dumps(result)
|
||||
|
||||
@app.route("/image/description/<image>/<masterip>/", methods=['GET'])
|
||||
@app.route("/image/<masterip>/description/<image>/", methods=['GET'])
|
||||
@login_required
|
||||
def descriptionImage(image,masterip):
|
||||
descriptionImageView.image = image
|
||||
descriptionImageView.masterip = masterip
|
||||
return descriptionImageView.as_view()
|
||||
|
||||
@app.route("/image/share/<image>/<masterip>/", methods=['GET'])
|
||||
@app.route("/image/<masterip>/share/<image>/", methods=['GET'])
|
||||
@login_required
|
||||
def shareImage(image,masterip):
|
||||
shareImageView.image = image
|
||||
shareImageView.masterip = masterip
|
||||
return shareImageView.as_view()
|
||||
|
||||
@app.route("/image/unshare/<image>/<masterip>/", methods=['GET'])
|
||||
@app.route("/image/<masterip>/unshare/<image>/", methods=['GET'])
|
||||
@login_required
|
||||
def unshareImage(image,masterip):
|
||||
unshareImageView.image = image
|
||||
unshareImageView.masterip = masterip
|
||||
return unshareImageView.as_view()
|
||||
|
||||
@app.route("/image/delete/<image>/<masterip>/", methods=['GET'])
|
||||
@app.route("/image/<masterip>/delete/<image>/", methods=['GET'])
|
||||
@login_required
|
||||
def deleteImage(image,masterip):
|
||||
deleteImageView.image = image
|
||||
deleteImageView.masterip = masterip
|
||||
return deleteImageView.as_view()
|
||||
|
||||
@app.route("/image/updatebase/<image>/<masterip>/", methods=['GET'])
|
||||
@app.route("/image/<masterip>/updatebase/<image>/", methods=['GET'])
|
||||
@login_required
|
||||
def updatebaseImage(image,masterip):
|
||||
updatebaseImageView.image = image
|
||||
|
@ -291,14 +291,14 @@ def updatebaseImage(image,masterip):
|
|||
def hosts():
|
||||
return hostsView.as_view()
|
||||
|
||||
@app.route("/hosts/<com_ip>/<masterip>/", methods=['GET'])
|
||||
@app.route("/hosts/<masterip>/<com_ip>/", methods=['GET'])
|
||||
@administration_required
|
||||
def hostsRealtime(com_ip,masterip):
|
||||
hostsRealtimeView.com_ip = com_ip
|
||||
hostsRealtimeView.masterip = masterip
|
||||
return hostsRealtimeView.as_view()
|
||||
|
||||
@app.route("/hosts/<com_ip>/containers/<masterip>/", methods=['GET'])
|
||||
@app.route("/hosts/<masterip>/<com_ip>/containers/", methods=['GET'])
|
||||
@administration_required
|
||||
def hostsConAll(com_ip,masterip):
|
||||
hostsConAllView.com_ip = com_ip
|
||||
|
@ -310,7 +310,7 @@ def hostsConAll(com_ip,masterip):
|
|||
def status():
|
||||
return statusView.as_view()
|
||||
|
||||
@app.route("/vclusters/<vcluster_name>/<node_name>/<masterip>/", methods=['GET'])
|
||||
@app.route("/vclusters/<masterip>/<vcluster_name>/<node_name>/", methods=['GET'])
|
||||
@login_required
|
||||
def statusRealtime(vcluster_name,node_name,masterip):
|
||||
statusRealtimeView.masterip = masterip
|
||||
|
@ -323,24 +323,25 @@ def history():
|
|||
return historyView.as_view()
|
||||
|
||||
|
||||
@app.route("/history/<vnode_name>/<masterip>/", methods=['GET'])
|
||||
@app.route("/history/<masterip>/<vnode_name>/", methods=['GET'])
|
||||
@login_required
|
||||
def historyVNode(vnode_name,masterip):
|
||||
historyVNodeView.masterip = masterip
|
||||
historyVNodeView.vnode_name = vnode_name
|
||||
return historyVNodeView.as_view()
|
||||
|
||||
@app.route("/monitor/hosts/<comid>/<infotype>/<masterip>/", methods=['POST'])
|
||||
@app.route("/monitor/vnodes/<comid>/<infotype>/<masterip>/", methods=['POST'])
|
||||
@app.route("/monitor/<masterip>/hosts/<comid>/<infotype>/", methods=['POST'])
|
||||
@app.route("/monitor/<masterip>/vnodes/<comid>/<infotype>/", methods=['POST'])
|
||||
@login_required
|
||||
def monitor_request(comid,infotype,masterip):
|
||||
data = {
|
||||
"user": session['username']
|
||||
}
|
||||
path = request.path[:request.path.rfind("/")]
|
||||
path = path[:path.rfind("/")+1]
|
||||
path = request.path[request.path.find("/")+1:]
|
||||
path = path[path.find("/")+1:]
|
||||
path = path[path.find("/")+1:]
|
||||
logger.debug(path + "_____" + masterip)
|
||||
result = dockletRequest.post(path, data, masterip)
|
||||
result = dockletRequest.post("/monitor/"+path, data, masterip)
|
||||
logger.debug("monitor" + str(type(result)))
|
||||
return json.dumps(result)
|
||||
|
||||
|
|
|
@ -262,7 +262,7 @@ class saveImageView(normalView):
|
|||
#return res.as_view()
|
||||
else:
|
||||
if result.get('reason') == "exists":
|
||||
return self.render(self.template_path, containername = self.containername, clustername = self.clustername, image = self.imagename, user = session['username'], description = self.description)
|
||||
return self.render(self.template_path, containername = self.containername, clustername = self.clustername, image = self.imagename, user = session['username'], description = self.description, masterip=masterip)
|
||||
else:
|
||||
return self.render(self.error_path, message = result.get('message'))
|
||||
else:
|
||||
|
|
Loading…
Reference in New Issue