mirror of
https://github.com/grafana/grafana.git
synced 2025-02-03 20:21:01 -06:00
Changed regex typeahead lookup, also works with literal regex patterns
This commit is contained in:
parent
43afd7dff9
commit
dd8d6bc705
@ -103,8 +103,19 @@ function (angular, app, _, $) {
|
|||||||
return value;
|
return value;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$scope.matcher = function(item) {
|
||||||
|
var str = this.query;
|
||||||
|
if (str[0] === '/') { str = str.substring(1); }
|
||||||
|
if (str[str.length - 1] === '/') { str = str.substring(0, str.length-1); }
|
||||||
|
try {
|
||||||
|
return item.toLowerCase().match(str);
|
||||||
|
} catch(e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
$input.attr('data-provide', 'typeahead');
|
$input.attr('data-provide', 'typeahead');
|
||||||
$input.typeahead({ source: $scope.source, minLength: 0, items: 10000, updater: $scope.updater });
|
$input.typeahead({ source: $scope.source, minLength: 0, items: 10000, updater: $scope.updater, matcher: $scope.matcher });
|
||||||
|
|
||||||
var typeahead = $input.data('typeahead');
|
var typeahead = $input.data('typeahead');
|
||||||
typeahead.lookup = function () {
|
typeahead.lookup = function () {
|
||||||
|
5
public/vendor/bootstrap/bootstrap.js
vendored
5
public/vendor/bootstrap/bootstrap.js
vendored
@ -2069,6 +2069,11 @@
|
|||||||
, move: function (e) {
|
, move: function (e) {
|
||||||
if (!this.shown) return
|
if (!this.shown) return
|
||||||
|
|
||||||
|
// grafana change, shift+left paranthesis
|
||||||
|
if (e.shiftKey && e.keyCode === 40) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
switch(e.keyCode) {
|
switch(e.keyCode) {
|
||||||
case 9: // tab
|
case 9: // tab
|
||||||
case 13: // enter
|
case 13: // enter
|
||||||
|
Loading…
Reference in New Issue
Block a user