webui: updates to changes in idnode APIs and notification updates
This commit is contained in:
parent
3e6ff52146
commit
7fd63d7397
3 changed files with 100 additions and 41 deletions
|
@ -269,6 +269,26 @@ extjs_mpegts_network
|
|||
} else if (!strcmp(op, "class")) {
|
||||
htsmsg_t *c = idclass_serialize(&mpegts_network_class);
|
||||
htsmsg_add_msg(out, "entries", c);
|
||||
} else if (!strcmp(op, "class_list")) {
|
||||
mpegts_network_builder_t *mnb;
|
||||
htsmsg_t *e, *c = htsmsg_create_list();
|
||||
LIST_FOREACH(mnb, &mpegts_network_builders, link)
|
||||
if ((e = idclass_serialize(mnb->idc)))
|
||||
htsmsg_add_msg(c, NULL, e);
|
||||
htsmsg_add_msg(out, "entries", c);
|
||||
} else if (!strcmp(op, "create")) {
|
||||
htsmsg_t *conf = NULL;
|
||||
const char *s, *c;
|
||||
if (!(s = http_arg_get(&hc->hc_req_args, "conf")))
|
||||
return HTTP_STATUS_BAD_REQUEST;
|
||||
if (!(c = http_arg_get(&hc->hc_req_args, "class")))
|
||||
return HTTP_STATUS_BAD_REQUEST;
|
||||
if (!(conf = htsmsg_json_deserialize(s)))
|
||||
return HTTP_STATUS_BAD_REQUEST;
|
||||
pthread_mutex_lock(&global_lock);
|
||||
mn = mpegts_network_build(c, conf);
|
||||
if (mn) mn->mn_config_save(mn);
|
||||
pthread_mutex_unlock(&global_lock);
|
||||
} else if (!strcmp(op, "mux_class")) {
|
||||
const idclass_t *idc;
|
||||
const char *uuid = http_arg_get(&hc->hc_req_args, "uuid");
|
||||
|
@ -322,7 +342,7 @@ extjs_mpegts_input
|
|||
(http_connection_t *hc, const char *remain, void *opaque)
|
||||
{
|
||||
mpegts_input_t *mi;
|
||||
mpegts_network_t *mn;
|
||||
//mpegts_network_t *mn;
|
||||
htsbuf_queue_t *hq = &hc->hc_reply;
|
||||
const char *op = http_arg_get(&hc->hc_req_args, "op");
|
||||
htsmsg_t *out = htsmsg_create_map();
|
||||
|
@ -340,6 +360,7 @@ extjs_mpegts_input
|
|||
} else if (!strcmp(op, "class")) {
|
||||
htsmsg_t *list= idclass_serialize(&mpegts_input_class);
|
||||
htsmsg_add_msg(out, "entries", list);
|
||||
#if 0
|
||||
} else if (!strcmp(op, "network_class")) {
|
||||
const char *uuid = http_arg_get(&hc->hc_req_args, "uuid");
|
||||
if (!uuid) return 404;
|
||||
|
@ -359,6 +380,7 @@ extjs_mpegts_input
|
|||
else {
|
||||
// TODO: Check for error
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
htsmsg_json_serialize(out, hq, 0);
|
||||
|
|
|
@ -193,8 +193,9 @@ tvheadend.idnode_editor = function(item, conf)
|
|||
*/
|
||||
tvheadend.idnode_create = function(conf)
|
||||
{
|
||||
var puuid = null;
|
||||
var panel = null;
|
||||
var puuid = null;
|
||||
var panel = null;
|
||||
var pclass = null;
|
||||
|
||||
/* Buttons */
|
||||
var saveBtn = new Ext.Button({
|
||||
|
@ -203,7 +204,10 @@ tvheadend.idnode_create = function(conf)
|
|||
hidden : true,
|
||||
handler : function(){
|
||||
params = conf.create.params || {}
|
||||
params['uuid'] = puuid;
|
||||
if (puuid)
|
||||
params['uuid'] = puuid;
|
||||
if (pclass)
|
||||
params['class'] = pclass
|
||||
params['conf'] = Ext.util.JSON.encode(panel.getForm().getFieldValues());
|
||||
Ext.Ajax.request({
|
||||
url : conf.create.url || conf.url,
|
||||
|
@ -265,6 +269,44 @@ tvheadend.idnode_create = function(conf)
|
|||
|
||||
/* Do we need to first select a class? */
|
||||
if (conf.select) {
|
||||
var store = conf.select.store;
|
||||
if (!store) {
|
||||
store = new Ext.data.JsonStore({
|
||||
root : 'entries',
|
||||
url : conf.select.url || conf.url,
|
||||
baseParams : conf.select.params,
|
||||
fields : [ conf.select.valueField, conf.select.displayField ]
|
||||
});
|
||||
}
|
||||
var select = null;
|
||||
if (conf.select.propField) {
|
||||
select = function (s, n, o) {
|
||||
var r = store.getAt(s.selectedIndex);
|
||||
if (r) {
|
||||
var d = r.get(conf.select.propField);
|
||||
if (d) {
|
||||
pclass = r.get(conf.select.valueField);
|
||||
win.setTitle('Add ' + s.lastSelectionText);
|
||||
panel.remove(s);
|
||||
build_form(d);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
select = function (s, n, o) {
|
||||
params = conf.select.clazz.params || {};
|
||||
params['uuid'] = puuid = n.data.uuid;
|
||||
Ext.Ajax.request({
|
||||
url : conf.select.clazz.url || conf.select.url || conf.url,
|
||||
success : function(d) {
|
||||
panel.remove(s);
|
||||
d = json_decode(d);
|
||||
build_form(d.props);
|
||||
},
|
||||
params : params
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
/* Parent selector */
|
||||
var combo = new Ext.form.ComboBox({
|
||||
|
@ -276,25 +318,9 @@ tvheadend.idnode_create = function(conf)
|
|||
valueField : conf.select.valueField,
|
||||
mode : 'remote',
|
||||
triggerAction : 'all',
|
||||
store : new Ext.data.JsonStore({
|
||||
root : 'entries',
|
||||
url : conf.select.url || conf.url,
|
||||
baseParams : conf.select.params,
|
||||
fields : [ conf.select.valueField, conf.select.displayField ]
|
||||
}),
|
||||
store : store,
|
||||
listeners : {
|
||||
select: function (s, n, o) {
|
||||
params = conf.select.clazz.params || {};
|
||||
params['uuid'] = puuid = n.data.uuid;
|
||||
Ext.Ajax.request({
|
||||
url : conf.select.clazz.url || conf.select.url || conf.url,
|
||||
success : function(d) {
|
||||
panel.remove(s);
|
||||
build_form(json_decode(d));
|
||||
},
|
||||
params : params
|
||||
});
|
||||
}
|
||||
select : select
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -305,7 +331,8 @@ tvheadend.idnode_create = function(conf)
|
|||
url : conf.url,
|
||||
params : conf.params,
|
||||
success : function(d) {
|
||||
build_form(json_decode(d));
|
||||
d = json_decode(d);
|
||||
build_form(d.props);
|
||||
win.show();
|
||||
}
|
||||
});
|
||||
|
@ -577,7 +604,7 @@ tvheadend.idnode_grid = function(panel, conf)
|
|||
},
|
||||
success : function(d)
|
||||
{
|
||||
build(json_decode(d));
|
||||
build(json_decode(d).props);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
|
|
|
@ -1,33 +1,40 @@
|
|||
/*
|
||||
* IDnode stuff
|
||||
*/
|
||||
|
||||
/*
|
||||
* DVB network
|
||||
*/
|
||||
|
||||
tvheadend.network_classes = new Ext.data.JsonStore({
|
||||
autoLoad : true,
|
||||
root : 'entries',
|
||||
fields : [ 'class', 'caption', 'props' ],
|
||||
id : 'class',
|
||||
url : 'api/mpegts/network',
|
||||
baseParams : {
|
||||
op: 'class_list'
|
||||
}
|
||||
});
|
||||
tvheadend.comet.on('mpegts_network', function() {
|
||||
tvheadend.network_classes.reload();
|
||||
});
|
||||
|
||||
tvheadend.networks = function(panel)
|
||||
{
|
||||
tvheadend.idnode_grid(panel, {
|
||||
titleS : 'Network',
|
||||
titleP : 'Networks',
|
||||
titleS : 'Network',
|
||||
titleP : 'Networks',
|
||||
url : 'api/mpegts/network',
|
||||
comet : 'mpegts_network',
|
||||
add : {
|
||||
url : 'api/mpegts/input',
|
||||
url : 'api/mpegts/network',
|
||||
title : 'Network',
|
||||
select : {
|
||||
caption : 'Input',
|
||||
params : { op: 'list', limit: -1 },
|
||||
displayField : 'displayname',
|
||||
valueField : 'uuid',
|
||||
url : 'api/mpegts/input',
|
||||
clazz : {
|
||||
params : { op: 'network_class' }
|
||||
}
|
||||
caption : 'Type',
|
||||
store : tvheadend.network_classes,
|
||||
displayField : 'caption',
|
||||
valueField : 'class',
|
||||
propField : 'props',
|
||||
},
|
||||
create : {
|
||||
params : { op: 'network_create' }
|
||||
params : { op: 'create' }
|
||||
}
|
||||
},
|
||||
del : true
|
||||
|
@ -40,6 +47,7 @@ tvheadend.muxes = function(panel)
|
|||
titleS : 'Mux',
|
||||
titleP : 'Muxes',
|
||||
url : 'api/mpegts/mux',
|
||||
comet : 'mpegts_mux',
|
||||
add : {
|
||||
title : 'Mux',
|
||||
url : 'api/mpegts/network',
|
||||
|
@ -66,6 +74,7 @@ tvheadend.services = function(panel)
|
|||
url : 'api/mpegts/service',
|
||||
titleS : 'Service',
|
||||
titleP : 'Services',
|
||||
comet : 'service',
|
||||
add : false,
|
||||
del : false
|
||||
});
|
||||
|
@ -77,7 +86,8 @@ tvheadend.satconfs = function(panel)
|
|||
titleS : 'Satconf',
|
||||
titleP : 'Satconfs',
|
||||
url : 'api/linuxdvb/satconf',
|
||||
add : {
|
||||
comet : 'linuxdvb_satconf',
|
||||
add : {
|
||||
title : 'Satconf',
|
||||
url : 'api/linuxdvb/satconf',
|
||||
create : {
|
||||
|
|
Loading…
Add table
Reference in a new issue