From: Jaroslav Kysela Date: Tue, 9 Jun 2015 19:44:25 +0000 (+0200) Subject: WEBUI: Add code to update the progress bars in the EPG view X-Git-Tag: v4.2.1~2349 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=fb6b56ce0f7a2edc5885c5e455e4ab07e27acfa2;p=thirdparty%2Ftvheadend.git WEBUI: Add code to update the progress bars in the EPG view --- diff --git a/src/webui/static/app/epg.js b/src/webui/static/app/epg.js index cd7675196..6ee256bdc 100644 --- a/src/webui/static/app/epg.js +++ b/src/webui/static/app/epg.js @@ -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 diff --git a/src/webui/static/app/extensions.js b/src/webui/static/app/extensions.js index aefa3f681..9d8602730 100644 --- a/src/webui/static/app/extensions.js +++ b/src/webui/static/app/extensions.js @@ -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'); @@ -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) */ @@ -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 @@ -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( '
{2}
' + '
', style, value, text ); + if (!this.timerflag) { + p.css += ' x-grid3-progresscol'; + if (this.timeout) { + var tid = Ext.id(); + res = '
' + res + '
'; + 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; + } } });