summaryrefslogtreecommitdiffstats
path: root/app/common/services
diff options
context:
space:
mode:
authorYoshie Muranaka <yoshiemuranaka@gmail.com>2019-07-18 15:36:39 -0500
committerGunnar Mills <gmills@us.ibm.com>2019-07-29 16:28:38 +0000
commit5ff98780e0a9c3987447a83782f1409dd3d11f02 (patch)
treed916710f88a45e054a1374f0f14336a83feb23d6 /app/common/services
parentae0353989abe7d9194dba47ca26d803fe11f46b6 (diff)
downloadphosphor-webui-5ff98780e0a9c3987447a83782f1409dd3d11f02.tar.gz
phosphor-webui-5ff98780e0a9c3987447a83782f1409dd3d11f02.zip
Refactor power operations
Refactored power operations to use checkHostStatus function that checks host_status property provided by dataService, instead of polling for host/chassis status. Added property to check when a power operation is in progress. This property will show/hide the in progress message and make other operations unavailable until the operation completes. We were previously checking whether the server_state property was set to 'Unreachable', which enables the Power on button in the middle of a reboot, since the server_state changes to 'Off' during reboot. - Removed unused $timeout service Signed-off-by: Yoshie Muranaka <yoshiemuranaka@gmail.com> Change-Id: I234749a9a875c7370b52bd23ed74d6e9617cf5e2
Diffstat (limited to 'app/common/services')
-rw-r--r--app/common/services/api-utils.js21
-rw-r--r--app/common/services/constants.js9
2 files changed, 0 insertions, 30 deletions
diff --git a/app/common/services/api-utils.js b/app/common/services/api-utils.js
index 5a28294..0b1aa46 100644
--- a/app/common/services/api-utils.js
+++ b/app/common/services/api-utils.js
@@ -26,31 +26,10 @@ window.angular && (function(angular) {
var SERVICE = {
API_CREDENTIALS: Constants.API_CREDENTIALS,
API_RESPONSE: Constants.API_RESPONSE,
- CHASSIS_POWER_STATE: Constants.CHASSIS_POWER_STATE,
HOST_STATE_TEXT: Constants.HOST_STATE,
LED_STATE: Constants.LED_STATE,
LED_STATE_TEXT: Constants.LED_STATE_TEXT,
HOST_SESSION_STORAGE_KEY: Constants.API_CREDENTIALS.host_storage_key,
- getChassisState: function() {
- var deferred = $q.defer();
- $http({
- method: 'GET',
- url: DataService.getHost() +
- '/xyz/openbmc_project/state/chassis0/attr/CurrentPowerState',
- withCredentials: true
- })
- .then(
- function(response) {
- var json = JSON.stringify(response.data);
- var content = JSON.parse(json);
- deferred.resolve(content.data);
- },
- function(error) {
- console.log(error);
- deferred.reject(error);
- });
- return deferred.promise;
- },
validIPV4IP: function(ip) {
// Checks for [0-255].[0-255].[0-255].[0-255]
return ip.match(
diff --git a/app/common/services/constants.js b/app/common/services/constants.js
index dabbc77..ae82e76 100644
--- a/app/common/services/constants.js
+++ b/app/common/services/constants.js
@@ -31,12 +31,6 @@ window.angular && (function(angular) {
'location': '/redfish/v1/AccountService/LDAP/Certificates'
}
],
- CHASSIS_POWER_STATE: {
- on: 'On',
- on_code: 'xyz.openbmc_project.State.Chassis.PowerState.On',
- off: 'Off',
- off_code: 'xyz.openbmc_project.State.Chassis.PowerState.Off'
- },
HOST_STATE_TEXT: {
on: 'Running',
on_code: 'xyz.openbmc_project.State.Host.HostState.Running',
@@ -104,15 +98,12 @@ window.angular && (function(angular) {
TIMEOUT: {
ACTIVATION: 1000 * 60 * 10, // 10 mins
DOWNLOAD_IMAGE: 1000 * 60 * 2, // 2 mins
- CHASSIS_OFF: 1000 * 60 * 5, // 5 mins
HOST_ON: 1000 * 60 * 5, // 5 mins
HOST_OFF: 1000 * 60 * 5, // 5 mins
HOST_OFF_IMMEDIATE: 1000 * 60 * 2 // 2 mins
},
MESSAGES: {
POLL: {
- CHASSIS_OFF_TIMEOUT:
- 'Time out. Chassis did not reach power off state in allotted time.',
HOST_ON_TIMEOUT:
'Time out. System did not reach Running state in allotted time.',
HOST_OFF_TIMEOUT:
OpenPOWER on IntegriCloud