fixes #179: ability to search for a given field with key:value syntax

This commit is contained in:
Davide Alberani 2017-04-29 11:31:17 +02:00
parent b7c9883033
commit a6d60a0e10
2 changed files with 9 additions and 2 deletions

View file

@ -39,7 +39,13 @@ eventManApp.filter('splittedFilter', ['$filter',
return function(inputArray, searchText) {
var wordArray = searchText ? searchText.toLowerCase().split(/\s+/) : [];
for (var x=0; x < wordArray.length; x++) {
inputArray = $filter('filter')(inputArray, wordArray[x]);
var filter_item = wordArray[x];
if (filter_item.indexOf(':') != -1) {
var filter_item_split = filter_item.split(':', 2);
filter_item = {};
filter_item[filter_item_split[0]] = filter_item_split[1];
}
inputArray = $filter('filter')(inputArray, filter_item);
}
return inputArray;
};

View file

@ -123,7 +123,8 @@ class Connector():
pass
if limit_field:
code = code[:limit_field]
params = {cfg['event']['field']: code, '_errorMessage': 'code: %s' % code, '_searchFor': code}
_searchFor = '%s:%s' % (cfg['event']['field'], code)
params = {cfg['event']['field']: code, '_errorMessage': 'code: %s' % code, '_searchFor': _searchFor}
checkin_url = self.checkin_url + '?' + urllib.parse.urlencode(params)
json = convert(dict(self.cfg['actions']))
req = self.session.put(checkin_url, json=json, timeout=TIMEOUT)