Commit 7a61fb2f by Kálmán Viktor

dashboard: remove static data from virtual machines box in index view

parent 216c7a1c
...@@ -38,15 +38,15 @@ ...@@ -38,15 +38,15 @@
</div> </div>
</div> </div>
<div class="panel-body" id="vm-graph-view" style="display: none"> <div class="panel-body" id="vm-graph-view" style="display: none">
<p class="pull-right"> <input class="knob" data-fgColor="chartreuse" data-thickness=".4" data-width="100" data-height="100" data-readOnly="true" value="22"></p> <p class="pull-right"> <input class="knob" data-fgColor="chartreuse" data-thickness=".4" data-max="10" data-width="100" data-height="100" data-readOnly="true" value="{{ instances|length|add:more_instances }}"></p>
<p><span class="bigbig"><big>13</big> running </span> <p><span class="bigbig"><big>{{ running_vm_num }}</big> running </span>
<ul class="list-inline"> <ul class="list-inline">
<li class="label label-success"><i class="icon-play-sign"></i> szilva</li> {% for vm in running_vms %}
<li class="label label-success"><i class="icon-play-sign"></i> korte</li> <li class="label label-success"><i class="icon-play-sign"></i> {{ vm.name}}</li>
<li class="label label-success"><i class="icon-play-sign"></i> cseresznye</li> {% endfor %}
</ul> </ul>
</p> </p>
<p class="big text-warning"><big>10</big> stopped</p> <p class="big text-warning"><big>{{ stopped_vm_num }}</big> stopped</p>
<p>Total: $3000 </p> <p>Total: $3000 </p>
<div class="clearfix"></div> <div class="clearfix"></div>
......
...@@ -20,10 +20,15 @@ class IndexView(TemplateView): ...@@ -20,10 +20,15 @@ class IndexView(TemplateView):
context = super(IndexView, self).get_context_data(**kwargs) context = super(IndexView, self).get_context_data(**kwargs)
context.update({ context.update({
'instances': instances[:5], 'instances': instances[:5],
'more_instances': instances.count() - len(instances[:5])
}) })
stopped_vm_states = ['PAUSED', 'SHUTDOWN', 'SHUTOFF']
context.update({ context.update({
'more_instances': instances.count() - len(instances[:5]) 'running_vms': instances.filter(state='RUNNING'),
'running_vm_num': instances.filter(state='RUNNING').count(),
'stopped_vm_num': instances.filter(
state__in=stopped_vm_states).count()
}) })
return context return context
......
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