From: Adam Sutton Date: Tue, 15 Jan 2013 16:25:07 +0000 (+0000) Subject: http: fix bug that causes tablemgr updates to hang X-Git-Tag: v3.5~93 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0400599d606e5781eb776f4d49e3ab4bdfca326a;p=thirdparty%2Ftvheadend.git http: fix bug that causes tablemgr updates to hang Also added additional updates based on comet data do multiple clients would receive an update. --- diff --git a/src/webui/extjs.c b/src/webui/extjs.c index 1012eaa15..f6b33c7c1 100644 --- a/src/webui/extjs.c +++ b/src/webui/extjs.c @@ -294,10 +294,10 @@ extjs_tablemgr(http_connection_t *hc, const char *remain, void *opaque) if(in != NULL) htsmsg_destroy(in); - if(out != NULL) { - htsmsg_json_serialize(out, hq, 0); - htsmsg_destroy(out); - } + if(out == NULL) + out = htsmsg_create_map(); + htsmsg_json_serialize(out, hq, 0); + htsmsg_destroy(out); http_output_content(hc, "text/x-json; charset=UTF-8"); return 0; } diff --git a/src/webui/static/app/tableeditor.js b/src/webui/static/app/tableeditor.js index c3a1972d1..dc04d1afc 100644 --- a/src/webui/static/app/tableeditor.js +++ b/src/webui/static/app/tableeditor.js @@ -13,6 +13,11 @@ tvheadend.tableEditor = function(title, dtable, cm, rec, plugins, store, op : "get" } }); + + tvheadend.comet.on(dtable, function(m){ + if (m.reload) + store.reload(); + }); } function addRecord() { @@ -65,7 +70,6 @@ tvheadend.tableEditor = function(title, dtable, cm, rec, plugins, store, Ext.MessageBox.alert('Server Error', 'Unable to delete'); }, success : function(response, options) { - store.reload(); } }) } @@ -88,6 +92,7 @@ tvheadend.tableEditor = function(title, dtable, cm, rec, plugins, store, entries : Ext.encode(out) }, success : function(response, options) { + // Note: this call is mostly redundant (comet update will pick it up anyway) store.commitChanges(); }, failure : function(response, options) {