From 5b9dd4819f25a790abf56a5bb71773f11cb8f5b6 Mon Sep 17 00:00:00 2001 From: Piotr Sarnacki Date: Wed, 18 Mar 2015 16:43:51 +0100 Subject: [PATCH] Show loading text for queues and running jobs --- app/controllers/queue.coffee | 7 ++++++- app/controllers/running-jobs.coffee | 7 ++++++- app/templates/queue.hbs | 7 +++++-- app/templates/running-jobs.hbs | 4 ++++ 4 files changed, 21 insertions(+), 4 deletions(-) diff --git a/app/controllers/queue.coffee b/app/controllers/queue.coffee index cabd5b7f..a89d1b28 100644 --- a/app/controllers/queue.coffee +++ b/app/controllers/queue.coffee @@ -1,9 +1,14 @@ `import Ember from 'ember'` Controller = Ember.ArrayController.extend + isLoaded: false content: (-> - @store.filter 'job', {}, (job) -> + result = @store.filter('job', {}, (job) -> ['created', 'queued'].indexOf(job.get('state')) != -1 + ) + result.then => + @set('isLoaded', true) + result ).property() `export default Controller` diff --git a/app/controllers/running-jobs.coffee b/app/controllers/running-jobs.coffee index 44ca18fc..d7d21cb6 100644 --- a/app/controllers/running-jobs.coffee +++ b/app/controllers/running-jobs.coffee @@ -1,9 +1,14 @@ `import Ember from 'ember'` Controller = Ember.ArrayController.extend + isLoaded: false content: (-> - @store.filter 'job', { state: 'started' }, (job) -> + result = @store.filter('job', { state: 'started' }, (job) -> ['started', 'received'].indexOf(job.get('state')) != -1 + ) + result.then => + @set('isLoaded', true) + result ).property() `export default Controller` diff --git a/app/templates/queue.hbs b/app/templates/queue.hbs index aef94c04..5a7d24d6 100644 --- a/app/templates/queue.hbs +++ b/app/templates/queue.hbs @@ -1,4 +1,4 @@ - +{{#if isLoaded}} {{#if length}} {{#each job in controller}}
@@ -22,4 +22,7 @@ {{/each}} {{else}}
There are no jobs queued
-{{/if}} \ No newline at end of file +{{/if}} +{{else}} + +{{/if}} diff --git a/app/templates/running-jobs.hbs b/app/templates/running-jobs.hbs index 35f6f33b..7a91eaef 100644 --- a/app/templates/running-jobs.hbs +++ b/app/templates/running-jobs.hbs @@ -1,5 +1,6 @@ {{!--

Running Jobs ({{controller.length}})

--}} +{{#if isLoaded}} {{#if controller.length}} {{#each job in controller}}
@@ -28,3 +29,6 @@ {{else}}
There are no jobs running
{{/if}} +{{else}} + +{{/if}}