UI: Execution screen auto refresh

* added ajax request to examine
  "running" states and their final status.
* mechanism is coherent to the horizon method.
* fixed "paused" label from bright yellow,
  which was hard to see, to darker blue

Screenshots:
http://pasteboard.co/3gtZGsy.png

Partially implements blueprint: mistral-dashboard-executions-screen

Change-Id: Ibc3cb1c74a558df9012572353537b7a2a1766363
This commit is contained in:
Gal Margalit 2015-12-14 09:47:25 +00:00
parent b6d8df5dd9
commit 5f5e510547
2 changed files with 32 additions and 2 deletions

View File

@ -22,8 +22,8 @@ TYPES = {
'SUCCESS': 'label-success',
'ERROR': 'label-danger',
'DELAYED': 'label-default',
'PAUSED': 'label-primary',
'RUNNING': 'label-info',
'PAUSED': 'label-warning'
}

View File

@ -17,6 +17,7 @@
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import ungettext_lazy
from horizon import exceptions
from horizon import tables
from mistraldashboard import api
@ -137,7 +138,31 @@ class UpdateDescription(tables.LinkAction):
classes = ("ajax-modal",)
class UpdateRow(tables.Row):
ajax = True
def get_data(self, request, id):
try:
instance = api.execution_get(request, id)
except Exception as e:
msg = _("Unable to get execution by ID %(id)s: %(e)s.") % {
'id': id, 'e': str(e)
}
exceptions.handle(request, msg)
return instance
class ExecutionsTable(tables.DataTable):
STATE_STATUS_CHOICES = (
("success", True),
("error", False),
("paused", False),
("delayed", None),
("running", None),
)
id = tables.Column(
"id",
verbose_name=_("ID"),
@ -186,11 +211,16 @@ class ExecutionsTable(tables.DataTable):
state = tables.Column(
"state",
verbose_name=_("State"),
filters=[label])
filters=[label],
status=True,
status_choices=STATE_STATUS_CHOICES,
)
class Meta(object):
name = "executions"
verbose_name = _("Executions")
status_columns = ["state"]
row_class = UpdateRow
table_actions = (DeleteExecution, tables.FilterAction)
row_actions = (DeleteExecution, UpdateDescription,
PauseExecution, CancelExecution,