summaryrefslogtreecommitdiffstats
path: root/module/web/static/js/views
diff options
context:
space:
mode:
Diffstat (limited to 'module/web/static/js/views')
-rw-r--r--module/web/static/js/views/fileView.js8
-rw-r--r--module/web/static/js/views/headerView.js14
-rw-r--r--module/web/static/js/views/progressView.js1
3 files changed, 20 insertions, 3 deletions
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;