http: fix bug that causes tablemgr updates to hang

Also added additional updates based on comet data do multiple
clients would receive an update.
This commit is contained in:
Adam Sutton 2013-01-15 16:25:07 +00:00
parent 815fb013ae
commit 0400599d60
2 changed files with 10 additions and 5 deletions

View 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;
}

View 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) {