Add task template names for dashboard

This commit is contained in:
Anton Markelov 2017-02-11 18:34:57 +10:00
parent 8bc0871150
commit f186fea9eb
2 changed files with 4 additions and 1 deletions

View File

@ -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 {

View File

@ -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 }}