From ea9e9d81c1660ec8c49c525c1fcbb9b54df8712d Mon Sep 17 00:00:00 2001 From: Piotr Sarnacki Date: Thu, 19 Mar 2015 11:57:52 +0100 Subject: [PATCH] Implement counts for running jobs --- app/controllers/repos.coffee | 7 ++++++- app/templates/repos/list/tabs.hbs | 2 +- app/templates/running-jobs.hbs | 2 -- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/app/controllers/repos.coffee b/app/controllers/repos.coffee index 13264e08..5d5afdff 100644 --- a/app/controllers/repos.coffee +++ b/app/controllers/repos.coffee @@ -24,7 +24,7 @@ Controller = Ember.ArrayController.extend @container.lookup('router:main').send('redirectToGettingStarted') isLoadedBinding: 'content.isLoaded' - needs: ['currentUser', 'repo'] + needs: ['currentUser', 'repo', 'runningJobs', 'queue'] currentUserBinding: 'controllers.currentUser' selectedRepo: (-> # 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') ).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: -> @_super.apply this, arguments if !Ember.testing diff --git a/app/templates/repos/list/tabs.hbs b/app/templates/repos/list/tabs.hbs index b9fc5777..22585c44 100644 --- a/app/templates/repos/list/tabs.hbs +++ b/app/templates/repos/list/tabs.hbs @@ -12,7 +12,7 @@ {{#if config.pro}}
  • - Running (2/3) + Running ({{startedJobsCount}}/{{allJobsCount}})
  • {{/if}} diff --git a/app/templates/running-jobs.hbs b/app/templates/running-jobs.hbs index f59228d6..0ec37c96 100644 --- a/app/templates/running-jobs.hbs +++ b/app/templates/running-jobs.hbs @@ -1,5 +1,3 @@ -{{!--

    Running Jobs ({{controller.length}})

    --}} - {{#if isLoaded}} {{#if controller.length}} {{#each job in controller}}