mirror of https://github.com/MISP/MISP
chg: [events:index] Quick search in event index for different scopes
Allow to change the scope of the quick search for filtering an index. It's a compromise between a time consuming full text search and the user experience.pull/8292/head
parent
6bb57ca7b5
commit
ddd41560e0
|
@ -117,6 +117,9 @@
|
|||
echo 'var target = "#' . $containerId . '_content";';
|
||||
}
|
||||
?>
|
||||
$('#quickFilterScopeSelector').change(function() {
|
||||
$('#quickFilterField').data('searchkey', this.value)
|
||||
});
|
||||
$('#quickFilterButton').click(function() {
|
||||
if (typeof(target) !== 'undefined') {
|
||||
runIndexQuickFilterFixed(passedArgsArray, url, target);
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
* Valid parameters:
|
||||
* - data: data-* fields
|
||||
* - searchKey: data-search-key, specifying the key to be used (defaults to searchall)
|
||||
* - searchScopes: allow to search with different searchKey. Accept an array (searchKey => textKey)
|
||||
* - fa-icon: an icon to use for the lookup $button
|
||||
* - buttong: Text to use for the lookup button
|
||||
* - cancel: Button for quickly removing the filters
|
||||
|
@ -34,9 +35,20 @@
|
|||
h($searchKey),
|
||||
empty($data['value']) ? '' : h($data['value'])
|
||||
);
|
||||
$select = '';
|
||||
if (!empty($data['searchScopes'])) {
|
||||
$select = sprintf(
|
||||
'<select id="quickFilterScopeSelector" style="%s">%s</select>',
|
||||
'max-width:100px; height: 26px; border-radius: 0px;',
|
||||
implode('', array_map(function ($scopeKey, $scopeText) {
|
||||
return sprintf('<option value="%s">%s</option>', h($scopeKey), h($scopeText));
|
||||
}, array_keys($data['searchScopes']), $data['searchScopes']))
|
||||
);
|
||||
}
|
||||
echo sprintf(
|
||||
'<div class="btn-group pull-right"><div class="input-append" style="margin-bottom:0">%s%s</div></div>',
|
||||
'<div class="btn-group pull-right"><div class="input-append" style="margin-bottom:0">%s%s%s</div></div>',
|
||||
$input,
|
||||
$select,
|
||||
$button
|
||||
);
|
||||
}
|
||||
|
|
|
@ -135,6 +135,12 @@
|
|||
'button' => __('Filter'),
|
||||
'placeholder' => __('Enter value to search'),
|
||||
'data' => '',
|
||||
'searchScopes' => [
|
||||
'searcheventinfo' => __('Event info'),
|
||||
'searchall' => __('All fields'),
|
||||
'searcheventid' => __('ID / UUID'),
|
||||
'searchtags' => __('Tag'),
|
||||
],
|
||||
'searchKey' => 'searcheventinfo',
|
||||
)
|
||||
)
|
||||
|
@ -163,6 +169,9 @@
|
|||
$('.searchFilterButton').click(function() {
|
||||
runIndexFilter(this);
|
||||
});
|
||||
$('#quickFilterScopeSelector').change(function() {
|
||||
$('#quickFilterField').data('searchkey', this.value)
|
||||
});
|
||||
$('#quickFilterButton').click(function() {
|
||||
runIndexQuickFilter();
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue