Skip to content

Commit

Permalink
Small work on ui. WIP pipeline start implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
michelvocks committed Mar 6, 2018
1 parent ac480e2 commit 27cde8d
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 6 deletions.
Binary file added frontend/client/assets/questionmark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed frontend/client/assets/time.png
Binary file not shown.
19 changes: 18 additions & 1 deletion frontend/client/views/overview/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@
</div>
<div>
<hr style="color: lightgrey;">
this is some text ...
<a class="button is-primary" @click="startPipeline(pipeline.id)">
<span class="icon">
<i class="fa fa-play-circle"></i>
</span>
<span>Start Pipeline</span>
</a>
</div>
</div>
</div>
Expand Down Expand Up @@ -58,6 +63,18 @@ export default {
})
},
startPipeline (pipelineid) {
// Send start request
this.$http
.get('/api/v1/pipelines/start/' + pipelineid)
.then(response => {
this.$router.push({path: '/pipelines/detail', params: { pipelineid: pipelineid }})
})
.catch(error => {
console.log(error.response.data)
})
},
getImagePath (type) {
return require('assets/' + type + '.png')
}
Expand Down
7 changes: 3 additions & 4 deletions frontend/client/views/pipelines/detail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -46,25 +46,24 @@ export default {
nodes: [],
edges: []
}
console.log(pipeline)
// Iterate all jobs of the pipeline
for (let i = 0, l = pipeline.jobs.length; i < l; i++) {
// Create nodes object
var node = {
id: i,
shape: 'circularImage',
image: require('assets/success.png'),
image: require('assets/questionmark.png'),
label: pipeline.jobs[i].title
}
// Add node to nodes list
data.nodes.push(node)
// Iterate all jobs again to find the next highest job priority
var highestPrio = 1000000000 // high as possible. First match should overwrite it.
var highestPrio = null
for (let x = 0, y = pipeline.jobs.length; x < y; x++) {
if (pipeline.jobs[x].priority > pipeline.jobs[i].priority && pipeline.jobs[x].priority < highestPrio) {
if (pipeline.jobs[x].priority > pipeline.jobs[i].priority && (pipeline.jobs[x].priority < highestPrio || !highestPrio)) {
highestPrio = pipeline.jobs[x].priority
}
}
Expand Down
7 changes: 6 additions & 1 deletion handlers/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,19 @@ func InitHandlers(i *iris.Application, s *store.Store) error {
// Define prefix
p := "/api/" + apiVersion + "/"

// Register handlers at iris instance
// --- Register handlers at iris instance ---

// Users
i.Post(p+"users/login", UserLogin)

// Pipelines
i.Post(p+"pipelines/gitlsremote", PipelineGitLSRemote)
i.Post(p+"pipelines/create", CreatePipeline)
i.Get(p+"pipelines/create", CreatePipelineGetAll)
i.Post(p+"pipelines/name", PipelineNameAvailable)
i.Get(p+"pipelines", PipelineGetAll)
i.Get(p+"pipelines/detail/{id:string}", PipelineGet)
i.Get(p+"pipelines/start/{id:string}", PipelineStart)

return nil
}
5 changes: 5 additions & 0 deletions handlers/pipeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,3 +228,8 @@ func PipelineGet(ctx iris.Context) {
ctx.StatusCode(iris.StatusNotFound)
ctx.WriteString(errPipelineNotFound.Error())
}

// PipelineStart starts a pipeline by the given id.
func PipelineStart(ctx iris.Context) {
// TODO
}

0 comments on commit 27cde8d

Please sign in to comment.