dashboard: spin the status icon if new resultant state
also fix add a hash function to check whether we should update the activity feed Closes #230
Showing
also fix add a hash function to check whether we should update the activity feed Closes #230
... | @@ -310,6 +310,9 @@ class VmDetailView(CheckedDetailView): | ... | @@ -310,6 +310,9 @@ class VmDetailView(CheckedDetailView): |
activities = activities[:10] | activities = activities[:10] | ||
context['activities'] = activities | context['activities'] = activities | ||
context['show_show_all'] = show_show_all | context['show_show_all'] = show_show_all | ||
latest = instance.get_latest_activity_in_progress() | |||
context['is_new_state'] = (latest and | |||
instance.status != latest.resultant_state) | |||
Please
register
or
sign in
to reply
|
|||
context['vlans'] = Vlan.get_objects_with_level( | context['vlans'] = Vlan.get_objects_with_level( | ||
'user', self.request.user | 'user', self.request.user | ||
... | @@ -2456,6 +2459,9 @@ def vm_activity(request, pk): | ... | @@ -2456,6 +2459,9 @@ def vm_activity(request, pk): |
response['human_readable_status'] = instance.get_status_display() | response['human_readable_status'] = instance.get_status_display() | ||
response['status'] = instance.status | response['status'] = instance.status | ||
response['icon'] = instance.get_status_icon() | response['icon'] = instance.get_status_icon() | ||
latest = instance.get_latest_activity_in_progress() | |||
response['is_new_state'] = (latest and | |||
instance.status != latest.resultant_state) | |||
context = { | context = { | ||
'instance': instance, | 'instance': instance, | ||
... | ... |
... | @@ -975,3 +975,10 @@ class Instance(AclBase, VirtualMachineDescModel, StatusModel, OperatedMixin, | ... | @@ -975,3 +975,10 @@ class Instance(AclBase, VirtualMachineDescModel, StatusModel, OperatedMixin, |
return vm_tasks.screenshot.apply_async(args=[self.vm_name], | return vm_tasks.screenshot.apply_async(args=[self.vm_name], | ||
queue=queue_name | queue=queue_name | ||
).get(timeout=timeout) | ).get(timeout=timeout) | ||
def get_latest_activity_in_progress(self): | |||
try: | |||
return InstanceActivity.objects.filter( | |||
instance=self, succeeded=None).latest("started") | |||
|
|||
except InstanceActivity.DoesNotExist: | |||
return None |