Implement counts for running jobs

This commit is contained in:
Piotr Sarnacki 2015-03-19 11:57:52 +01:00
parent 8324d967c4
commit ea9e9d81c1
3 changed files with 7 additions and 4 deletions

View File

@ -24,7 +24,7 @@ Controller = Ember.ArrayController.extend
@container.lookup('router:main').send('redirectToGettingStarted') @container.lookup('router:main').send('redirectToGettingStarted')
isLoadedBinding: 'content.isLoaded' isLoadedBinding: 'content.isLoaded'
needs: ['currentUser', 'repo'] needs: ['currentUser', 'repo', 'runningJobs', 'queue']
currentUserBinding: 'controllers.currentUser' currentUserBinding: 'controllers.currentUser'
selectedRepo: (-> selectedRepo: (->
# we need to observe also repo.content here, because we use # we need to observe also repo.content here, because we use
@ -33,6 +33,11 @@ Controller = Ember.ArrayController.extend
@get('controllers.repo.repo.content') || @get('controllers.repo.repo') @get('controllers.repo.repo.content') || @get('controllers.repo.repo')
).property('controllers.repo.repo', 'controllers.repo.repo.content') ).property('controllers.repo.repo', 'controllers.repo.repo.content')
startedJobsCount: Ember.computed.alias('controllers.runningJobs.length')
allJobsCount: (->
@get('startedJobsCount') + @get('controllers.queue.length')
).property('startedJobsCount', 'controllers.queue.length')
init: -> init: ->
@_super.apply this, arguments @_super.apply this, arguments
if !Ember.testing if !Ember.testing

View File

@ -12,7 +12,7 @@
{{#if config.pro}} {{#if config.pro}}
<li id="tab_running" {{bind-attr class="view.classRunning"}}> <li id="tab_running" {{bind-attr class="view.classRunning"}}>
<a href="#" {{action "showRunningJobs"}}>Running (2/3)</a> <a href="#" {{action "showRunningJobs"}}>Running ({{startedJobsCount}}/{{allJobsCount}})</a>
</li> </li>
{{/if}} {{/if}}

View File

@ -1,5 +1,3 @@
{{!-- <h4>Running Jobs ({{controller.length}})</h4> --}}
{{#if isLoaded}} {{#if isLoaded}}
{{#if controller.length}} {{#if controller.length}}
{{#each job in controller}} {{#each job in controller}}