blob: 5f2e2f36d1c2903644c3b247e0ae421d60b7632c [file] [log] [blame]
Scott Bakere791dc62014-08-28 14:02:54 -07001""" PlusObjectMixin
2
3 Implements fields that are common to all OpenCloud objects. For example,
4 stuff related to backend icons.
5"""
6
7class PlusObjectMixin:
8 def getBackendIcon(self):
9 if (self.enacted is not None) and self.enacted >= self.updated:
10 return "/static/admin/img/icon_success.gif"
11 else:
12 if self.backend_status == "Provisioning in progress" or self.backend_status=="":
13 return "/static/admin/img/icon_clock.gif"
14 else:
15 return "/static/admin/img/icon_error.gif"
16
17 def getBackendHtml(self):
18 if (self.enacted is not None) and self.enacted >= self.updated:
19 return '<img src="%s">' % self.getBackendIcon()
20 else:
Scott Baker2c40f292014-08-28 15:08:56 -070021 return '<span title="%s"><img src="%s"></span>' % (self.backend_status, self.getBackendIcon())
Scott Bakere791dc62014-08-28 14:02:54 -070022