Browse Source

WIP: add open/closed folders icons for dash search

If browsing, then show open folder icon. If searching, show
the closed folder icon
Daniel Lee 8 years ago
parent
commit
074ef7ce4e

+ 1 - 1
public/app/core/components/search/search.html

@@ -57,7 +57,7 @@
 			<h6 ng-hide="ctrl.results.length">No dashboards matching your query were found.</h6>
 			<h6 ng-hide="ctrl.results.length">No dashboards matching your query were found.</h6>
 
 
     <div bindonce ng-repeat="row in ctrl.results">
     <div bindonce ng-repeat="row in ctrl.results">
-      <a class="search-item pointer search-item-{{row.type}}"
+      <a class="search-item pointer search-item-{{row.type}} search-results-{{ctrl.searchMode}}-mode"
         ng-class="{'selected': $index == ctrl.selectedIndex}" ng-href="{{row.url}}">
         ng-class="{'selected': $index == ctrl.selectedIndex}" ng-href="{{row.url}}">
 
 
         <span class="search-result-tags">
         <span class="search-result-tags">

+ 2 - 0
public/app/core/components/search/search.ts

@@ -20,6 +20,7 @@ export class SearchCtrl {
   ignoreClose: any;
   ignoreClose: any;
   // triggers fade animation class
   // triggers fade animation class
   openCompleted: boolean;
   openCompleted: boolean;
+  searchMode = 'browse';
 
 
   /** @ngInject */
   /** @ngInject */
   constructor(private $scope, private $location, private $timeout, private backendSrv, private contextSrv, private $rootScope) {
   constructor(private $scope, private $location, private $timeout, private backendSrv, private contextSrv, private $rootScope) {
@@ -105,6 +106,7 @@ export class SearchCtrl {
     var localSearchId = this.currentSearchId;
     var localSearchId = this.currentSearchId;
 
 
     this.query.browseMode = this.queryHasNoFilters();
     this.query.browseMode = this.queryHasNoFilters();
+    this.searchMode = this.queryHasNoFilters() ? 'browse': 'search';
 
 
     return this.backendSrv.search(this.query).then((results) => {
     return this.backendSrv.search(this.query).then((results) => {
       if (localSearchId < this.currentSearchId) { return; }
       if (localSearchId < this.currentSearchId) { return; }

+ 5 - 1
public/sass/components/_search.scss

@@ -146,10 +146,14 @@
   content: "\f015";
   content: "\f015";
 }
 }
 
 
-.search-item-dash-folder > .search-result-link > .search-result-icon::before {
+.search-item-dash-folder.search-results-browse-mode > .search-result-link > .search-result-icon::before {
   content: "\f07c";
   content: "\f07c";
 }
 }
 
 
+.search-item-dash-folder.search-results-search-mode > .search-result-link > .search-result-icon::before {
+  content: "\f07b";
+}
+
 .search-button-row {
 .search-button-row {
   padding: $spacer*2;
   padding: $spacer*2;
   display: flex;
   display: flex;