Add truename on Node list page.

This commit is contained in:
zhuyj17 2016-04-25 01:00:06 +08:00
parent 4b634e6eb1
commit fb2148833b
4 changed files with 13 additions and 5 deletions

View File

@ -348,7 +348,13 @@ class DockletHttpHandler(http.server.BaseHTTPRequestHandler):
res['basic_info'] = fetcher.get_basic_info(cmds[2])
elif cmds[3] == 'owner':
names = cmds[2].split('-')
res['owner'] = names[0]
result = G_usermgr.query(username = names[0], cur_user = cur_user)
if result['success'] == 'false':
res['username'] = ""
res['truename'] = ""
else:
res['username'] = result['data']['username']
res['truename'] = result['data']['truename']
else:
res = "Unspported Method!"
self.response(200, {'success':'true', 'monitor':res})

View File

@ -38,6 +38,7 @@
<th>NO</th>
<th>Name</th>
<th>Owner</th>
<th>Owner's Truename</th>
<th>State</th>
<th>PID</th>
<th>IP Address</th>
@ -51,7 +52,8 @@
<tr>
<td>{{ loop.index }}</td>
<td>{{ container['Name'] }}</td>
<td id='{{ loop.index }}_owner'>{{ container['owner'] }}</td>
<td>{{ container['owner']['username'] }}</td>
<td>{{ container['owner']['truename'] }}</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

@ -275,11 +275,11 @@ def monitor_request(comid,infotype):
result = dockletRequest.post(request.path, data)
return json.dumps(result)
@app.route("/monitor/User/", methods=['GET'])
'''@app.route("/monitor/User/", methods=['GET'])
@administration_required
def monitorUserAll():
return monitorUserAllView.as_view()
'''

View File

@ -78,7 +78,7 @@ class hostsConAllView(normalView):
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')
owner = result.get('monitor')
basic_info['owner'] = owner
containerslist.append(basic_info)
return self.render(self.template_path, containerslist = containerslist, com_ip = self.com_ip, user = session['username'])