From c3fee509f60ba6255c92a916197f1e732729a704 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Wed, 6 Aug 2014 23:23:13 -0700 Subject: [PATCH] More info on calendar New: Show more information of grabbed and failed downloads on calendar --- src/UI/Calendar/CalendarView.js | 33 +++++++++++++++++++------ src/UI/Calendar/calendar.less | 5 ++-- src/UI/History/Queue/QueueStatusCell.js | 9 +++++-- 3 files changed, 35 insertions(+), 12 deletions(-) diff --git a/src/UI/Calendar/CalendarView.js b/src/UI/Calendar/CalendarView.js index eee12dc9f..afd900920 100644 --- a/src/UI/Calendar/CalendarView.js +++ b/src/UI/Calendar/CalendarView.js @@ -60,15 +60,24 @@ define( var progress = 100 - (event.downloading.get('sizeleft') / event.downloading.get('size') * 100); var releaseTitle = event.downloading.get('title'); var estimatedCompletionTime = moment(event.downloading.get('estimatedCompletionTime')).fromNow(); + var status = event.downloading.get('status').toLocaleLowerCase(); + var errorMessage = event.downloading.get('errorMessage'); - if (event.downloading.get('status').toLocaleLowerCase() === 'pending') { - this.$(element).find('.fc-event-time') - .after(''); + if (status === 'pending') { + this._addStatusIcon(element, 'icon-time', 'Release will be processed {0}'.format(estimatedCompletionTime)); + } - this.$(element).find('.pending').tooltip({ - title: 'Release will be processed {0}'.format(estimatedCompletionTime), - container: 'body' - }); + else if (errorMessage) { + if (status === 'completed') { + this._addStatusIcon(element, 'icon-nd-import-failed', 'Import failed: {0}'.format(errorMessage)); + } + else { + this._addStatusIcon(element, 'icon-nd-download-failed', 'Download failed: {0}'.format(errorMessage)); + } + } + + else if (status === 'failed') { + this._addStatusIcon(element, 'icon-nd-download-failed', 'Download failed: check download client for more details'); } else { @@ -218,6 +227,16 @@ define( }; return options; + }, + + _addStatusIcon: function (element, icon, tooltip) { + this.$(element).find('.fc-event-time') + .after(''.format(icon)); + + this.$(element).find('.status').tooltip({ + title: tooltip, + container: 'body' + }); } }); }); diff --git a/src/UI/Calendar/calendar.less b/src/UI/Calendar/calendar.less index 6eeb72fe9..a383a6126 100644 --- a/src/UI/Calendar/calendar.less +++ b/src/UI/Calendar/calendar.less @@ -22,7 +22,7 @@ .fc-event { .clickable; - .pending { + .status { margin-right : 4px; } } @@ -173,8 +173,7 @@ } } -.ical -{ +.ical { color: @btn-link-disabled-color; cursor: pointer; } diff --git a/src/UI/History/Queue/QueueStatusCell.js b/src/UI/History/Queue/QueueStatusCell.js index 2fda4b6ea..c85b2238a 100644 --- a/src/UI/History/Queue/QueueStatusCell.js +++ b/src/UI/History/Queue/QueueStatusCell.js @@ -37,14 +37,19 @@ define( title = 'Pending'; } + if (status === 'failed') { + icon = 'icon-nd-download-failed'; + title = 'Download failed: check download client for more details'; + } + if (errorMessage !== '') { if (status === 'completed') { icon = 'icon-nd-import-failed'; - title = "Import failed"; + title = 'Import failed'; } else { icon = 'icon-nd-download-failed'; - title = "Download failed"; + title = 'Download failed'; } this.$el.html(''.format(icon));