diff --git a/instances/templates/instances.html b/instances/templates/instances.html index df08f66..05e97f5 100644 --- a/instances/templates/instances.html +++ b/instances/templates/instances.html @@ -39,8 +39,8 @@
Name | -Host | +Name Description |
+ Host User |
Status | VCPU | Memory | @@ -52,7 +52,7 @@ {% for vm, info in inst.items %}
---|---|---|---|---|---|---|
{{ vm }} {{ info.title }} |
- {{ host.1 }} | +{{ host.1 }} {% if info.userinstances.count > 0 %}{{ info.userinstances.first_user.user.username }}{% if info.userinstances.count > 1 %} (+{{ info.userinstances.count|add:"-1" }}){% endif %}{% endif %} |
{% ifequal info.status 1 %} {% trans "Active" %} {% endifequal %} diff --git a/instances/views.py b/instances/views.py index 4b00ec9..19dc7dc 100644 --- a/instances/views.py +++ b/instances/views.py @@ -45,6 +45,16 @@ def instances(request): all_user_vms = {} computes = Compute.objects.all() + def get_userinstances_info(instance): + info = {} + uis = UserInstance.objects.filter(instance=instance) + info['count'] = len(uis) + if len(uis) > 0: + info['first_user'] = uis[0] + else: + info['first_user'] = None + return info + if not request.user.is_superuser: user_instances = UserInstance.objects.filter(user_id=request.user.id) for usr_inst in user_instances: @@ -69,6 +79,7 @@ def instances(request): if check_uuid.uuid != info['uuid']: check_uuid.save() all_host_vms[comp.id, comp.name][vm]['is_template'] = check_uuid.is_template + all_host_vms[comp.id, comp.name][vm]['userinstances'] = get_userinstances_info(check_uuid) except Instance.DoesNotExist: check_uuid = Instance(compute_id=comp.id, name=vm, uuid=info['uuid']) check_uuid.save() diff --git a/static/css/webvirtcloud.css b/static/css/webvirtcloud.css index d7382f1..542e8b9 100644 --- a/static/css/webvirtcloud.css +++ b/static/css/webvirtcloud.css @@ -12,7 +12,7 @@ body { } .container { - max-width: 768px; + max-width: 900px; } .page-header { @@ -132,4 +132,4 @@ p { .keyselect { display: inline; min-width: 250px; -} \ No newline at end of file +} |