WEBUI: add possibility to override column width for grid

- also improve the ACL edit window
This commit is contained in:
Jaroslav Kysela 2014-09-02 12:12:22 +02:00
parent 7fdf5f1f12
commit 0506aac6c1
2 changed files with 29 additions and 8 deletions

View file

@ -21,7 +21,24 @@ tvheadend.acleditor = function(panel)
comet: 'acl_entries', comet: 'acl_entries',
titleS: 'Access Entry', titleS: 'Access Entry',
titleP: 'Access Entries', titleP: 'Access Entries',
columns: {
username: { width: 250 },
password: { width: 250 },
prefix: { width: 350 },
streaming: { width: 100 },
adv_streaming: { width: 100 },
dvr: { width: 100 },
webui: { width: 100 },
admin: { width: 100 },
channel_min: { width: 100 },
channel_max: { width: 100 },
},
tabIndex: 0, tabIndex: 0,
edit: {
params: {
list: list,
},
},
add: { add: {
url: 'api/access/entry', url: 'api/access/entry',
params: { params: {

View file

@ -133,7 +133,7 @@ tvheadend.IdNodeField = function(conf)
* Methods * Methods
*/ */
this.column = function() this.column = function(conf)
{ {
var w = 300; var w = 300;
var ftype = 'string'; var ftype = 'string';
@ -155,6 +155,11 @@ tvheadend.IdNodeField = function(conf)
if (this.enum || this.list) if (this.enum || this.list)
w = 300; w = 300;
if (conf && this.id in conf) {
if (conf[this.id].width)
w = conf[this.id].width;
}
var props = { var props = {
width: w, width: w,
dataIndex: this.id, dataIndex: this.id,
@ -840,7 +845,7 @@ tvheadend.idnode_grid = function(panel, conf)
var idnode = new tvheadend.IdNode(d); var idnode = new tvheadend.IdNode(d);
for (var i = 0; i < idnode.length(); i++) { for (var i = 0; i < idnode.length(); i++) {
var f = idnode.field(i); var f = idnode.field(i);
var c = f.column(); var c = f.column(conf.columns);
fields.push(f.id); fields.push(f.id);
columns.push(c); columns.push(c);
if (c.filter) if (c.filter)
@ -1075,12 +1080,11 @@ tvheadend.idnode_grid = function(panel, conf)
}); });
w.show(); w.show();
} else { } else {
var params = { var params = {};
uuid: r.id, if (conf.edit && conf.edit.params)
meta: 1 params = conf.edit.params;
}; params['uuid'] = r.id;
if (conf.listEdit) params['meta'] = 1;
params['list'] = conf.listEdit;
tvheadend.Ajax({ tvheadend.Ajax({
url: 'api/idnode/load', url: 'api/idnode/load',
params: params, params: params,