Merge branch 'master' of github.com:ansible-semaphore/semaphore

This commit is contained in:
Matej Kramny 2017-02-22 03:51:31 -08:00
commit 002b7209b7
4 changed files with 16 additions and 5 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

@ -84,7 +84,8 @@ func (t *task) run() {
panic(err)
}
t.log("Started: " + strconv.Itoa(t.task.ID) + "\n")
t.log("Started: " + strconv.Itoa(t.task.ID))
t.log("Run task with template: " + t.template.Alias + "\n")
if err := t.installKey(t.repository.SshKey); err != nil {
t.log("Failed installing ssh key for repository access: " + err.Error())

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

View File

@ -9,23 +9,28 @@
.col-sm-6
input.form-control(type="text" placeholder="USA Servers" ng-model="tpl.alias")
.form-group
label.control-label.col-sm-4 Template ID
.col-sm-6
input.form-control(type="text" readonly="readonly" ng-model="tpl.id")
.form-group
label.control-label.col-sm-4 Playbook Name
.col-sm-6
input.form-control(type="text" placeholder="play.yml" ng-model="tpl.playbook")
.form-group
label.control-label.col-sm-4 SSH Key
label.control-label.col-sm-4 SSH Key*
.col-sm-6
select.form-control(ng-model="tpl.ssh_key_id" ng-options="key.id as key.name disable when key.removed for key in keys")
option(value="") -- Select SSH Key --
.form-group
label.control-label.col-sm-4 Inventory
label.control-label.col-sm-4 Inventory*
.col-sm-6
select.form-control(ng-model="tpl.inventory_id" ng-options="inv.id as inv.name disable when inv.removed for inv in inventory")
option(value="") -- Select Inventory --
.form-group
label.control-label.col-sm-4 Playbook Repository
label.control-label.col-sm-4 Playbook Repository*
.col-sm-6
select.form-control(ng-model="tpl.repository_id" ng-options="repo.id as repo.name disable when repo.removed for repo in repositories")
option(value="") -- Select Playbook Repository --
@ -34,6 +39,8 @@
.col-sm-6
select.form-control(ng-model="tpl.environment_id" ng-options="env.id as env.name disable when env.removed for env in environment")
option(value="") -- Select Task Environment --
.form-group
label.control-label.col-sm-4 (*) fields are required
hr
.form-group