Explorar el Código

Fixed small issue in search and showing Home dashboard when filtering by tag

Torkel Ödegaard hace 10 años
padre
commit
a146a24c06
Se han modificado 1 ficheros con 7 adiciones y 2 borrados
  1. 7 2
      src/app/controllers/search.js

+ 7 - 2
src/app/controllers/search.js

@@ -14,7 +14,7 @@ function (angular, _, config) {
       $scope.giveSearchFocus = 0;
       $scope.selectedIndex = -1;
       $scope.results = {dashboards: [], tags: [], metrics: []};
-      $scope.query = { query: '' };
+      $scope.query = { query: '', tag: '', starred: false };
       $scope.db = datasourceSrv.getGrafanaDB();
       $scope.currentSearchId = 0;
 
@@ -72,12 +72,17 @@ function (angular, _, config) {
             return dash;
           });
 
-          if ($scope.query.query === "" && !$scope.query.starred) {
+          if ($scope.queryHasNoFilters()) {
             $scope.results.dashboards.unshift({ title: 'Home', url: config.appSubUrl + '/', isHome: true });
           }
         });
     };
 
+    $scope.queryHasNoFilters = function() {
+      var query = $scope.query;
+      return query.query === '' && query.starred === false && query.tag === '';
+    };
+
     $scope.filterByTag = function(tag, evt) {
       $scope.query.tag = tag;
       $scope.query.tagcloud = false;