From 2680e466fad832d46d46a92daba211b3da9fa11e Mon Sep 17 00:00:00 2001 From: shale Date: Thu, 23 Jul 2015 12:15:14 -0700 Subject: [PATCH] [Search] Tree selection syncs Selecting something in the search results now also makes it selected in the filetree. It remains selected even when the search results are cleared. (The filetree does not automatically expand to that position though.) --- .../general/res/css/theme-espresso.css | 3 + .../general/res/sass/search/_layout.scss | 5 ++ .../src/controllers/TreeNodeController.js | 11 ++++ platform/features/search/bundle.json | 2 +- .../features/search/res/templates/search.html | 2 +- .../src/controllers/SearchItemController.js | 58 ++----------------- 6 files changed, 26 insertions(+), 55 deletions(-) diff --git a/platform/commonUI/general/res/css/theme-espresso.css b/platform/commonUI/general/res/css/theme-espresso.css index afba02c116..11014e662e 100644 --- a/platform/commonUI/general/res/css/theme-espresso.css +++ b/platform/commonUI/general/res/css/theme-espresso.css @@ -707,6 +707,9 @@ mct-container { /* line 42, ../sass/search/_layout.scss */ .pane.treeview.left .tree-holder { top: 0; } + /* line 47, ../sass/search/_layout.scss */ + .pane.treeview.left .tree-holder.search-in-use { + display: none; } /***************************************************************************** * Open MCT Web, Copyright (c) 2014-2015, United States Government diff --git a/platform/commonUI/general/res/sass/search/_layout.scss b/platform/commonUI/general/res/sass/search/_layout.scss index 90b4c0c28c..89285c5a24 100644 --- a/platform/commonUI/general/res/sass/search/_layout.scss +++ b/platform/commonUI/general/res/sass/search/_layout.scss @@ -42,6 +42,11 @@ .tree-holder { // Want tree holder to start right below the search bar top: 0; + + // Make tree invisible when there are things in search results + &.search-in-use { + display: none; + } } } } \ No newline at end of file diff --git a/platform/commonUI/general/src/controllers/TreeNodeController.js b/platform/commonUI/general/src/controllers/TreeNodeController.js index cfb70357bb..57bf36f753 100644 --- a/platform/commonUI/general/src/controllers/TreeNodeController.js +++ b/platform/commonUI/general/src/controllers/TreeNodeController.js @@ -165,7 +165,18 @@ define( * @returns true if this should be highlighted */ isSelected: function () { + //return isSelected; + + // Modification for compatibility with search. + // If this object is the same as the model's selected object + // Same being them having the same ID (this allows different + // instances of the same thing to be recognized as the same) + if ($scope.ngModel.selectedObject.getId() === $scope.domainObject.getId()) { + setSelection($scope.domainObject); + } return isSelected; + + // TODO: Check to make sure this change doesn't break anything. } }; } diff --git a/platform/features/search/bundle.json b/platform/features/search/bundle.json index 2faf40d4cb..072afdd4f1 100644 --- a/platform/features/search/bundle.json +++ b/platform/features/search/bundle.json @@ -2,7 +2,7 @@ "name": "Search View", "description": "Allows the user to search through the file tree.", "extensions": { - "controllers": [ + "controllers": [ { "key": "SearchController", "implementation": "controllers/SearchController.js", diff --git a/platform/features/search/res/templates/search.html b/platform/features/search/res/templates/search.html index 59e98040f0..75c580da63 100644 --- a/platform/features/search/res/templates/search.html +++ b/platform/features/search/res/templates/search.html @@ -47,7 +47,7 @@ Loading... - +