|
|
@@ -31,10 +31,10 @@ function (angular, _, config, $) {
|
|
|
$scope.emitAppEvent('hide-dash-editor');
|
|
|
}
|
|
|
if (evt.keyCode === 40) {
|
|
|
- $scope.selectedIndex++;
|
|
|
+ $scope.moveSelection(1);
|
|
|
}
|
|
|
if (evt.keyCode === 38) {
|
|
|
- $scope.selectedIndex--;
|
|
|
+ $scope.moveSelection(-1);
|
|
|
}
|
|
|
if (evt.keyCode === 13) {
|
|
|
if ($scope.tagsOnly) {
|
|
|
@@ -56,6 +56,10 @@ function (angular, _, config, $) {
|
|
|
}
|
|
|
};
|
|
|
|
|
|
+ $scope.moveSelection = function(direction) {
|
|
|
+ $scope.selectedIndex = Math.max(Math.min($scope.selectedIndex + direction, $scope.resultCount - 1), 0);
|
|
|
+ };
|
|
|
+
|
|
|
$scope.goToDashboard = function(id) {
|
|
|
$location.path("/dashboard/db/" + id);
|
|
|
};
|
|
|
@@ -76,6 +80,7 @@ function (angular, _, config, $) {
|
|
|
$scope.tagsOnly = results.tagsOnly;
|
|
|
$scope.results.dashboards = results.dashboards;
|
|
|
$scope.results.tags = results.tags;
|
|
|
+ $scope.resultCount = results.tagsOnly ? results.tags.length : results.dashboards.length;
|
|
|
});
|
|
|
};
|
|
|
|