Making style changes and adding AUTHORS file

Change-Id: I3238253e03d9f80975c65a3efc84bd202b338815
This commit is contained in:
Renat Akhmerov 2014-09-27 21:50:24 -07:00
parent cdd08e49d2
commit f928ac885e
9 changed files with 81 additions and 53 deletions

View File

@ -1,3 +1,4 @@
Christian Berendt <berendt@b1-systems.de>
Kirill Izotov <enykeev@stackstorm.com> Kirill Izotov <enykeev@stackstorm.com>
Nikolay Mahotkin <nmakhotkin@mirantis.com> Nikolay Mahotkin <nmakhotkin@mirantis.com>
Renat Akhmerov <rakhmerov@mirantis.com> Renat Akhmerov <rakhmerov@mirantis.com>

View File

@ -31,7 +31,10 @@ def mistralclient(request):
# additional troubles for those who still rely on v2.0 stack-wise. # additional troubles for those who still rely on v2.0 stack-wise.
auth_url=getattr(settings, 'OPENSTACK_KEYSTONE_URL'), auth_url=getattr(settings, 'OPENSTACK_KEYSTONE_URL'),
# Todo: add SECONDARY_ENDPOINT_TYPE support # Todo: add SECONDARY_ENDPOINT_TYPE support
endpoint_type=getattr(settings, endpoint_type=getattr(
'OPENSTACK_ENDPOINT_TYPE', settings,
'internalURL'), 'OPENSTACK_ENDPOINT_TYPE',
service_type=SERVICE_TYPE) 'internalURL'
),
service_type=SERVICE_TYPE
)

View File

@ -24,24 +24,35 @@ from mistraldashboard.default.utils import prettyprint
class ExecutionsTable(tables.DataTable): class ExecutionsTable(tables.DataTable):
id = tables.Column("id", verbose_name=_("ID"), id = tables.Column(
link="horizon:mistral:executions:tasks") "id",
verbose_name=_("ID"),
link="horizon:mistral:executions:tasks"
)
workflow_name = tables.Column("workflow_name", verbose_name=_("Workflow")) workflow_name = tables.Column("workflow_name", verbose_name=_("Workflow"))
input = tables.Column("input", input = tables.Column(
verbose_name=_("Input"), "input",
filters=[prettyprint]) verbose_name=_("Input"),
output = tables.Column("output", filters=[prettyprint]
verbose_name=_("Output"), )
filters=[prettyprint]) output = tables.Column(
"output",
verbose_name=_("Output"),
filters=[prettyprint]
)
created_at = tables.Column("created_at", created_at = tables.Column(
verbose_name=_("Created at"), "created_at",
filters=[humantime]) verbose_name=_("Created at"),
updated_at = tables.Column("updated_at", filters=[humantime]
verbose_name=_("Updated at"), )
filters=[humantime]) updated_at = tables.Column(
"updated_at",
verbose_name=_("Updated at"),
filters=[humantime]
)
state = tables.Column("state", verbose_name=_("State"), filters=[label]) state = tables.Column("state", verbose_name=_("State"), filters=[label])

View File

@ -26,8 +26,7 @@ class IndexView(tables.DataTableView):
template_name = 'mistral/executions/index.html' template_name = 'mistral/executions/index.html'
def get_data(self): def get_data(self):
client = api.mistralclient(self.request) return api.mistralclient(self.request).executions.list()
return client.executions.list()
class TaskView(tables.DataTableView): class TaskView(tables.DataTableView):
@ -35,5 +34,6 @@ class TaskView(tables.DataTableView):
template_name = 'mistral/executions/index.html' template_name = 'mistral/executions/index.html'
def get_data(self): def get_data(self):
client = api.mistralclient(self.request) return api.mistralclient(self.request).tasks.list(
return client.tasks.list(self.kwargs['execution_id']) self.kwargs['execution_id']
)

View File

@ -27,18 +27,26 @@ class TaskTable(tables.DataTable):
id = tables.Column("id", verbose_name=_("ID")) id = tables.Column("id", verbose_name=_("ID"))
name = tables.Column("name", verbose_name=_("Name")) name = tables.Column("name", verbose_name=_("Name"))
parameters = tables.Column("parameters", parameters = tables.Column(
verbose_name=_("Parameters"), "parameters",
filters=[prettyprint]) verbose_name=_("Parameters"),
output = tables.Column("output", filters=[prettyprint]
verbose_name=_("Output"), )
filters=[prettyprint]) output = tables.Column(
created_at = tables.Column("created_at", "output",
verbose_name=_("Created at"), verbose_name=_("Output"),
filters=[humantime]) filters=[prettyprint]
updated_at = tables.Column("updated_at", )
verbose_name=_("Updated at"), created_at = tables.Column(
filters=[humantime]) "created_at",
verbose_name=_("Created at"),
filters=[humantime]
)
updated_at = tables.Column(
"updated_at",
verbose_name=_("Updated at"),
filters=[humantime]
)
state = tables.Column("state", verbose_name=_("State"), filters=[label]) state = tables.Column("state", verbose_name=_("State"), filters=[label])

View File

@ -25,5 +25,4 @@ class IndexView(tables.DataTableView):
template_name = 'mistral/tasks/index.html' template_name = 'mistral/tasks/index.html'
def get_data(self): def get_data(self):
client = api.mistralclient(self.request) return api.mistralclient(self.request).tasks.list()
return client.tasks.list()

View File

@ -25,17 +25,22 @@ from mistraldashboard import api
class ExecuteForm(forms.SelfHandlingForm): class ExecuteForm(forms.SelfHandlingForm):
workflow_name = forms.CharField(label=_("Workflow"), workflow_name = forms.CharField(
required=True, label=_("Workflow"),
widget=forms.TextInput( required=True,
attrs={'readonly': 'readonly'})) widget=forms.TextInput(attrs={'readonly': 'readonly'})
workflow_input = forms.CharField(label=_("Input"), )
required=False, workflow_input = forms.CharField(
initial="{}", label=_("Input"),
widget=forms.widgets.Textarea()) required=False,
task_name = forms.CharField(label=_("Task name"), initial="{}",
required=False, widget=forms.widgets.Textarea()
widget=forms.TextInput()) )
task_name = forms.CharField(
label=_("Task name"),
required=False,
widget=forms.TextInput()
)
def handle(self, request, data): def handle(self, request, data):
try: try:
@ -43,6 +48,7 @@ class ExecuteForm(forms.SelfHandlingForm):
msg = _('Execution has been created with id "%s".') % ex.id msg = _('Execution has been created with id "%s".') % ex.id
messages.success(request, msg) messages.success(request, msg)
return True return True
except Exception: except Exception:
msg = _('Failed to execute workflow "%s".') % data['workflow_name'] msg = _('Failed to execute workflow "%s".') % data['workflow_name']

View File

@ -30,7 +30,7 @@ def tags_to_string(workflow):
return ', '.join(workflow.tags) if workflow.tags else None return ', '.join(workflow.tags) if workflow.tags else None
class WorkbooksTable(tables.DataTable): class WorkflowsTable(tables.DataTable):
name = tables.Column("name", verbose_name=_("Name")) name = tables.Column("name", verbose_name=_("Name"))
description = tables.Column("description", verbose_name=_("Description")) description = tables.Column("description", verbose_name=_("Description"))
tags = tables.Column(tags_to_string, verbose_name=_("Tags")) tags = tables.Column(tags_to_string, verbose_name=_("Tags"))

View File

@ -20,12 +20,12 @@ from horizon import tables
from horizon import forms from horizon import forms
from mistraldashboard import api from mistraldashboard import api
from mistraldashboard.workflows.tables import WorkbooksTable from mistraldashboard.workflows.tables import WorkflowsTable
from mistraldashboard.workflows.forms import ExecuteForm from mistraldashboard.workflows.forms import ExecuteForm
class IndexView(tables.DataTableView): class IndexView(tables.DataTableView):
table_class = WorkbooksTable table_class = WorkflowsTable
template_name = 'mistral/workflows/index.html' template_name = 'mistral/workflows/index.html'
def get_data(self): def get_data(self):
@ -39,10 +39,10 @@ class ExecuteView(forms.ModalFormView):
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
context = super(ExecuteView, self).get_context_data(**kwargs) context = super(ExecuteView, self).get_context_data(**kwargs)
context["workflow_name"] = self.kwargs['workflow_name'] context["workflow_name"] = self.kwargs['workflow_name']
return context return context
def get_initial(self, **kwargs): def get_initial(self, **kwargs):
return { return {'workflow_name': self.kwargs['workflow_name']}
'workflow_name': self.kwargs['workflow_name']
}