Added search clear functionality to filtering
Change-Id: Id22b067c8bcc0e05aee6325153154ea7a81f17ae
Signed-off-by: Iftekharul Islam <iislam@us.ibm.com>
diff --git a/app/server-health/controllers/inventory-overview-controller.html b/app/server-health/controllers/inventory-overview-controller.html
index 597a664..f67b867 100644
--- a/app/server-health/controllers/inventory-overview-controller.html
+++ b/app/server-health/controllers/inventory-overview-controller.html
@@ -15,7 +15,7 @@
<label for="content__search-input">Search</label> <input id="content__search-input" type="text"
ng-model="customSearch" ng-keydown="doSearchOnEnter($event)"/>
<div class="search-submit__wrapper">
- <button class="clear-input" ng-click="customSearch = ''">✕</button>
+ <button class="clear-input" ng-click="clear()">✕</button>
<input id="content__search-submit" type="submit" class="btn btn-primary content__search-submit" value="Filter" ng-click="doSearchOnClick()"/>
</div>
diff --git a/app/server-health/controllers/inventory-overview-controller.js b/app/server-health/controllers/inventory-overview-controller.js
index c5e6189..fae3a09 100644
--- a/app/server-health/controllers/inventory-overview-controller.js
+++ b/app/server-health/controllers/inventory-overview-controller.js
@@ -32,6 +32,11 @@
$scope.loading = false;
});
+ $scope.clear = function(){
+ $scope.customSearch = "";
+ $scope.searchTerms = [];
+ }
+
$scope.doSearchOnEnter = function (event) {
var search = $scope.customSearch.replace(/^\s+/g,'').replace(/\s+$/g,'');
if (event.keyCode === 13 &&
diff --git a/app/server-health/controllers/sensors-overview-controller.html b/app/server-health/controllers/sensors-overview-controller.html
index 95631e8..efd60a5 100644
--- a/app/server-health/controllers/sensors-overview-controller.html
+++ b/app/server-health/controllers/sensors-overview-controller.html
@@ -16,7 +16,7 @@
<label for="content__search-input">Sensors Search</label>
<input id="content__search-input" type="text" ng-model="customSearch" ng-keydown="doSearchOnEnter($event)"/>
<div class="search-submit__wrapper">
- <button class="clear-input" ng-click="customSearch = ''">✕</button>
+ <button class="clear-input" ng-click="clear()">✕</button>
<input id="content__search-submit" type="submit" class="btn btn-primary content__search-submit" value="Filter" ng-click="doSearchOnClick()"/>
</div>
diff --git a/app/server-health/controllers/sensors-overview-controller.js b/app/server-health/controllers/sensors-overview-controller.js
index 90616b1..57e3b65 100644
--- a/app/server-health/controllers/sensors-overview-controller.js
+++ b/app/server-health/controllers/sensors-overview-controller.js
@@ -41,6 +41,11 @@
return JSON.stringify(dt);
};
+ $scope.clear = function(){
+ $scope.customSearch = "";
+ $scope.searchTerms = [];
+ }
+
$scope.doSearchOnEnter = function (event) {
var search = $scope.customSearch.replace(/^\s+/g,'').replace(/\s+$/g,'');
if (event.keyCode === 13 &&