From b2f560126561f0c152a7cf8b06edc78d28117b29 Mon Sep 17 00:00:00 2001 From: RaNaN Date: Thu, 21 Mar 2013 15:20:39 +0100 Subject: little fixes, use global progress to render single task --- module/web/static/css/default/style.less | 10 +++++----- module/web/static/js/views/fileView.js | 8 ++++++-- module/web/static/js/views/headerView.js | 14 +++++++++++++- module/web/static/js/views/progressView.js | 1 + module/web/templates/default/base.html | 17 +++++++++++++---- 5 files changed, 38 insertions(+), 12 deletions(-) (limited to 'module') diff --git a/module/web/static/css/default/style.less b/module/web/static/css/default/style.less index 0f9b551b3..bc53d6b9e 100644 --- a/module/web/static/css/default/style.less +++ b/module/web/static/css/default/style.less @@ -297,11 +297,11 @@ header .logo { #globalprogress { background-color: @greyDark; background-image: none; - height: 15px; - margin: 5px 0 0; - line-height: 15px; - border-radius: 15px; - border: 3px solid @grey; + height: 12px; + line-height: 12px; + margin: 8px 0 0; + border-radius: 10px; + border: 2px solid @grey; .bar { color: @dark; diff --git a/module/web/static/js/views/fileView.js b/module/web/static/js/views/fileView.js index b0d7ac9de..c673041b5 100644 --- a/module/web/static/js/views/fileView.js +++ b/module/web/static/js/views/fileView.js @@ -77,7 +77,10 @@ define(['jquery', 'backbone', 'underscore', 'app', 'utils/apitypes', 'views/abst }, progress_changed: function() { - if (this.model.isDownload() && this.model.get('download').status === Api.DownloadStatus.Downloading) { + if(!this.model.isDownload()) + return; + + if (this.model.get('download').status === Api.DownloadStatus.Downloading) { var bar = this.$('.progress .bar'); if (!bar) { // ensure that the dl bar is rendered this.render(); @@ -86,7 +89,8 @@ define(['jquery', 'backbone', 'underscore', 'app', 'utils/apitypes', 'views/abst bar.width(this.model.get('progress') + '%'); bar.html('  ' + formatTime(this.model.get('eta'))); - } + } else // Every else state can be renderred normally + this.render(); } }); diff --git a/module/web/static/js/views/headerView.js b/module/web/static/js/views/headerView.js index 2c4f8abb5..164c6d715 100644 --- a/module/web/static/js/views/headerView.js +++ b/module/web/static/js/views/headerView.js @@ -101,7 +101,7 @@ define(['jquery', 'underscore', 'backbone', 'app', 'models/ServerStatus', 'colle this.templateStatus(this.status.toJSON()) ); - var data = {tasks: 0, downloads: 0, speed: 0}; + var data = {tasks: 0, downloads: 0, speed: 0, single:false}; this.progressList.each(function(progress) { if (progress.isDownload()) { data.downloads += 1; @@ -110,6 +110,18 @@ define(['jquery', 'underscore', 'backbone', 'app', 'models/ServerStatus', 'colle data.tasks++; }); + // Show progress of one task + if (data.tasks + data.downloads === 1) { + var progress = this.progressList.at(0); + data.single = true; + data.eta = progress.get('eta'); + data.percent = progress.getPercent(); + data.name = progress.get('name'); + data.statusmsg = progress.get('statusmsg'); + } + // TODO: better progressbar rendering + + this.$('#progress-info').html( this.templateHeader(data) ); diff --git a/module/web/static/js/views/progressView.js b/module/web/static/js/views/progressView.js index 40fbf0652..3c2908000 100644 --- a/module/web/static/js/views/progressView.js +++ b/module/web/static/js/views/progressView.js @@ -22,6 +22,7 @@ define(['jquery', 'backbone', 'underscore', 'app', 'utils/apitypes', 'views/abst // TODO: icon // TODO: other states // TODO: non download progress + // TODO: better progressbar rendering this.$el.css('background-image', 'url(icons/sdf)'); this.$el.html(this.template(this.model.toJSON())); return this; diff --git a/module/web/templates/default/base.html b/module/web/templates/default/base.html index f8dd10c4e..822d7c710 100644 --- a/module/web/templates/default/base.html +++ b/module/web/templates/default/base.html @@ -39,15 +39,24 @@ });