Commit b8927f46 by Kálmán Viktor

dashboard: start activity panel in vm details

parent 3b0c7f0a
{% load i18n %} {% load i18n %}
<h3>{% trans "Activity" %}</h3> <h3>{% trans "Activity" %}</h3>
<style>
.sub-timeline {
border-left: 3px solid green;
margin-left: 30px;
padding-left: 10px;
}
</style>
<div class="timeline"> <div class="timeline">
<div><span class="timeline-icon timeline-warning"><i class="icon-remove"></i></span> <strong>Removing</strong> 2013-11-21 15:32</div> <div><span class="timeline-icon timeline-warning"><i class="icon-remove"></i></span> <strong>Removing</strong> 2013-11-21 15:32</div>
<div><span class="timeline-icon timeline-warning"><i class="icon-pause"></i></span> <strong>Suspending</strong> 2013-09-21 15:32</div> <div><span class="timeline-icon timeline-warning"><i class="icon-pause"></i></span> <strong>Suspending</strong> 2013-09-21 15:32</div>
<div><span class="timeline-icon"><i class="icon-ellipsis-vertical"></i></span> <strong>(now)</strong></div> {% for a in activity %}
<div><span class="timeline-icon"><i class="icon-plus"></i></span> <strong>{{ a.get_readable_name }}</strong>
{{ a.started|date:"Y-m-d. H:i" }}, {{ a.user }}
{% if a.instanceactivity_set.count > 0 %}
<div class="sub-timeline">
{% for s in a.instanceactivity_set.all %}
{{ s.get_readable_name }} - {{ a.started|time:"H:i:s" }} <br />
{% endfor %}
</div>
{% endif %}
</div>
{% endfor %}
<div><span class="timeline-icon timeline-warning"><i class="icon-remove"></i></span> <strong>Removing</strong> 2013-11-21 15:32</div>
<div><span class="timeline-icon timeline-warning"><i class="icon-pause"></i></span> <strong>Suspending</strong> 2013-09-21 15:32</div>
<div><span class="timeline-icon"><i class="icon-ellipsis-vertical" ></i></span> <strong>(now)</strong></div>
<div><span class="timeline-icon"><i class="icon-truck"></i></span> <strong>Migrated to mega5</strong> 2013-04-21 15:32, ABC123</div> <div><span class="timeline-icon"><i class="icon-truck"></i></span> <strong>Migrated to mega5</strong> 2013-04-21 15:32, ABC123</div>
<div><span class="timeline-icon"><i class="icon-refresh"></i></span> <strong>Forced reboot</strong> 2013-04-21 15:32, ABC123</div> <div><span class="timeline-icon"><i class="icon-refresh"></i></span> <strong>Forced reboot</strong> 2013-04-21 15:32, ABC123</div>
<div><span class="timeline-icon"><i class="icon-plus"></i></span> <strong>Created</strong> 2013-04-21 15:32, ABC123</div> <div><span class="timeline-icon"><i class="icon-plus"></i></span> <strong>Created</strong> 2013-04-21 15:32, ABC123</div>
......
...@@ -19,7 +19,8 @@ from django.utils.translation import ugettext as _ ...@@ -19,7 +19,8 @@ from django.utils.translation import ugettext as _
from django_tables2 import SingleTableView from django_tables2 import SingleTableView
from .tables import VmListTable from .tables import VmListTable
from vm.models import Instance, InstanceTemplate, InterfaceTemplate from vm.models import (Instance, InstanceTemplate, InterfaceTemplate,
InstanceActivity)
from firewall.models import Vlan from firewall.models import Vlan
from storage.models import Disk from storage.models import Disk
...@@ -88,6 +89,14 @@ class VmDetailView(CheckedDetailView): ...@@ -88,6 +89,14 @@ class VmDetailView(CheckedDetailView):
context.update({ context.update({
'vnc_url': '%s' % value 'vnc_url': '%s' % value
}) })
# activity data
ia = InstanceActivity.objects.filter(
instance=self.object, parent=None
).order_by('-started').select_related()
context['activity'] = ia
for i in ia[0].instanceactivity_set.all():
print i
context['acl'] = get_acl_data(instance) context['acl'] = get_acl_data(instance)
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