From 767a75d2f5132ffe3f0f36a86da54b81f2d6063b Mon Sep 17 00:00:00 2001 From: Sam Stenvall Date: Fri, 8 Aug 2014 10:21:29 +0300 Subject: [PATCH] [webui] render a progress bar for currently running programmes --- src/webui/static/app/epg.js | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/webui/static/app/epg.js b/src/webui/static/app/epg.js index 9844b4c8..7b4a6504 100644 --- a/src/webui/static/app/epg.js +++ b/src/webui/static/app/epg.js @@ -276,7 +276,27 @@ tvheadend.epg = function() { return '' + value; } - var epgCm = new Ext.grid.ColumnModel([actions, { + var epgCm = new Ext.grid.ColumnModel([actions, + new Ext.ux.grid.ProgressColumn({ + width: 100, + header: "Progress", + dataIndex: 'progress', + colored: false, + ceiling: 100, + tvh_renderer: function(value, meta, record, rowIndex, colIndex, store) { + var entry = record.data; + var start = entry.start; + var end = entry.end; + var duration = entry.duration; // seconds + var now = new Date(); + + // Only render a progress bar for currently running programmes + if (now <= end && now >= start) + return (now - start) / 1000 / duration * 100; + else + return ""; + } + }), { width: 250, id: 'title', header: "Title",