JS updates for gui functions
Change-Id: I115cfedb540ed159284cacbcca30d599465db94a
Signed-off-by: Michael Davis <michael.s.davis@ibm.com>
diff --git a/app/common/directives/log-filter.js b/app/common/directives/log-filter.js
index b760308..c9ac1d0 100644
--- a/app/common/directives/log-filter.js
+++ b/app/common/directives/log-filter.js
@@ -24,6 +24,13 @@
$scope.toggleSeverity = function(severity){
$scope.selectedSeverity[severity] = !$scope.selectedSeverity[severity];
+ if(['high', 'medium', 'low'].indexOf(severity) > -1){
+ if($scope.selectedSeverity[severity] == false){
+ $scope.selectedSeverity.all = true;
+ return;
+ }
+ }
+
if($scope.selectedSeverity.low &&
$scope.selectedSeverity.medium &&
$scope.selectedSeverity.high){
diff --git a/app/common/filters/index.js b/app/common/filters/index.js
index d1b4b44..26323fe 100644
--- a/app/common/filters/index.js
+++ b/app/common/filters/index.js
@@ -2,6 +2,14 @@
'use strict';
angular
- .module('app.common.filters', []);
+ .module('app.common.filters', [])
+ .filter('unResolvedCount', function () {
+ return function (data) {
+ data = data.filter(function(item){
+ return item.Resolved == 0;
+ });
+ return data.length;
+ }
+ });
})(window.angular);
diff --git a/app/common/services/api-utils.js b/app/common/services/api-utils.js
index 0f3b729..4eb5e06 100644
--- a/app/common/services/api-utils.js
+++ b/app/common/services/api-utils.js
@@ -55,7 +55,8 @@
console.log(error);
});
},
- getLEDState: function(callback){
+ getLEDState: function(){
+ var deferred = $q.defer();
$http({
method: 'GET',
url: SERVICE.API_CREDENTIALS.host + "/xyz/openbmc_project/led/groups/enclosure_identify",
@@ -65,16 +66,14 @@
},
withCredentials: true
}).success(function(response){
- var json = JSON.stringify(response);
- var content = JSON.parse(json);
- if(callback){
- callback(content.data.Asserted);
- }else{
- return content.data.Asserted;
- }
+ var json = JSON.stringify(response);
+ var content = JSON.parse(json);
+ deferred.resolve(content.data.Asserted);
}).error(function(error){
console.log(error);
+ deferred.reject(error);
});
+ return deferred.promise;
},
login: function(username, password, callback){
$http({
@@ -314,7 +313,8 @@
}
});
},
- getLogs: function(callback){
+ getLogs: function(){
+ var deferred = $q.defer();
$http({
method: 'GET',
url: SERVICE.API_CREDENTIALS.host + "/xyz/openbmc_project/logging/enumerate",
@@ -359,14 +359,13 @@
}, content.data[key]));
}
}
- if(callback){
- callback(data, dataClone);
- }else{
- return data;
- }
+ deferred.resolve({data: data, original: dataClone});
}).error(function(error){
console.log(error);
+ deferred.reject(error);
});
+
+ return deferred.promise;
},
getAllSensorStatus: function(callback){
$http({
@@ -473,10 +472,10 @@
console.log(error);
});
},
- getFirmwares: function(callback){
+ getFirmwares: function(){
+ var deferred = $q.defer();
$http({
method: 'GET',
- //url: SERVICE.API_CREDENTIALS.mock_host + "/software",
url: SERVICE.API_CREDENTIALS.host + "/xyz/openbmc_project/software/enumerate",
headers: {
'Accept': 'application/json',
@@ -550,14 +549,18 @@
}
}
}
- if(callback){
- callback(data, bmcActiveVersion, hostActiveVersion);
- }else{
- return(data, bmcActiveVersion, hostActiveVersion);
- }
+
+ deferred.resolve({
+ data: data,
+ bmcActiveVersion: bmcActiveVersion,
+ hostActiveVersion: hostActiveVersion
+ });
}).error(function(error){
console.log(error);
+ deferred.reject(error);
});
+
+ return deferred.promise;
},
uploadImage: function(file, callback){
$http({
@@ -585,7 +588,8 @@
}
});
},
- getBMCEthernetInfo: function(callback){
+ getBMCEthernetInfo: function(){
+ var deferred = $q.defer();
$http({
method: 'GET',
url: SERVICE.API_CREDENTIALS.host + "/xyz/openbmc_project/inventory/system/chassis/motherboard/boxelder/bmc/ethernet",
@@ -595,18 +599,18 @@
},
withCredentials: true
}).success(function(response){
- var json = JSON.stringify(response);
- var content = JSON.parse(json);
- if(callback){
- callback(content.data);
- }else{
- return content.data;
- }
+ var json = JSON.stringify(response);
+ var content = JSON.parse(json);
+ deferred.resolve(content.data);
}).error(function(error){
console.log(error);
+ deferred.reject(error);
});
+
+ return deferred.promise;
},
getBMCInfo: function(callback){
+ var deferred = $q.defer();
$http({
method: 'GET',
url: SERVICE.API_CREDENTIALS.host + "/xyz/openbmc_project/inventory/system/chassis/motherboard/boxelder/bmc",
@@ -616,16 +620,14 @@
},
withCredentials: true
}).success(function(response){
- var json = JSON.stringify(response);
- var content = JSON.parse(json);
- if(callback){
- callback(content.data);
- }else{
- return content.data;
- }
+ var json = JSON.stringify(response);
+ var content = JSON.parse(json);
+ deferred.resolve(content.data);
}).error(function(error){
console.log(error);
+ deferred.reject(error);
});
+ return deferred.promise;
},
getHardwares: function(callback){
$http({
diff --git a/app/common/services/constants.js b/app/common/services/constants.js
index a610ba9..d51ee18 100644
--- a/app/common/services/constants.js
+++ b/app/common/services/constants.js
@@ -20,7 +20,7 @@
password: "testpass",
},
API_CREDENTIALS: {
- host: 'https://9.3.181.15',
+ host: 'https://9.3.185.164',
mock_host: 'http://localhost:3000'
},
API_RESPONSE: {
diff --git a/app/configuration/controllers/firmware-controller.js b/app/configuration/controllers/firmware-controller.js
index 2bdfced..66c4297 100644
--- a/app/configuration/controllers/firmware-controller.js
+++ b/app/configuration/controllers/firmware-controller.js
@@ -112,10 +112,10 @@
};
$scope.loadFirmwares = function(){
- APIUtils.getFirmwares(function(data, bmcActiveVersion, hostActiveVersion){
- $scope.firmwares = data;
- $scope.bmcActiveVersion = bmcActiveVersion;
- $scope.hostActiveVersion = hostActiveVersion;
+ APIUtils.getFirmwares().then(function(result){
+ $scope.firmwares = result.data;
+ $scope.bmcActiveVersion = result.bmcActiveVersion;
+ $scope.hostActiveVersion = result.hostActiveVersion;
});
}
diff --git a/app/server-health/index.js b/app/server-health/index.js
index 6d00879..3c32065 100644
--- a/app/server-health/index.js
+++ b/app/server-health/index.js
@@ -23,6 +23,11 @@
'controller': 'logController',
authenticated: true
})
+ .when('/server-health/event-log/:type', {
+ 'templateUrl': 'server-health/controllers/log-controller.html',
+ 'controller': 'logController',
+ authenticated: true
+ })
.when('/server-health/inventory-overview', {
'templateUrl': 'server-health/controllers/inventory-overview-controller.html',
'controller': 'inventoryOverviewController',