work on branches templates

This commit is contained in:
Lisa P 2015-09-08 17:48:47 +02:00
parent 05f9b0df7e
commit fe67ce0882
11 changed files with 225 additions and 178 deletions

View File

@ -7,17 +7,13 @@
BranchRowComponent = Ember.Component.extend BranchRowComponent = Ember.Component.extend
tagName: 'li' tagName: 'li'
classNameBindings: ['build.state'] classNameBindings: ['build.last_build.state']
classNames: ['branch-row'] classNames: ['branch-row']
isLoading: true isLoading: true
urlAuthorGravatarImage: (->
gravatarImage(@get('build.commit.authorEmail'), 15)
).property('build.commit.authorEmail')
urlGithubCommit: (-> urlGithubCommit: (->
githubCommitUrl(@get('build.repo.slug'), @get('build.commit.sha')) githubCommitUrl(@get('build.repository.slug'), @get('build.last_build.commit.sha'))
).property('build.commit.sha') ).property('build.last_build')
getLast5Builds: (-> getLast5Builds: (->

View File

@ -4,19 +4,23 @@ RequestIconComponent = Ember.Component.extend
tagName: 'span' tagName: 'span'
classNames: ['icon-request'] classNames: ['icon-request']
classNameBindings: ['build.state'] classNameBindings: ['build.last_build.state']
isPush: (-> isPush: (->
@get('build.eventType') == 'push' @get('build.last_build.event_type') == 'push'
).property('build.eventType') ).property('build.last_build')
isPR: (-> isPR: (->
@get('build.eventType') == 'pull_request' @get('build.last_build.event_type') == 'pull_request'
).property('build.eventType') ).property('build.last_build')
isAPI: (-> isAPI: (->
@get('build.eventType') == 'api' @get('build.last_build.event_type') == 'api'
).property('build.eventType') ).property('build.last_build')
isEmpty: (->
true if @get('build.last_build') == null
).property('build.last_build')

View File

@ -4,30 +4,34 @@ StatusIconComponent = Ember.Component.extend
tagName: 'span' tagName: 'span'
classNames: ['status-icon'] classNames: ['status-icon']
classNameBindings: ['build.state'] classNameBindings: ['build.last_build.state']
hasPassed: (-> hasPassed: (->
@get('build.state') == 'passed' @get('build.last_build.state') == 'passed'
).property('build.state') ).property('build.last_build.state')
hasFailed: (-> hasFailed: (->
@get('build.state') == 'failed' @get('build.last_build.state') == 'failed'
).property('build.state') ).property('build.last_build.state')
hasErrored: (-> hasErrored: (->
@get('build.state') == 'errored' @get('build.last_build.state') == 'errored'
).property('build.state') ).property('build.last_build.state')
wasCanceled: (-> wasCanceled: (->
@get('build.state') == 'canceled' @get('build.last_build.state') == 'canceled'
).property('build.state') ).property('build.last_build.state')
isRunning: (-> isRunning: (->
@get('build.state') == 'started' || @get('build.last_build.state') == 'started' ||
@get('build.state') == 'queued' || @get('build.last_build.state') == 'queued' ||
@get('build.state') == 'booting' || @get('build.last_build.state') == 'booting' ||
@get('build.state') == 'received' || @get('build.last_build.state') == 'received' ||
@get('build.state') == 'created' @get('build.last_build.state') == 'created'
).property('build.state') ).property('build.last_build.state')
isEmpty: (->
true if @get('build.last_build') == null
).property('build.last_build')
`export default StatusIconComponent` `export default StatusIconComponent`

View File

@ -6,18 +6,20 @@ BranchesController = Ember.Controller.extend
defaultBranch: (-> defaultBranch: (->
repos = @get('model') repos = @get('model')
console.log(repos[0])
# repos = repos.filter (item, index) -> repos[0]
# item.get('owner.login') == org
).property('model') ).property('model')
activeBranches: (-> activeBranches: (->
repos = @get('model') repos = @get('model')
repos = repos.filter (item, index) ->
item if item.exists_on_github == true
).property('model') ).property('model')
inactiveBranches: (-> inactiveBranches: (->
repos = @get('model') repos = @get('model')
repos = repos.filter (item, index) ->
item if item.exists_on_github == false
).property('model') ).property('model')
actions: actions:

View File

@ -12,15 +12,7 @@ Route = TravisRoute.extend
if @get('auth.signedIn') if @get('auth.signedIn')
options.headers = { Authorization: "token #{@auth.token()}" } options.headers = { Authorization: "token #{@auth.token()}" }
# $.ajax("#{apiEndpoint}/v3/repo/#{repoId}/branch/master", options).then (response) -> $.ajax("#{apiEndpoint}/v3/repo/#{repoId}/branches?include=build.commit", options).then (response) ->
$.ajax("#{apiEndpoint}/v3/repo/#{repoId}/builds?branch.name=master&limit=5", options).then (response) -> response.branches
console.log(response)
# response.repositories.sortBy('last_build.finished_at').filter( (repo) ->
# repo.last_build
# ).map( (repo) ->
# Ember.Object.create(repo)
# )
`export default Route` `export default Route`

View File

@ -54,8 +54,8 @@
@include buildTileColors(#D94341, #FFF7F5, 'failed') @include buildTileColors(#D94341, #FFF7F5, 'failed')
@include buildTileColors(#D94341, #FFF7F5, 'errored') @include buildTileColors(#D94341, #FFF7F5, 'errored')
@include buildTileColors(#A1A0A0, #F5F5F5, 'canceled') @include buildTileColors(#A1A0A0, #F5F5F5, 'canceled')
@include buildTileColors(#ECCE4B, rgba(#ECCE4B, 0.4), 'started') @include buildTileColors(#bfb502, #fdfcee, 'started')
@include buildTileColors(#ECCE4B, rgba(#ECCE4B, 0.4), 'queued') @include buildTileColors(#bfb502, #fdfcee, 'queued')
@include buildTileColors(#ECCE4B, rgba(#ECCE4B, 0.4), 'booting') @include buildTileColors(#bfb502, #fdfcee, 'booting')
@include buildTileColors(#ECCE4B, rgba(#ECCE4B, 0.4), 'received') @include buildTileColors(#bfb502, #fdfcee, 'received')
@include buildTileColors(#ECCE4B, rgba(#ECCE4B, 0.4), 'created') @include buildTileColors(#bfb502, #fdfcee, 'created')

View File

@ -1,6 +1,6 @@
@mixin statusColors($color, $status) @mixin statusColors($color, $status, $color2: $color)
&.#{$status} &.#{$status}
background: linear-gradient(to right, $color 0%, $color 9px, white 10px, white 100%) no-repeat background: linear-gradient(to right, $color2 0%, $color2 9px, white 10px, white 100%) no-repeat
.branch-name, .branch-name,
.branch-request a .branch-request a
color: $color color: $color
@ -10,12 +10,9 @@
.icon-request g > * .icon-request g > *
fill: $color fill: $color
.branches
// .tabbody .small-title
// ul margin: 1.5em 0 0.7em
// padding: 0
// margin: 0
// list-style: none
.branch-row .branch-row
border: 1px solid $cream-dark border: 1px solid $cream-dark
@ -23,6 +20,7 @@
text-align: right text-align: right
margin-bottom: .3rem margin-bottom: .3rem
color: $grey-dark color: $grey-dark
background: linear-gradient(to right, #CACECE 0%, #CACECE 9px, white 10px, white 100%) no-repeat
span span
width: 1.3em width: 1.3em
@ -32,10 +30,13 @@
vertical-align: middle vertical-align: middle
.avatar .avatar
display: inline-block
width: 16px width: 16px
height: 16px
margin-right: .7em margin-right: .7em
border-radius: 50% border-radius: 50%
vertical-align: middle vertical-align: middle
background-color: #E9EBEB
.row-item .row-item
margin: .2em margin: .2em
@ -69,11 +70,11 @@
@include statusColors($red-dark, 'failed') @include statusColors($red-dark, 'failed')
@include statusColors($red-dark, 'errored') @include statusColors($red-dark, 'errored')
@include statusColors($grey-medium, 'canceled') @include statusColors($grey-medium, 'canceled')
@include statusColors(#ECCE4B, 'started') @include statusColors(#bfb502, 'started', #e5db29)
@include statusColors(#ECCE4B, 'queued') @include statusColors(#bfb502, 'queued', #e5db29)
@include statusColors(#ECCE4B, 'booting') @include statusColors(#bfb502, 'booting', #e5db29)
@include statusColors(#ECCE4B, 'received') @include statusColors(#bfb502, 'received', #e5db29)
@include statusColors(#ECCE4B, 'created') @include statusColors(#bfb502, 'created', #e5db29)
%row-element %row-element
@ -207,7 +208,7 @@
vertical-align: middle vertical-align: middle
width: 5px width: 5px
height: 5px height: 5px
border: solid 2px #ECCE4B border: solid 2px #e5db29
border-radius: 50% border-radius: 50%
transform-origin: center center transform-origin: center center

View File

@ -1,4 +1,4 @@
<div class="branches">
<section> <section>
<h2 class="small-title">Default Branch</h2> <h2 class="small-title">Default Branch</h2>
<ul class="blank-list"> <ul class="blank-list">
@ -34,3 +34,4 @@
{{!-- {{else}} {{!-- {{else}}
{{loading-indicator}} {{loading-indicator}}
{{/if}} --}} {{/if}} --}}
</div>

View File

@ -1,6 +1,6 @@
<div class="two-line"> <div class="two-line">
<div class="branch-name"> <div class="branch-name">
<h2 class="row-item">{{status-icon build=build}}{{build.commit.branch}}</h2> <h2 class="row-item">{{status-icon build=build}}{{build.name}}</h2>
</div> </div>
<div class="branch-builds"> <div class="branch-builds">
<div class="row-item"><a href="#"> <div class="row-item"><a href="#">
@ -18,21 +18,30 @@
V6.7L9.6,5.9V7.9z M6.4,7.9h2.2V5.7L8.1,5.7l-1.7,0V7.9z M3.6,7.9h1.8v-2l-2,0.7l0,0.4C3.5,7.2,3.5,7.6,3.6,7.9z M6.4,4.7h1.7 V6.7L9.6,5.9V7.9z M6.4,7.9h2.2V5.7L8.1,5.7l-1.7,0V7.9z M3.6,7.9h1.8v-2l-2,0.7l0,0.4C3.5,7.2,3.5,7.6,3.6,7.9z M6.4,4.7h1.7
l0.5,0.1V4c-0.1,0-0.4-0.1-0.9-0.2c0,0-0.1,0-0.1,0L6.4,3.5V4.7z"/> l0.5,0.1V4c-0.1,0-0.4-0.1-0.9-0.2c0,0-0.1,0-0.1,0L6.4,3.5V4.7z"/>
</g> </g>
</svg> </svg></span>
</span>~ builds</a></div> {{#if build.last_build}}
~ builds
{{else}}
0 builds
{{/if}}
</a></div>
</div> </div>
</div> </div>
<div class="two-line"> <div class="two-line">
<div class="branch-request"> <div class="branch-request">
<div class="row-item"> <div class="row-item">
{{#link-to "build" build.repo build}} {{#if build.last_build}}
{{#link-to "build" build.repository.slug build.last_build.id}}
{{request-icon build=build}} {{request-icon build=build}}
#{{build.number}} {{build.state}} #{{build.last_build.number}} {{build.last_build.state}}
{{/link-to}} {{/link-to}}
{{else}}
{{request-icon build=build}} -
{{/if}}
</div> </div>
</div> </div>
<div class="branch-calendar"> <div class="branch-calendar">
<div class="row-item" title="{{pretty-date build.formattedFinishedAt}}"> <div class="row-item" title="{{pretty-date build.last_build.finished_at}}">
<span class=""> <span class="">
<svg viewBox="0 0 20 20"> <svg viewBox="0 0 20 20">
<g id="Cal"> <g id="Cal">
@ -49,7 +58,12 @@
</g> </g>
</svg> </svg>
</span> </span>
{{format-time build.finishedAt}}</div> {{#if build.last_build}}
{{format-time build.last_build.finished_at}}
{{else}}
-
{{/if}}
</div>
</div> </div>
</div> </div>
<div class="two-line"> <div class="two-line">
@ -57,7 +71,7 @@
<div class="row-item"> <div class="row-item">
<a href="{{urlGithubCommit}}" title="commit on GitHub"> <a href="{{urlGithubCommit}}" title="commit on GitHub">
<span class=""> <span class="">
<svg x="0px" y="0px" viewBox="0 0 20 20" xml:space="preserve"> <svg x="0px" y="0px" viewBox="2 0 20 20" xml:space="preserve">
<g id="Commit"> <g id="Commit">
<path fill="#A7AEAE" d="M7.8,17.5c-0.3,0-0.5-0.2-0.5-0.5l0-1c-0.4,0-1,0.1-1.4-0.1c-0.4-0.1-1.3-0.5-1.8-1.7 <path fill="#A7AEAE" d="M7.8,17.5c-0.3,0-0.5-0.2-0.5-0.5l0-1c-0.4,0-1,0.1-1.4-0.1c-0.4-0.1-1.3-0.5-1.8-1.7
c-0.1-0.2-0.3-0.4-0.4-0.6c-0.1-0.1-0.2-0.3-0.3-0.4C3,12.8,3,12,3.3,11.5c0.3-0.4,0.7-0.5,1.2-0.3c0.7,0.2,1.1,0.9,1.4,1.3 c-0.1-0.2-0.3-0.4-0.4-0.6c-0.1-0.1-0.2-0.3-0.3-0.4C3,12.8,3,12,3.3,11.5c0.3-0.4,0.7-0.5,1.2-0.3c0.7,0.2,1.1,0.9,1.4,1.3
@ -82,10 +96,21 @@
</g> </g>
</svg> </svg>
</span> </span>
{{format-sha build.commit.sha}}</a></div> {{#if build.last_build}}
{{format-sha build.last_build.commit.sha}}
{{else}}
-
{{/if}}
</a></div>
</div> </div>
<div class="branch-commiter"> <div class="branch-commiter">
<div class="row-item"><img src="{{urlAuthorGravatarImage}}" alt="avatar" class="avatar">{{build.commit.committerName}}</div> <div class="row-item">
{{#if build.last_build}}
<img src="{{build.last_build.commit.committer.avatar_url}}" alt="avatar" class="avatar">{{build.last_build.commit.committer.name}}
{{else}}
<div class="avatar"></div> no commits yet
{{/if}}
</div>
</div> </div>
</div> </div>
<div class="one-line"> <div class="one-line">

View File

@ -1,3 +1,13 @@
{{#if isEmpty}}
<svg version="1.1" id="Layer_1" x="0px" y="0px"
viewBox="0 0 20 20" enable-background="new 0 0 20 20" xml:space="preserve">
<g id="Push">
<path fill="#A7AEAE" d="M16.9,9.4h-3.5c-0.3-1.6-1.7-2.8-3.4-2.8S6.9,7.8,6.6,9.4H3.1c-0.3,0-0.6,0.3-0.6,0.6s0.3,0.6,0.6,0.6h3.5
c0.3,1.6,1.7,2.8,3.4,2.8s3.1-1.2,3.4-2.8h3.5c0.3,0,0.6-0.3,0.6-0.6S17.2,9.4,16.9,9.4z M10,12.2c-1.2,0-2.2-1-2.2-2.2
c0-1.2,1-2.2,2.2-2.2c1.2,0,2.2,1,2.2,2.2c0,0,0,0,0,0c0,0,0,0,0,0C12.2,11.2,11.2,12.2,10,12.2z"/>
</g>
</svg>
{{else}}
{{#if isPush}} {{#if isPush}}
<svg version="1.1" id="Layer_1" x="0px" y="0px" <svg version="1.1" id="Layer_1" x="0px" y="0px"
viewBox="0 0 20 20" enable-background="new 0 0 20 20" xml:space="preserve"> viewBox="0 0 20 20" enable-background="new 0 0 20 20" xml:space="preserve">
@ -39,3 +49,4 @@
</g> </g>
</svg> </svg>
{{/if}} {{/if}}
{{/if}}

View File

@ -1,4 +1,14 @@
{{#if isEmpty}}
<svg version="1.1" id="Layer_1" viewBox="0 0 20 20" enable-background="new 0 0 20 20" xml:space="preserve">
<g id="NoBuild">
<g>
<path fill="#A7AEAE" d="M10,16.2c-3.4,0-6.1-2.8-6.1-6.2S6.6,3.8,10,3.8s6.1,2.8,6.1,6.2S13.4,16.2,10,16.2z M10,5.2
c-2.7,0-4.9,2.2-4.9,4.8s2.2,4.8,4.9,4.8s4.9-2.2,4.9-4.8S12.7,5.2,10,5.2z"/>
</g>
</g>
</svg>
{{else}}
{{#if hasPassed}} {{#if hasPassed}}
<svg version="1.1" id="Layer_1" x="0px" y="0px" <svg version="1.1" id="Layer_1" x="0px" y="0px"
viewBox="0 0 20 20" enable-background="new 0 0 20 20" xml:space="preserve"> viewBox="0 0 20 20" enable-background="new 0 0 20 20" xml:space="preserve">
@ -33,7 +43,7 @@
{{#if hasErrored}} {{#if hasErrored}}
<svg version="1.1" id="Layer_1" x="0px" y="0px" <svg version="1.1" id="Layer_1" x="0px" y="0px"
viewBox="-519 391 20 20" style="enable-background:new -519 391 20 20;" xml:space="preserve"> viewBox="-519 391 20 20" style="enable-background:new -518 391 20 20;" xml:space="preserve">
<g> <g>
<path fill="#A5ACAD" d="M-508.9,403.2c-0.3,0-0.6-0.3-0.6-0.6V395c0-0.3,0.3-0.6,0.6-0.6s0.6,0.3,0.6,0.6v7.6 <path fill="#A5ACAD" d="M-508.9,403.2c-0.3,0-0.6-0.3-0.6-0.6V395c0-0.3,0.3-0.6,0.6-0.6s0.6,0.3,0.6,0.6v7.6
C-508.2,402.9-508.5,403.2-508.9,403.2z"/> C-508.2,402.9-508.5,403.2-508.9,403.2z"/>
@ -48,3 +58,4 @@
<span class="circle"></span> <span class="circle"></span>
</div> </div>
{{/if}} {{/if}}
{{/if}}