webui: implement filter-specific clear options into autorec grid plus combo cosmetics

This commit is contained in:
Ian 2014-06-29 18:08:40 +01:00
parent a7c304a443
commit 88279741c9
3 changed files with 52 additions and 52 deletions

View file

@ -2,10 +2,8 @@
* Channel tags * Channel tags
*/ */
insertChannelTagsClearOption = function( scope, records, options ){ insertChannelTagsClearOption = function( scope, records, options ){
var placeholder = scope.getAt(1); //create a 'template' copy of an existing record var placeholder = Ext.data.Record.create(['identifier', 'name']);
placeholder.set('identifier',-1); scope.insert(0,new placeholder({identifier: '-1', name: '(Clear filter)'}));
placeholder.set('name',"(Clear filter)");
scope.insert(0, placeholder);
}; };
tvheadend.channelTags = new Ext.data.JsonStore({ tvheadend.channelTags = new Ext.data.JsonStore({
@ -37,10 +35,8 @@ tvheadend.channelrec = new Ext.data.Record.create(
'epg_post_end', 'number']); 'epg_post_end', 'number']);
insertChannelClearOption = function( scope, records, options ){ insertChannelClearOption = function( scope, records, options ){
var placeholder = scope.getAt(1); //create a 'template' copy of an existing record var placeholder = Ext.data.Record.create(['key', 'val']);
placeholder.set('key',-1); scope.insert(0,new placeholder({key: '-1', val: '(Clear filter)'}));
placeholder.set('val',"(Clear filter)");
scope.insert(0, placeholder);
}; };
tvheadend.channels = new Ext.data.JsonStore({ tvheadend.channels = new Ext.data.JsonStore({

View file

@ -539,7 +539,9 @@ tvheadend.autoreceditor = function() {
valueField: 'key', valueField: 'key',
store: tvheadend.channels, store: tvheadend.channels,
mode: 'local', mode: 'local',
editable: false, editable: true,
forceSelection: true,
typeAhead: true,
triggerAction: 'all', triggerAction: 'all',
emptyText: 'Only include channel...' emptyText: 'Only include channel...'
}), }),
@ -561,7 +563,9 @@ tvheadend.autoreceditor = function() {
displayField: 'name', displayField: 'name',
store: tvheadend.channelTags, store: tvheadend.channelTags,
mode: 'local', mode: 'local',
editable: false, editable: true,
forceSelection: true,
typeAhead: true,
triggerAction: 'all', triggerAction: 'all',
emptyText: 'Only include tag...' emptyText: 'Only include tag...'
}) })
@ -577,7 +581,9 @@ tvheadend.autoreceditor = function() {
displayField: 'name', displayField: 'name',
store: tvheadend.ContentGroupStore, store: tvheadend.ContentGroupStore,
mode: 'local', mode: 'local',
editable: false, editable: true,
forceSelection: true,
typeAhead: true,
triggerAction: 'all', triggerAction: 'all',
emptyText: 'Only include content...' emptyText: 'Only include content...'
}) })
@ -593,7 +599,9 @@ tvheadend.autoreceditor = function() {
mode: 'local', mode: 'local',
valueField: 'minvalue', valueField: 'minvalue',
displayField: 'label', displayField: 'label',
editable: false, editable: true,
forceSelection: true,
typeAhead: true,
triggerAction: 'all', triggerAction: 'all',
id: 'minfield' id: 'minfield'
}) })
@ -695,16 +703,26 @@ tvheadend.autoreceditor = function() {
}]}); }]});
tvheadend.autorecStore.on('update', function (store, record, operation) { tvheadend.autorecStore.on('update', function (store, record, operation) {
if (operation == 'edit' && record.isModified('minduration')) { if (operation == 'edit') {
if (record.isModified('minduration')) {
if (record.data.minduration == "")
record.set('maxduration',"");
else {
var index = tvheadend.DurationStore.find('minvalue', record.data.minduration);
if (record.data.minduration == "") if (index !== -1)
record.set('maxduration',""); record.set('maxduration', tvheadend.DurationStore.getById(index).data.maxvalue);
else { }
var index = tvheadend.DurationStore.find('minvalue', record.data.minduration);
if (index !== -1)
record.set('maxduration', tvheadend.DurationStore.getById(index).data.maxvalue);
} }
if (record.isModified('channel') && record.data.channel == -1)
record.set('channel',"");
if (record.isModified('tag') && record.data.tag == '(Clear filter)')
record.set('tag',"");
if (record.isModified('contenttype') && record.data.contenttype == -1)
record.set('contenttype',"");
} }
}); });

View file

@ -9,10 +9,8 @@ tvheadend.brands = new Ext.data.JsonStore({
}); });
insertContentGroupClearOption = function( scope, records, options ){ insertContentGroupClearOption = function( scope, records, options ){
var placeholder = scope.getAt(1); //create a 'template' copy of an existing record var placeholder = Ext.data.Record.create(['code', 'name']);
placeholder.set('code',-1); scope.insert(0,new placeholder({code: '-1', name: '(Clear filter)'}));
placeholder.set('name',"(Clear filter)");
scope.insert(0, placeholder);
}; };
//WIBNI: might want this store to periodically update //WIBNI: might want this store to periodically update
@ -55,8 +53,8 @@ tvheadend.channelLookupName = function(key) {
// NB: 'no max' is defined as 9999999s, or about 3 months... // NB: 'no max' is defined as 9999999s, or about 3 months...
tvheadend.DurationStore = new Ext.data.SimpleStore({ tvheadend.DurationStore = new Ext.data.SimpleStore({
storeId: 'durationnames', storeId: 'durationnames',
idIndex: 0, idIndex: 0,
fields: ['identifier','label','minvalue','maxvalue'], fields: ['identifier','label','minvalue','maxvalue'],
data: [['-1', '(Clear filter)',"",""], data: [['-1', '(Clear filter)',"",""],
['1','00:00:01 - 00:15:00',1, 900], ['1','00:00:01 - 00:15:00',1, 900],
@ -72,11 +70,9 @@ tvheadend.DurationStore = new Ext.data.SimpleStore({
tvheadend.durationLookupRange = function(value) { tvheadend.durationLookupRange = function(value) {
durationString = ""; durationString = "";
var index = tvheadend.DurationStore.find('minvalue', value); var index = tvheadend.DurationStore.find('minvalue', value);
if (index !== -1) if (index !== -1)
var durationString = tvheadend.DurationStore.getById(index).data.label; var durationString = tvheadend.DurationStore.getAt(index).data.label;
return durationString; return durationString;
}; };
@ -430,7 +426,6 @@ tvheadend.epg = function() {
editable: true, editable: true,
forceSelection: true, forceSelection: true,
triggerAction: 'all', triggerAction: 'all',
forceSelection: true,
typeAhead: true, typeAhead: true,
emptyText: 'Filter channel...', emptyText: 'Filter channel...',
listeners: { listeners: {
@ -453,7 +448,6 @@ tvheadend.epg = function() {
editable: true, editable: true,
forceSelection: true, forceSelection: true,
triggerAction: 'all', triggerAction: 'all',
forceSelection: true,
typeAhead: true, typeAhead: true,
emptyText: 'Filter tag...', emptyText: 'Filter tag...',
listeners: { listeners: {
@ -478,7 +472,6 @@ tvheadend.epg = function() {
editable: true, editable: true,
forceSelection: true, forceSelection: true,
triggerAction: 'all', triggerAction: 'all',
forceSelection: true,
typeAhead: true, typeAhead: true,
emptyText: 'Filter content type...', emptyText: 'Filter content type...',
listeners: { listeners: {
@ -500,7 +493,6 @@ tvheadend.epg = function() {
editable: true, editable: true,
forceSelection: true, forceSelection: true,
triggerAction: 'all', triggerAction: 'all',
forceSelection: true,
typeAhead: true, typeAhead: true,
emptyText: 'Filter duration...', emptyText: 'Filter duration...',
listeners: { listeners: {
@ -534,12 +526,12 @@ tvheadend.epg = function() {
}; };
clearContentGroupFilter = function() { clearContentGroupFilter = function() {
delete epgStore.baseParams.contenttype; delete epgStore.baseParams.contenttype;
epgFilterContentGroup.setValue(""); epgFilterContentGroup.setValue("");
}; };
clearDurationFilter = function() { clearDurationFilter = function() {
delete epgStore.baseParams.minduration; delete epgStore.baseParams.minduration;
delete epgStore.baseParams.maxduration; delete epgStore.baseParams.maxduration;
epgFilterDuration.setValue(""); epgFilterDuration.setValue("");
}; };
@ -560,41 +552,35 @@ tvheadend.epg = function() {
epgFilterChannels.on('select', function(c, r) { epgFilterChannels.on('select', function(c, r) {
if (r.data.key == -1) if (r.data.key == -1)
clearChannelFilter(); clearChannelFilter();
else if (epgStore.baseParams.channel !== r.data.key) else if (epgStore.baseParams.channel !== r.data.key)
epgStore.baseParams.channel = r.data.key; epgStore.baseParams.channel = r.data.key;
epgStore.reload(); epgStore.reload();
}); });
epgFilterChannelTags.on('select', function(c, r) { epgFilterChannelTags.on('select', function(c, r) {
if (r.data.identifier == -1) if (r.data.identifier == -1)
clearChannelTagsFilter(); clearChannelTagsFilter();
else if (epgStore.baseParams.tag !== r.data.name) else if (epgStore.baseParams.tag !== r.data.name)
epgStore.baseParams.tag = r.data.name; epgStore.baseParams.tag = r.data.name;
epgStore.reload(); epgStore.reload();
}); });
//IH
// TODO - check what gets saved and where, and how we filter out null tages - may happen automatically because there's
// already a null tag. I think this only applies to tags, as they're saved to config
//
// Also, check that the insert method is genuinely inserting and not over-writing the first record.
epgFilterContentGroup.on('select', function(c, r) { epgFilterContentGroup.on('select', function(c, r) {
if (r.data.code == -1) if (r.data.code == -1)
clearContentGroupFilter(); clearContentGroupFilter();
else if (epgStore.baseParams.contenttype !== r.data.code) else if (epgStore.baseParams.contenttype !== r.data.code)
epgStore.baseParams.contenttype = r.data.code; epgStore.baseParams.contenttype = r.data.code;
epgStore.reload(); epgStore.reload();
}); });
epgFilterDuration.on('select', function(c, r) { epgFilterDuration.on('select', function(c, r) {
if (r.data.identifier == -1) if (r.data.identifier == -1)
clearDurationFilter(); clearDurationFilter();
else if (epgStore.baseParams.minduration !== r.data.minvalue) { else if (epgStore.baseParams.minduration !== r.data.minvalue) {
epgStore.baseParams.minduration = r.data.minvalue; epgStore.baseParams.minduration = r.data.minvalue;
epgStore.baseParams.maxduration = r.data.maxvalue; epgStore.baseParams.maxduration = r.data.maxvalue;
} }
epgStore.reload(); epgStore.reload();
}); });
epgFilterTitle.on('valid', function(c) { epgFilterTitle.on('valid', function(c) {