Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
WEBUI: Add code to update the progress bars in the EPG view
  • Loading branch information
perexg committed Jun 9, 2015
1 parent db77cda commit fb6b56c
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/webui/static/app/epg.js
Expand Up @@ -453,6 +453,7 @@ tvheadend.epg = function() {
dataIndex: 'progress',
colored: false,
ceiling: 100,
timeout: 20000, // 20 seconds
tvh_renderer: function(value, meta, record) {
var entry = record.data;
var start = entry.start; // milliseconds
Expand Down
27 changes: 25 additions & 2 deletions src/webui/static/app/extensions.js
Expand Up @@ -346,6 +346,7 @@ Ext.reg("multiselect", Ext.ux.Multiselect);
/**
* 22/07/2014: ceiling support backported from version 1.2, by Kai Sommerfeld
* 01/08/2014: tvh_renderer fcn added by Jaroslav Kysela
* 09/06/2015: update timeout code added by Jaroslav Kysela
*/
Ext.namespace('Ext.ux.grid');

Expand All @@ -357,6 +358,10 @@ Ext.ux.grid.ProgressColumn = function(config) {
};

Ext.extend(Ext.ux.grid.ProgressColumn, Ext.util.Observable, {
/**
* @cfg {Integer} update timeout in milliseconds (defaults to 0 - inactive)
*/
timeout : 0,
/**
* @cfg {Integer} upper limit for full progress indicator (defaults to 100)
*/
Expand Down Expand Up @@ -405,6 +410,7 @@ Ext.extend(Ext.ux.grid.ProgressColumn, Ext.util.Observable, {
return v;
},
renderer: function(v, p, record) {
var ov = v;
v = this.tvh_renderer(v, p, record);
if (typeof v === "string")
return v; // custom string
Expand All @@ -430,11 +436,28 @@ Ext.extend(Ext.ux.grid.ProgressColumn, Ext.util.Observable, {
style = '-red';
}

p.css += ' x-grid3-progresscol';
return String.format(
var res = String.format(
'<div class="x-progress-wrap"><div class="x-progress-inner"><div class="x-progress-bar{0}" style="width:{1}%;">{2}</div>' +
'</div>', style, value, text
);
if (!this.timerflag) {
p.css += ' x-grid3-progresscol';
if (this.timeout) {
var tid = Ext.id();
res = '<div id="' + tid + '">' + res + '</div>';
setInterval(this.runTimer, this.timeout, this, ov, p, record, tid);
}
}
return res;
},
runTimer: function(obj, v, p, record, tid) {
var dom = document.getElementById(tid);
if (dom) {
obj.timerflag = true;
var res = obj.renderer(v, p, record, tid);
obj.timerflag = false;
dom.innerHTML = res;
}
}
});

Expand Down

0 comments on commit fb6b56c

Please sign in to comment.