From a146a24c0625571b997d96cff70f4d407ad0f152 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Mon, 23 Feb 2015 09:54:26 +0100 Subject: [PATCH] Fixed small issue in search and showing Home dashboard when filtering by tag --- src/app/controllers/search.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/app/controllers/search.js b/src/app/controllers/search.js index e724aadcf7f..767b1e5d88b 100644 --- a/src/app/controllers/search.js +++ b/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;