From f186fea9eb01f73d010852da4c3567a34e2702cb Mon Sep 17 00:00:00 2001 From: Anton Markelov Date: Sat, 11 Feb 2017 18:34:57 +1000 Subject: [PATCH] Add task template names for dashboard --- api/tasks/http.go | 3 ++- public/html/projects/dashboard.jade | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/api/tasks/http.go b/api/tasks/http.go index 55d8f5e3..8e075952 100644 --- a/api/tasks/http.go +++ b/api/tasks/http.go @@ -50,7 +50,7 @@ func AddTask(c *gin.Context) { func GetAll(c *gin.Context) { project := c.MustGet("project").(models.Project) - query, args, _ := squirrel.Select("task.*, tpl.playbook as tpl_playbook, user.name as user_name"). + query, args, _ := squirrel.Select("task.*, tpl.playbook as tpl_playbook, user.name as user_name, tpl.alias as tpl_alias"). From("task"). Join("project__template as tpl on task.template_id=tpl.id"). LeftJoin("user on task.user_id=user.id"). @@ -62,6 +62,7 @@ func GetAll(c *gin.Context) { models.Task TemplatePlaybook string `db:"tpl_playbook" json:"tpl_playbook"` + TemplateAlias string `db:"tpl_alias" json:"tpl_alias"` UserName *string `db:"user_name" json:"user_name"` } if _, err := database.Mysql.Select(&tasks, query, args...); err != nil { diff --git a/public/html/projects/dashboard.jade b/public/html/projects/dashboard.jade index ae49557d..f3619c62 100644 --- a/public/html/projects/dashboard.jade +++ b/public/html/projects/dashboard.jade @@ -13,6 +13,8 @@ h4.no-top-margin Task history ul.nav.nav-pills.nav-stacked.task-history-list li(ng-repeat="task in tasks"): a(ng-click="openTask(task)" href="#") + h4.center-block(ng-if="task.tpl_alias.length > 0") {{ task.tpl_alias }} + h4.center-block(ng-if="task.tpl_alias.length == 0") No alias span(ng-class="{ 'text-muted': task.status == 'waiting', 'text-info': task.status == 'running', 'text-danger': task.status == 'error', 'text-success': task.status == 'success' }") span(ng-if="task.playbook.length == 0") {{ task.tpl_playbook }} span(ng-if="task.playbook.length > 0") {{ task.playbook }}