Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
WEBUI: Fix 'map all' functionality for channels/services grids, fixes…
… #3424
  • Loading branch information
perexg committed Jan 6, 2016
1 parent 66ad720 commit f65b842
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 6 deletions.
21 changes: 19 additions & 2 deletions src/webui/static/app/chconf.js
Expand Up @@ -125,14 +125,31 @@ tvheadend.channel_tab = function(panel, index)
var mapButton = {
name: 'map',
builder: function() {
var m = new Ext.menu.Menu()
m.add({
name: 'mapsel',
tooltip: _('Map selected services to channels'),
iconCls: 'clone',
text: _('Map selected services'),
});
m.add({
name: 'mapall',
tooltip: _('Map all services to channels'),
iconCls: 'clone',
text: _('Map all services'),
});
return new Ext.Toolbar.Button({
tooltip: _('Map services to channels'),
iconCls: 'clone',
text: _('Map Services'),
text: _('Map services'),
menu: m,
disabled: false
});
},
callback: tvheadend.service_mapper
callback: {
mapall: tvheadend.service_mapper_all,
mapsel: tvheadend.service_mapper_none,
}
};

var chopsButton = {
Expand Down
2 changes: 2 additions & 0 deletions src/webui/static/app/idnode.js
Expand Up @@ -1192,6 +1192,8 @@ tvheadend.idnode_editor_win = function(_uilevel, conf)
plain: true,
items: p
});
if (conf.beforeShow)
conf.beforeShow(p, conf);
conf.win = w;
if (width)
w.setWidth(width);
Expand Down
21 changes: 19 additions & 2 deletions src/webui/static/app/mpegts.js
Expand Up @@ -239,14 +239,31 @@ tvheadend.services = function(panel, index)
var mapButton = {
name: 'map',
builder: function() {
var m = new Ext.menu.Menu()
m.add({
name: 'mapsel',
tooltip: _('Map selected services to channels'),
iconCls: 'clone',
text: _('Map selected services'),
});
m.add({
name: 'mapall',
tooltip: _('Map all services to channels'),
iconCls: 'clone',
text: _('Map all services'),
});
return new Ext.Toolbar.Button({
tooltip: _('Map services to channels'),
iconCls: 'clone',
text: _('Map All'),
text: _('Map services'),
menu: m,
disabled: false
});
},
callback: tvheadend.service_mapper
callback: {
mapall: tvheadend.service_mapper_all,
mapsel: tvheadend.service_mapper_sel,
}
};

var selected = function(s, abuttons)
Expand Down
40 changes: 38 additions & 2 deletions src/webui/static/app/servicemapper.js
Expand Up @@ -77,7 +77,7 @@ tvheadend.service_mapper_status = function(panel, index)
/*
* Start mapping
*/
tvheadend.service_mapper = function(t, e, store, select)
tvheadend.service_mapper_sel = function(t, e, store, select)
{
var panel = null;
var win = null;
Expand All @@ -98,12 +98,13 @@ tvheadend.service_mapper = function(t, e, store, select)
}

tvheadend.idnode_editor_win(tvheadend.uilevel, {
winTitle: _('Map services to channels'),
loadURL: 'api/service/mapper/load',
saveURL: 'api/service/mapper/save',
saveText: _('Map services'),
alwaysDirty: true,
noApply: true,
modifyData: modify_data,
modifyData: select ? modify_data : null,
postsave: function() {
tvheadend.select_tab('service_mapper');
},
Expand All @@ -112,3 +113,38 @@ tvheadend.service_mapper = function(t, e, store, select)
}
});
}

tvheadend.service_mapper0 = function(all)
{
tvheadend.idnode_editor_win(tvheadend.uilevel, {
winTitle: _('Map services to channels'),
loadURL: 'api/service/mapper/load',
saveURL: 'api/service/mapper/save',
saveText: _('Map services'),
alwaysDirty: true,
noApply: true,
beforeShow: all ? function(panel, conf) {
var form = panel.getForm();
var services = form.findField('services');
services.on('afterrender', function() {
services.selectAll();
});
} : null,
postsave: function() {
tvheadend.select_tab('service_mapper');
},
help: function() {
new tvheadend.help(_('Map services'), 'config_mapper.html');
}
});
}

tvheadend.service_mapper_all = function()
{
tvheadend.service_mapper0(1);
}

tvheadend.service_mapper_none = function()
{
tvheadend.service_mapper0(0);
}

0 comments on commit f65b842

Please sign in to comment.