Merge "UI: Actions screen improvements"
This commit is contained in:
commit
eede6abcc8
@ -90,9 +90,18 @@ class ActionsTable(tables.DataTable):
|
||||
verbose_name=_("Name"),
|
||||
link="horizon:mistral:actions:detail"
|
||||
)
|
||||
is_system = tables.Column("is_system", verbose_name=_("Is System"))
|
||||
tags = tables.Column(tags_to_string, verbose_name=_("Tags"))
|
||||
inputs = tables.Column(cut, verbose_name=_("Input"))
|
||||
is_system = tables.Column(
|
||||
"is_system",
|
||||
verbose_name=_("Is System")
|
||||
)
|
||||
tags = tables.Column(
|
||||
tags_to_string,
|
||||
verbose_name=_("Tags")
|
||||
)
|
||||
inputs = tables.Column(
|
||||
cut,
|
||||
verbose_name=_("Input")
|
||||
)
|
||||
created = tables.Column(
|
||||
"created_at",
|
||||
verbose_name=_("Created"),
|
||||
@ -110,9 +119,6 @@ class ActionsTable(tables.DataTable):
|
||||
)
|
||||
)
|
||||
|
||||
def get_object_id(self, datum):
|
||||
return datum.name
|
||||
|
||||
class Meta(object):
|
||||
name = "actions"
|
||||
verbose_name = _("Actions")
|
||||
|
@ -1,11 +1,7 @@
|
||||
{% extends 'mistral/default/base.html' %}
|
||||
{% extends 'mistral/default/table.html' %}
|
||||
{% load i18n %}
|
||||
{% block title %}{% trans "Actions" %}{% endblock %}
|
||||
|
||||
{% block page_header %}
|
||||
{% include "horizon/common/_page_header.html" with title=_("Actions") %}
|
||||
{% endblock page_header %}
|
||||
|
||||
{% block main %}
|
||||
{{ table.render }}
|
||||
{% endblock %}
|
||||
{% endblock page_header %}
|
@ -49,11 +49,59 @@ class UpdateView(forms.ModalFormView):
|
||||
|
||||
|
||||
class IndexView(tables.DataTableView):
|
||||
table_id = "workflow_action"
|
||||
table_class = ActionsTable
|
||||
template_name = 'mistral/actions/index.html'
|
||||
|
||||
def has_prev_data(self, table):
|
||||
return self._prev
|
||||
|
||||
def has_more_data(self, table):
|
||||
return self._more
|
||||
|
||||
def get_data(self):
|
||||
return api.action_list(self.request)
|
||||
actions = []
|
||||
prev_marker = self.request.GET.get(
|
||||
ActionsTable._meta.prev_pagination_param,
|
||||
None
|
||||
)
|
||||
|
||||
if prev_marker is not None:
|
||||
sort_dir = 'asc'
|
||||
marker = prev_marker
|
||||
else:
|
||||
sort_dir = 'desc'
|
||||
marker = self.request.GET.get(
|
||||
ActionsTable._meta.pagination_param,
|
||||
None
|
||||
)
|
||||
|
||||
try:
|
||||
actions, self._more, self._prev = api.pagination_list(
|
||||
entity="actions",
|
||||
request=self.request,
|
||||
marker=marker,
|
||||
sort_keys='name',
|
||||
sort_dirs=sort_dir,
|
||||
paginate=True
|
||||
)
|
||||
|
||||
if prev_marker is not None:
|
||||
actions = sorted(
|
||||
actions,
|
||||
key=lambda action: getattr(
|
||||
action, 'name'
|
||||
),
|
||||
reverse=True
|
||||
)
|
||||
|
||||
except Exception as e:
|
||||
self._prev = False
|
||||
self._more = False
|
||||
msg = _('Unable to retrieve actions list: %s') % str(e)
|
||||
exceptions.handle(self.request, msg)
|
||||
|
||||
return actions
|
||||
|
||||
|
||||
class DetailView(generic.TemplateView):
|
||||
|
@ -48,15 +48,16 @@ def mistralclient(request):
|
||||
|
||||
@handle_errors(_("Unable to retrieve list"), [])
|
||||
def pagination_list(entity, request, marker='', sort_keys='',
|
||||
sort_dirs='', paginate=False):
|
||||
sort_dirs='asc', paginate=False):
|
||||
"""Retrieve a listing of specific entity and handles pagination.
|
||||
|
||||
:param entity: Requested entity (String)
|
||||
:param request: Request data
|
||||
:param marker: Pagination marker for large data sets: entity id
|
||||
:param sort_keys: Columns to sort results by. Default: created_at
|
||||
:param sort_keys: Columns to sort results by
|
||||
:param sort_dirs: Sorting Directions (asc/desc). Default:asc
|
||||
:param paginate: If true will perform pagination based on settings
|
||||
:param paginate: If true will perform pagination based on settings.
|
||||
Default:False
|
||||
"""
|
||||
|
||||
limit = getattr(settings, 'API_RESULT_LIMIT', 1000)
|
||||
@ -67,8 +68,8 @@ def pagination_list(entity, request, marker='', sort_keys='',
|
||||
else:
|
||||
request_size = limit
|
||||
|
||||
request = mistralclient(request)
|
||||
entities_iter = (eval('request.%s' % entity)).list(
|
||||
api = mistralclient(request)
|
||||
entities_iter = getattr(api, entity).list(
|
||||
marker, limit, sort_keys, sort_dirs
|
||||
)
|
||||
|
||||
|
@ -1,5 +1,7 @@
|
||||
{% extends 'mistral/default/base.html' %}
|
||||
|
||||
{% block main %}
|
||||
<div class="mistral-wrapper">
|
||||
{{ table.render }}
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
@ -1,11 +1,7 @@
|
||||
{% extends 'mistral/default/base.html' %}
|
||||
{% extends 'mistral/default/table.html' %}
|
||||
{% load i18n %}
|
||||
{% block title %}{% trans "Executions" %}{% endblock %}
|
||||
|
||||
{% block page_header %}
|
||||
{% include "horizon/common/_page_header.html" with title=_("Executions") %}
|
||||
{% endblock page_header %}
|
||||
|
||||
{% block main %}
|
||||
{{ table.render }}
|
||||
{% endblock %}
|
||||
|
@ -1,3 +1,11 @@
|
||||
.list{
|
||||
list-style: inherit;
|
||||
}
|
||||
|
||||
.mistral-wrapper #actions{
|
||||
width:100%;
|
||||
}
|
||||
|
||||
.mistral-wrapper #actions a.btn{
|
||||
width:inherit;
|
||||
}
|
@ -1,11 +1,7 @@
|
||||
{% extends 'mistral/default/base.html' %}
|
||||
{% extends 'mistral/default/table.html' %}
|
||||
{% load i18n %}
|
||||
{% block title %}{% trans "Workbooks" %}{% endblock %}
|
||||
|
||||
{% block page_header %}
|
||||
{% include "horizon/common/_page_header.html" with title=_("Workbooks") %}
|
||||
{% endblock page_header %}
|
||||
|
||||
{% block main %}
|
||||
{{ table.render }}
|
||||
{% endblock %}
|
||||
|
@ -51,8 +51,8 @@ class ExecuteForm(forms.SelfHandlingForm):
|
||||
messages.success(request, msg)
|
||||
|
||||
return True
|
||||
except Exception:
|
||||
msg = _('Failed to execute workflow "%s".') % data['workflow_name']
|
||||
except Exception as e:
|
||||
msg = _('Failed to execute workflow "%s".') % e
|
||||
redirect = reverse('horizon:mistral:workflows:index')
|
||||
exceptions.handle(request, msg, redirect=redirect)
|
||||
|
||||
|
@ -1,11 +1,7 @@
|
||||
{% extends 'mistral/default/base.html' %}
|
||||
{% extends 'mistral/default/table.html' %}
|
||||
{% load i18n %}
|
||||
{% block title %}{% trans "Workflows" %}{% endblock %}
|
||||
|
||||
{% block page_header %}
|
||||
{% include "horizon/common/_page_header.html" with title=_("Workflows") %}
|
||||
{% endblock page_header %}
|
||||
|
||||
{% block main %}
|
||||
{{ table.render }}
|
||||
{% endblock %}
|
||||
|
Loading…
x
Reference in New Issue
Block a user