From ceba450eb225075e6477767315ac9ec6d1fc44f4 Mon Sep 17 00:00:00 2001 From: Lisa P Date: Mon, 14 Sep 2015 17:48:06 +0200 Subject: [PATCH] make trigger build on branches work --- app/components/branch-row.coffee | 20 ++++++++++++++++---- app/controllers/branches.coffee | 13 ++++++++++++- app/styles/app/components/build-tile.sass | 4 ++-- app/styles/app/layouts/buildheader.sass | 3 +++ 4 files changed, 33 insertions(+), 7 deletions(-) diff --git a/app/components/branch-row.coffee b/app/components/branch-row.coffee index 8393eb5e..329de28a 100644 --- a/app/components/branch-row.coffee +++ b/app/components/branch-row.coffee @@ -49,15 +49,27 @@ BranchRowComponent = Ember.Component.extend lastBuilds ).property() + triggerBuild: (-> + apiEndpoint = config.apiEndpoint + repoId = @get('build.repository.id') + + options = { + type: 'POST' + } + if @get('auth.signedIn') + options.headers = { Authorization: "token #{@auth.token()}" } + + $.ajax("#{apiEndpoint}/v3/repo/#{repoId}/requests", options).then (response) -> + console.log(response); + + ) + actions: tiggerBuild: (branch) -> console.log('trigger build') + @triggerBuild() viewAllBuilds: (branch) -> console.log('view all builds') - @transitionToRoute('builds') - # updateFilter: (value) -> - # @set('_lastFilterValue', value) - # Ember.run.throttle this, @updateFilter, [], 200, false `export default BranchRowComponent` diff --git a/app/controllers/branches.coffee b/app/controllers/branches.coffee index 1a8bec3d..ea1df125 100644 --- a/app/controllers/branches.coffee +++ b/app/controllers/branches.coffee @@ -15,8 +15,19 @@ BranchesController = Ember.Controller.extend repos = repos.filter (item, index) -> item if item.exists_on_github == true .sort (a, b) -> - return 0 + # if a.last_build && b.last_build + # if a.last_build.finished_at == null + # return 1 + # else + # if a.last_build.finished_at > b.last_build.finished_at + # return -1 + # else if a.last_build.finished_at < b.last_build.finished_at + # return 1 + # else + # return 0 + # else + # return -1 ).property('model') inactiveBranches: (-> diff --git a/app/styles/app/components/build-tile.sass b/app/styles/app/components/build-tile.sass index ece849fa..5b804394 100644 --- a/app/styles/app/components/build-tile.sass +++ b/app/styles/app/components/build-tile.sass @@ -36,8 +36,8 @@ right: 0 bottom: 0 left: 0 - width: 2rem - height: 2rem + width: 2rem !important + height: 2rem !important margin: auto !important background-color: transparent .is-rotating diff --git a/app/styles/app/layouts/buildheader.sass b/app/styles/app/layouts/buildheader.sass index d1050319..3438e459 100644 --- a/app/styles/app/layouts/buildheader.sass +++ b/app/styles/app/layouts/buildheader.sass @@ -60,6 +60,9 @@ font-weight: 400 & span:hover + .tooltip display: block + ul + padding: 0 + margin: 0 .repo-main-commit position: relative