Added search clear functionality to filtering
Change-Id: Id22b067c8bcc0e05aee6325153154ea7a81f17ae
Signed-off-by: Iftekharul Islam <iislam@us.ibm.com>
diff --git a/app/common/directives/log-search-control.html b/app/common/directives/log-search-control.html
index 0e4136e..5d2246c 100644
--- a/app/common/directives/log-search-control.html
+++ b/app/common/directives/log-search-control.html
@@ -3,7 +3,7 @@
<label for="content__search-input">Event Log 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>
</div>
\ No newline at end of file
diff --git a/app/common/directives/log-search-control.js b/app/common/directives/log-search-control.js
index 1fa268c..b198f2d 100644
--- a/app/common/directives/log-search-control.js
+++ b/app/common/directives/log-search-control.js
@@ -22,6 +22,11 @@
}
};
+ $scope.clear = function(){
+ $scope.customSearch = "";
+ $scope.clearSearchItem();
+ }
+
$scope.doSearchOnClick = function() {
var search = $scope.customSearch.replace(/^\s+/g,'').replace(/\s+$/g,'');
if (search.length >= 2) {
diff --git a/app/common/services/api-utils.js b/app/common/services/api-utils.js
index 4eb5e06..408e42f 100644
--- a/app/common/services/api-utils.js
+++ b/app/common/services/api-utils.js
@@ -55,6 +55,45 @@
console.log(error);
});
},
+ getNetworkInfo: function(){
+ var deferred = $q.defer();
+ $http({
+ method: 'GET',
+ url: SERVICE.API_CREDENTIALS.host + "/xyz/openbmc_project/network/enumerate",
+ headers: {
+ 'Accept': 'application/json',
+ 'Content-Type': 'application/json'
+ },
+ withCredentials: true
+ }).success(function(response){
+ var json = JSON.stringify(response);
+ var content = JSON.parse(json);
+ var hostname = "";
+ var macAddress = "";
+
+ if(content.data.hasOwnProperty('/xyz/openbmc_project/network/config') &&
+ content.data['/xyz/openbmc_project/network/config'].hasOwnProperty('HostName')
+ ){
+ hostname = content.data['/xyz/openbmc_project/network/config'].HostName;
+ }
+
+ if(content.data.hasOwnProperty('/xyz/openbmc_project/network/eth0') &&
+ content.data['/xyz/openbmc_project/network/eth0'].hasOwnProperty('MACAddress')
+ ){
+ macAddress = content.data['/xyz/openbmc_project/network/eth0'].MACAddress;
+ }
+
+ deferred.resolve({
+ data: content.data,
+ hostname: hostname,
+ mac_address: macAddress,
+ });
+ }).error(function(error){
+ console.log(error);
+ deferred.reject(error);
+ });
+ return deferred.promise;
+ },
getLEDState: function(){
var deferred = $q.defer();
$http({
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 &&