fix last_branch fields on dashbaord

This commit is contained in:
Lisa P 2015-09-29 15:23:44 +02:00
parent 0f2f2253cf
commit 1a1fedfb74
5 changed files with 17 additions and 11 deletions

View File

@ -5,7 +5,7 @@
DashboardRowComponent = Ember.Component.extend DashboardRowComponent = Ember.Component.extend
tagName: 'li' tagName: 'li'
classNameBindings: ['repo.last_build.state'] classNameBindings: ['repo.default_branch.last_build.state']
classNames: ['dashboard-row'] classNames: ['dashboard-row']
isLoading: false isLoading: false
isTriggering: false isTriggering: false
@ -13,7 +13,7 @@ DashboardRowComponent = Ember.Component.extend
urlGithubCommit: (-> urlGithubCommit: (->
githubCommitUrl(@get('repo.slug'), @get('repo.default_branch.last_build.commit.sha')) githubCommitUrl(@get('repo.slug'), @get('repo.default_branch.last_build.commit.sha'))
).property('repo.last_build') ).property('repo')
# canTrigger: (-> # canTrigger: (->
# if !@get('auth.signedIn') # if !@get('auth.signedIn')

View File

@ -11,6 +11,12 @@ Controller = Ember.Controller.extend
repos = @get('model') repos = @get('model')
org = @get('org') org = @get('org')
repos = repos.filter (item, index) ->
console.log(item)
item.get('default_branch.last_build') != null
.sortBy('default_branch.last_build.finished_at')
.reverse()
if org if org
repos = repos.filter (item, index) -> repos = repos.filter (item, index) ->
item.get('owner.login') == org item.get('owner.login') == org

View File

@ -13,6 +13,6 @@ Route = TravisRoute.extend
options = {} options = {}
if @get('auth.signedIn') if @get('auth.signedIn')
options.headers = { Authorization: "token #{@auth.token()}" } options.headers = { Authorization: "token #{@auth.token()}" }
$.ajax(config.apiEndpoint + "/v3/owner/#{transition.params.owner.owner}?include=user.repositories,organization.repositories,build.commit,repository.active", options) $.ajax(config.apiEndpoint + "/v3/repos?repository.active=true&include=user.repositories,organization.repositories,build.commit", options)
`export default Route` `export default Route`

View File

@ -5,7 +5,7 @@
overflow: hidden overflow: hidden
&:after &:after
content: "" content: ""
@include fadeOut(right, -90deg, $white) @include fadeOut(right, -90deg, $white, 20%)
@mixin colorDashboardTiles($color, $status, $color2: $color) @mixin colorDashboardTiles($color, $status, $color2: $color)
&.#{$status} &.#{$status}

View File

@ -1,7 +1,7 @@
<div class="two-line fade-out"> <div class="two-line fade-out">
<div class="row-name row-item"> <div class="row-name row-item">
<h3>{{#link-to "owner" repo.owner.login}}{{status-icon status=repo.last_build.state}} {{repo.owner.login}}{{/link-to}}</h3> <h3>{{#link-to "owner" repo.owner.login}}{{status-icon status=repo.default_branch.last_build.state}} {{repo.owner.login}}{{/link-to}}</h3>
<h2>{{#link-to "repo" repo.owner.login repo.name}}<span class="label-align">{{repo.name}}</span>{{/link-to}}</h2> <h2>{{#link-to "repo" repo.owner.login repo.name}}<span class="label-align">{{repo.name}}</span>{{/link-to}}</h2>
</div> </div>
</div> </div>
@ -10,8 +10,8 @@
<div class="row-request"> <div class="row-request">
<div class="row-item"> <div class="row-item">
{{#link-to "build" repo.owner.login repo.name repo.last_build.id}} {{#link-to "build" repo.owner.login repo.name repo.last_build.id}}
{{request-icon build=repo.last_build}} {{request-icon build=repo.default_branch.last_build}}
<span class="label-align">#{{repo.last_build.number}} {{repo.last_build.state}} on {{repo.name}}</span> <span class="label-align">#{{repo.default_branch.last_build.number}} {{repo.default_branch.last_build.state}} on {{repo.default_branch.name}}</span>
{{/link-to}} {{/link-to}}
</div> </div>
</div> </div>
@ -48,7 +48,7 @@
</svg> </svg>
</span> </span>
<span class="label-align"> <span class="label-align">
{{format-sha repo.last_build.commit.sha}} {{format-sha repo.default_branch.last_build.commit.sha}}
</span> </span>
</a> </a>
</div> </div>
@ -57,7 +57,7 @@
<div class="one-line"> <div class="one-line">
<div class="row-calendar"> <div class="row-calendar">
<div class="row-item" title="{{repo.last_build.finished_at}}"> <div class="row-item" title="{{repo.default_branch.last_build.finished_at}}">
<span class="icon"> <span class="icon">
<svg viewBox="0 0 20 20"> <svg viewBox="0 0 20 20">
<g id="Cal"> <g id="Cal">
@ -75,8 +75,8 @@
</svg> </svg>
</span> </span>
<span class="label-align"> <span class="label-align">
{{#if repo.last_build}} {{#if repo.default_branch.last_build}}
{{format-time repo.last_build.finished_at}} {{format-time repo.default_branch.last_build.finished_at}}
{{else}} {{else}}
- -
{{/if}}</span> {{/if}}</span>