diff --git a/frontend/client/assets/questionmark.png b/frontend/client/assets/questionmark.png new file mode 100644 index 00000000..a3b8ac49 Binary files /dev/null and b/frontend/client/assets/questionmark.png differ diff --git a/frontend/client/assets/time.png b/frontend/client/assets/time.png deleted file mode 100644 index 4d9897d5..00000000 Binary files a/frontend/client/assets/time.png and /dev/null differ diff --git a/frontend/client/views/overview/index.vue b/frontend/client/views/overview/index.vue index 469f63d6..987c172e 100755 --- a/frontend/client/views/overview/index.vue +++ b/frontend/client/views/overview/index.vue @@ -13,7 +13,12 @@

- this is some text ... + + + + + Start Pipeline +
@@ -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') } diff --git a/frontend/client/views/pipelines/detail.vue b/frontend/client/views/pipelines/detail.vue index 329dca25..7524a7e6 100755 --- a/frontend/client/views/pipelines/detail.vue +++ b/frontend/client/views/pipelines/detail.vue @@ -46,7 +46,6 @@ export default { nodes: [], edges: [] } - console.log(pipeline) // Iterate all jobs of the pipeline for (let i = 0, l = pipeline.jobs.length; i < l; i++) { @@ -54,7 +53,7 @@ export default { var node = { id: i, shape: 'circularImage', - image: require('assets/success.png'), + image: require('assets/questionmark.png'), label: pipeline.jobs[i].title } @@ -62,9 +61,9 @@ export default { 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 } } diff --git a/handlers/handler.go b/handlers/handler.go index 4123d23e..d0aedb91 100644 --- a/handlers/handler.go +++ b/handlers/handler.go @@ -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 } diff --git a/handlers/pipeline.go b/handlers/pipeline.go index efeb9dd9..ac9f4412 100644 --- a/handlers/pipeline.go +++ b/handlers/pipeline.go @@ -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 +}