From 4c0652e6831e5d883cf6e81cd9bf9d1e550a174b Mon Sep 17 00:00:00 2001 From: Will Thompson Date: Wed, 22 Jul 2015 21:37:04 +0200 Subject: [PATCH] errorlogsDialog: fix searching text (fixes #2819) --- static/js/errorlogsDialog.js | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/static/js/errorlogsDialog.js b/static/js/errorlogsDialog.js index 333c1bc1..f551bbf6 100644 --- a/static/js/errorlogsDialog.js +++ b/static/js/errorlogsDialog.js @@ -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({ - items: [ - {id: 'all', title: Ox._('Find: All')}, - {id: 'user', title: Ox._('Find: User')}, - {id: 'url', title: Ox._('Find: URL')}, - {id: 'text', title: Ox._('Find: Text')} - ], + items: findFields, overlap: 'right', type: 'image', value: 'all' @@ -232,12 +234,12 @@ pandora.ui.errorlogsDialog = function() { } function updateList(key, value) { + var keys = key == 'all' ? findFieldKeys : [key]; var query = { - conditions: [].concat( - key != 'url' ? [{key: 'user', value: value, operator: '='}] : [], - key != 'user' ? [{key: 'url', value: value, operator: '='}] : [] - ), - operator: key == 'all' ? '|' : '&' + conditions: keys.map(function(k) { + return {key: k, value: value, operator: '='}; + }), + operator: '|' }; $list.options({ items: function(data, callback) { @@ -251,4 +253,3 @@ pandora.ui.errorlogsDialog = function() { return that; }; -