Fix sorting on the left sidebar

This commit is contained in:
Piotr Sarnacki 2015-11-30 13:50:14 +01:00
parent e1a334678d
commit a56e4a39c3
3 changed files with 14 additions and 8 deletions

View File

@ -60,7 +60,8 @@ var ReposListComponent = Ember.Component.extend({
} else {
return [];
}
}.property('repos.[]', 'repos')
}.property('repos.[]', 'repos.@each.lastBuildFinishedAt',
'repos.@each.lastBuildId')
});
export default ReposListComponent;

View File

@ -86,13 +86,14 @@ Controller = Ember.Controller.extend
this["view_#{tab}".camelize()](params)
viewOwned: ->
@set('isLoaded', false);
@get('currentUser._rawPermissions').then (data) =>
repos = Repo.accessibleBy(@store, data.pull).then( (reposRecordArray) =>
@set('isLoaded', true)
@set('repos', reposRecordArray)
)
# TODO: handle error
@set('isLoaded', false)
if user = @get('currentUser')
user.get('_rawPermissions').then (data) =>
repos = Repo.accessibleBy(@store, data.pull).then( (reposRecordArray) =>
@set('isLoaded', true)
@set('repos', reposRecordArray)
)
# TODO: handle error
viewRunning: ->

View File

@ -17,6 +17,10 @@ Repo = Model.extend
#lastBuild: DS.belongsTo('build')
defaultBranch: DS.belongsTo('branch', async: false)
# just for sorting
lastBuildFinishedAt: Ember.computed.oneWay('defaultBranch.lastBuild.finishedAt')
lastBuildId: Ember.computed.oneWay('defaultBranch.lastBuild.id')
withLastBuild: ->
@filter( (repo) -> repo.get('defaultBranch.lastBuild') )