choices.py 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. from django.utils.translation import gettext_lazy as _
  2. from utilities.choices import ChoiceSet
  3. #
  4. # Clusters
  5. #
  6. class ClusterStatusChoices(ChoiceSet):
  7. key = 'Cluster.status'
  8. STATUS_PLANNED = 'planned'
  9. STATUS_STAGING = 'staging'
  10. STATUS_ACTIVE = 'active'
  11. STATUS_DECOMMISSIONING = 'decommissioning'
  12. STATUS_OFFLINE = 'offline'
  13. CHOICES = [
  14. (STATUS_PLANNED, _('Planned'), 'cyan'),
  15. (STATUS_STAGING, _('Staging'), 'blue'),
  16. (STATUS_ACTIVE, _('Active'), 'green'),
  17. (STATUS_DECOMMISSIONING, _('Decommissioning'), 'yellow'),
  18. (STATUS_OFFLINE, _('Offline'), 'red'),
  19. ]
  20. #
  21. # VirtualMachines
  22. #
  23. class VirtualMachineStatusChoices(ChoiceSet):
  24. key = 'VirtualMachine.status'
  25. STATUS_OFFLINE = 'offline'
  26. STATUS_ACTIVE = 'active'
  27. STATUS_PLANNED = 'planned'
  28. STATUS_STAGED = 'staged'
  29. STATUS_FAILED = 'failed'
  30. STATUS_DECOMMISSIONING = 'decommissioning'
  31. STATUS_PAUSED = 'paused'
  32. CHOICES = [
  33. (STATUS_OFFLINE, _('Offline'), 'gray'),
  34. (STATUS_ACTIVE, _('Active'), 'green'),
  35. (STATUS_PLANNED, _('Planned'), 'cyan'),
  36. (STATUS_STAGED, _('Staged'), 'blue'),
  37. (STATUS_FAILED, _('Failed'), 'red'),
  38. (STATUS_DECOMMISSIONING, _('Decommissioning'), 'yellow'),
  39. (STATUS_PAUSED, _('Paused'), 'orange'),
  40. ]
  41. class VirtualMachineStartOnBootChoices(ChoiceSet):
  42. key = 'VirtualMachine.start_on_boot'
  43. STATUS_ON = 'on'
  44. STATUS_OFF = 'off'
  45. STATUS_LAST_STATE = 'laststate'
  46. CHOICES = [
  47. (STATUS_ON, _('On'), 'green'),
  48. (STATUS_OFF, _('Off'), 'gray'),
  49. (STATUS_LAST_STATE, _('Last State'), 'cyan')
  50. ]