Merge pull request #65 from FirmlyReality/display_vnode_owner

Display owner of container on Node list page.
This commit is contained in:
Yujian Zhu 2016-04-23 16:38:55 +08:00
commit f5c71e6d0f
3 changed files with 15 additions and 5 deletions

View File

@ -344,6 +344,11 @@ class DockletHttpHandler(http.server.BaseHTTPRequestHandler):
res['mem_use'] = fetcher.get_mem_use(cmds[2])
elif cmds[3] == 'basic_info':
res['basic_info'] = fetcher.get_basic_info(cmds[2])
elif cmds[3] == 'owner':
names = cmds[2].split('-')
res['owner'] = names[0]
else:
res = "Unspported Method!"
self.response(200, {'success':'true', 'monitor':res})
elif cmds[1] == 'user':
if cmds[2] == 'quotainfo':

View File

@ -35,14 +35,15 @@
<table class="table table-bordered">
<thead>
<tr>
<th>NO</th>
<th>Name</th>
<th>NO</th>
<th>Name</th>
<th>Owner</th>
<th>State</th>
<th>PID</th>
<th>IP Address</th>
<th>Cpu used</th>
<th>Mem used</th>
<th>Summary</th>
<th>Cpu used</th>
<th>Mem used</th>
<th>Summary</th>
</tr>
</thead>
<tbody>
@ -50,6 +51,7 @@
<tr>
<td>{{ loop.index }}</td>
<td>{{ container['Name'] }}</td>
<td id='{{ loop.index }}_owner'>{{ container['owner'] }}</td>
{% if container['State'] == 'STOPPED' %}
<td><div id='{{ loop.index }}_state' class="label label-danger">Stopped</div></td>
<td id='{{ loop.index }}_pid'>--</td>

View File

@ -77,6 +77,9 @@ class hostsConAllView(normalView):
for container in containers:
result = dockletRequest.post('/monitor/vnodes/%s/basic_info'%(container), data)
basic_info = result.get('monitor').get('basic_info')
result = dockletRequest.post('/monitor/vnodes/%s/owner'%(container), data)
owner = result.get('monitor').get('owner')
basic_info['owner'] = owner
containerslist.append(basic_info)
return self.render(self.template_path, containerslist = containerslist, com_ip = self.com_ip, user = session['username'])