Commit b640ae3d by Őry Máté

dashboard: show owner in place of hostname if it's not me

closes #268
parent a4a15f95
...@@ -234,6 +234,7 @@ $(function () { ...@@ -234,6 +234,7 @@ $(function () {
'host': result[i].host, 'host': result[i].host,
'icon': result[i].icon, 'icon': result[i].icon,
'status': result[i].status, 'status': result[i].status,
'owner': result[i].owner,
}); });
} }
}); });
...@@ -251,7 +252,7 @@ $(function () { ...@@ -251,7 +252,7 @@ $(function () {
search_result.sort(compareVmByFav); search_result.sort(compareVmByFav);
for(var i=0; i<5 && i<search_result.length; i++) for(var i=0; i<5 && i<search_result.length; i++)
html += generateVmHTML(search_result[i].pk, search_result[i].name, html += generateVmHTML(search_result[i].pk, search_result[i].name,
search_result[i].host, search_result[i].icon, search_result[i].owner ? search_result[i].owner : search_result[i].host, search_result[i].icon,
search_result[i].status, search_result[i].fav, search_result[i].status, search_result[i].fav,
(search_result.length < 5)); (search_result.length < 5));
if(search_result.length == 0) if(search_result.length == 0)
......
...@@ -25,7 +25,10 @@ ...@@ -25,7 +25,10 @@
<i class="fa {{ i.get_status_icon }}" title="{{ i.get_status_display }}"></i> <i class="fa {{ i.get_status_icon }}" title="{{ i.get_status_display }}"></i>
{{ i.name }} {{ i.name }}
</span> </span>
<small class="text-muted"> {{ i.short_hostname }}</small> <small class="text-muted">
{% if i.owner == request.user %}{{ i.short_hostname }}
{% else %}{{i.owner.profile.get_display_name}}{% endif %}
</small>
<div class="pull-right dashboard-vm-favourite" data-vm="{{ i.pk }}"> <div class="pull-right dashboard-vm-favourite" data-vm="{{ i.pk }}">
{% if i.fav %} {% if i.fav %}
<i class="fa fa-star text-primary title-favourite" title="{% trans "Unfavourite" %}"></i> <i class="fa fa-star text-primary title-favourite" title="{% trans "Unfavourite" %}"></i>
......
...@@ -1890,6 +1890,8 @@ class VmList(LoginRequiredMixin, FilterMixin, ListView): ...@@ -1890,6 +1890,8 @@ class VmList(LoginRequiredMixin, FilterMixin, ListView):
'icon': i.get_status_icon(), 'icon': i.get_status_icon(),
'host': i.short_hostname, 'host': i.short_hostname,
'status': i.get_status_display(), 'status': i.get_status_display(),
'owner': (i.owner.profile.get_display_name()
if i.owner != self.request.user else None),
'fav': i.pk in favs, 'fav': i.pk in favs,
} for i in instances] } for i in instances]
return HttpResponse( return HttpResponse(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment