]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
http: fix bug that causes tablemgr updates to hang
authorAdam Sutton <dev@adamsutton.me.uk>
Tue, 15 Jan 2013 16:25:07 +0000 (16:25 +0000)
committerAdam Sutton <dev@adamsutton.me.uk>
Tue, 15 Jan 2013 16:25:07 +0000 (16:25 +0000)
Also added additional updates based on comet data do multiple
clients would receive an update.

src/webui/extjs.c
src/webui/static/app/tableeditor.js

index 1012eaa15a376de3ee52f8c57a120ae2272e38bb..f6b33c7c150f9ba096f648be2262aa30f767fa2a 100644 (file)
@@ -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;
 }
index c3a1972d178e3286301cf82ac79dfaea7148e5da..dc04d1afcd85f2ce3ee3c7d2e2ce9c3f738d6843 100644 (file)
@@ -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) {