Commit cd68ac0d by Kálmán Viktor

dashboard: os for instances without template

parent 3dfc4f4c
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<div class="col-md-4"> <div class="col-md-4">
<dl> <dl>
<dt>System:</dt> <dt>System:</dt>
<dd><i class="icon-{{ instance.template.os_type }}"></i> {{ instance.template.system }}</dd> <dd><i class="icon-{{ os_type_icon }}"></i> {{ instance.system }}</dd>
<dt style="margin-top: 5px;">Description:</dt> <dt style="margin-top: 5px;">Description:</dt>
<dd><small>{{ instance.description }}</small></dd> <dd><small>{{ instance.description }}</small></dd>
</dl> </dl>
......
...@@ -156,6 +156,8 @@ class VmDetailView(CheckedDetailView): ...@@ -156,6 +156,8 @@ class VmDetailView(CheckedDetailView):
context['forms'] = { context['forms'] = {
'disk_add_form': DiskAddForm(prefix="disk"), 'disk_add_form': DiskAddForm(prefix="disk"),
} }
context['os_type_icon'] = instance.os_type.replace("unknown",
"question")
return context return context
def post(self, request, *args, **kwargs): def post(self, request, *args, **kwargs):
......
...@@ -380,6 +380,24 @@ class Instance(AclBase, VirtualMachineDescModel, TimeStampedModel): ...@@ -380,6 +380,24 @@ class Instance(AclBase, VirtualMachineDescModel, TimeStampedModel):
else: else:
return timedelta() # zero return timedelta() # zero
@property
def os_type(self):
"""Get the type of the instance's operating system.
"""
if self.template is None:
return "unknown"
else:
return self.template.os_type
@property
def system(self):
"""Get the instance's operating system.
"""
if self.template is None:
return _("Unknown")
else:
return self.template.system
def get_age(self): def get_age(self):
"""Deprecated. Use uptime instead. """Deprecated. Use uptime instead.
......
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