errorlogsDialog: fix searching text (fixes #2819)

This commit is contained in:
Will Thompson 2015-07-22 21:37:04 +02:00 committed by j
parent d3c18a5859
commit 4c0652e683

View file

@ -22,13 +22,15 @@ pandora.ui.errorlogsDialog = function() {
} }
}), }),
findFields = [
{id: 'all', title: Ox._('Find: All')},
{id: 'user', title: Ox._('Find: User')},
{id: 'url', title: Ox._('Find: URL')},
{id: 'text', title: Ox._('Find: Text')}
],
findFieldKeys = findFields.slice(1).map(function(f) { return f.id; }),
$findSelect = Ox.Select({ $findSelect = Ox.Select({
items: [ items: findFields,
{id: 'all', title: Ox._('Find: All')},
{id: 'user', title: Ox._('Find: User')},
{id: 'url', title: Ox._('Find: URL')},
{id: 'text', title: Ox._('Find: Text')}
],
overlap: 'right', overlap: 'right',
type: 'image', type: 'image',
value: 'all' value: 'all'
@ -232,12 +234,12 @@ pandora.ui.errorlogsDialog = function() {
} }
function updateList(key, value) { function updateList(key, value) {
var keys = key == 'all' ? findFieldKeys : [key];
var query = { var query = {
conditions: [].concat( conditions: keys.map(function(k) {
key != 'url' ? [{key: 'user', value: value, operator: '='}] : [], return {key: k, value: value, operator: '='};
key != 'user' ? [{key: 'url', value: value, operator: '='}] : [] }),
), operator: '|'
operator: key == 'all' ? '|' : '&'
}; };
$list.options({ $list.options({
items: function(data, callback) { items: function(data, callback) {
@ -251,4 +253,3 @@ pandora.ui.errorlogsDialog = function() {
return that; return that;
}; };