diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2013-03-21 15:20:39 +0100 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2013-03-21 15:20:39 +0100 |
commit | b2f560126561f0c152a7cf8b06edc78d28117b29 (patch) | |
tree | dd0ec222774f2caeb243e75ca5552c5d924db25d /module | |
parent | render package stats, speedgraph (diff) | |
download | pyload-b2f560126561f0c152a7cf8b06edc78d28117b29.tar.xz |
little fixes, use global progress to render single task
Diffstat (limited to 'module')
-rw-r--r-- | module/web/static/css/default/style.less | 10 | ||||
-rw-r--r-- | module/web/static/js/views/fileView.js | 8 | ||||
-rw-r--r-- | module/web/static/js/views/headerView.js | 14 | ||||
-rw-r--r-- | module/web/static/js/views/progressView.js | 1 | ||||
-rw-r--r-- | module/web/templates/default/base.html | 17 |
5 files changed, 38 insertions, 12 deletions
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 @@ });
</script>
<script type="text/template" id="template-header">
- <%= if downloads %>
- <% downloads %> downloads running <%= if speed %>(<% formatSize speed %>/s)<%/if%>
+ <%= if single %>
+ <% name %> (<% statusmsg %>)
<% else %>
- No running tasks
+ <%= if downloads %>
+ <% downloads %> downloads running <%= if speed %>(<% formatSize speed %>/s)<%/if%>
+ <% else %>
+ No running tasks
+ <%/if%>
<%/if%>
<i class="iconf-list pull-right"></i>
<div class="progress" id="globalprogress">
- <div class="bar" style="width: 48%">48%</div>
+ <%= if single %>
+ <div class="bar" style="width: <% percent %>%"> <% formatTime eta %>
+ <% else %>
+ <div class="bar" style="width: 0%">
+ <%/if%>
+ </div>
</div>
</script>
<script type="text/template" id="template-header-status">
|