diff options
Diffstat (limited to 'meta-openbmc-mods/meta-common/recipes-phosphor/webui')
2 files changed, 79 insertions, 102 deletions
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/webui/phosphor-webui/0004-Implement-force-boot-to-bios-in-server-power-control.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/webui/phosphor-webui/0004-Implement-force-boot-to-bios-in-server-power-control.patch index 0e2d400a3..3885318de 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/webui/phosphor-webui/0004-Implement-force-boot-to-bios-in-server-power-control.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/webui/phosphor-webui/0004-Implement-force-boot-to-bios-in-server-power-control.patch @@ -1,105 +1,70 @@ -From a4f948f98e9bfd8b019699b4e23281448f7b7313 Mon Sep 17 00:00:00 2001 +From 5a6e97bdca6db517eabb94a926623e2f662b1315 Mon Sep 17 00:00:00 2001 From: Kuiying Wang <kuiying.wang@intel.com> -Date: Wed, 27 Mar 2019 19:35:12 +0800 -Subject: [PATCH] Implement force to BIOS +Date: Thu, 1 Aug 2019 17:37:17 +0800 +Subject: [PATCH] force to bios fix bump fail -UI page review use below link: -https://projects.invisionapp.com/share/UER87D98GPM#/screens - -Tested: - Switch on "Boot To BIOS", could enter BIOS setup page directly - when power on system. - -Change-Id: Ib46dc5d84df51d31cc5ff8635fa0c0f52de0e194 Signed-off-by: Kuiying Wang <kuiying.wang@intel.com> --- - app/common/services/api-utils.js | 49 +++++++++++++++++++ - app/common/services/constants.js | 4 ++ - app/common/services/dataService.js | 1 + - .../power-operations-controller.html | 12 +++++ - .../power-operations-controller.js | 32 ++++++++++++ - 5 files changed, 98 insertions(+) + app/common/services/api-utils.js | 30 ++++++++++++++++++ + app/common/services/constants.js | 4 +++ + app/common/services/dataService.js | 1 + + .../controllers/power-operations-controller.html | 11 +++++++ + .../controllers/power-operations-controller.js | 36 ++++++++++++++++++++-- + 5 files changed, 80 insertions(+), 2 deletions(-) diff --git a/app/common/services/api-utils.js b/app/common/services/api-utils.js -index 840db8e..193c172 100644 +index d485016..3d64406 100644 --- a/app/common/services/api-utils.js +++ b/app/common/services/api-utils.js -@@ -31,6 +31,7 @@ window.angular && (function(angular) { - HOST_STATE: Constants.HOST_STATE, +@@ -29,12 +29,42 @@ window.angular && (function(angular) { + HOST_STATE_TEXT: Constants.HOST_STATE, LED_STATE: Constants.LED_STATE, LED_STATE_TEXT: Constants.LED_STATE_TEXT, + FORCE_TO_BIOS_STATE_TEXT: Constants.FORCE_TO_BIOS_STATE_TEXT, HOST_SESSION_STORAGE_KEY: Constants.API_CREDENTIALS.host_storage_key, - getChassisState: function() { - var deferred = $q.defer(); -@@ -451,6 +452,32 @@ window.angular && (function(angular) { - }); - return deferred.promise; + validIPV4IP: function(ip) { + // Checks for [0-255].[0-255].[0-255].[0-255] + return ip.match( + /\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b/); }, ++ setForceToBIOSState: function(state) { ++ console.log(state); ++ var data = JSON.stringify({'Boot': ++ { ++ 'BootSourceOverrideTarget': state ++ } ++ }); ++ return $http({ ++ method: 'PATCH', ++ url: DataService.getHost() + '/redfish/v1/Systems/system', ++ withCredentials: true, ++ data: data ++ }); ++ }, + getForceToBIOSState: function() { -+ var deferred = $q.defer(); + -+ if (DataService.configJson.redfishSupportEnabled == true) { -+ $http({ -+ method: 'GET', -+ url: -+ DataService.getHost() + '/redfish/v1/Systems/system', -+ withCredentials: true -+ }).then( -+ function(response) { -+ var json = JSON.stringify(response.data); -+ var content = JSON.parse(json); -+ deferred.resolve(content.Boot.BootSourceOverrideTarget); -+ }, -+ function(error) { -+ console.log(error); -+ deferred.reject(error); -+ }); -+ } else { -+ var err = "Redfish is not enabled!"; -+ console.log(err); -+ deferred.reject(err); -+ } -+ return deferred.promise; -+ }, - login: function(username, password, callback) { - $http({ - method: 'POST', -@@ -872,6 +899,28 @@ window.angular && (function(angular) { - } - }); - }, -+ setForceToBIOSState: function(state) { -+ if (DataService.configJson.redfishSupportEnabled == true) { -+ var data = JSON.stringify({'Boot': -+ { -+ 'BootSourceOverrideTarget': state -+ } -+ }); -+ return $http({ -+ method: 'PATCH', -+ url: -+ DataService.getHost() + '/redfish/v1/Systems/system', -+ withCredentials: true, -+ data: data -+ }); -+ } else { -+ var deferred = $q.defer(); -+ var err = "Redfish is not enabled!"; -+ console.log(err); -+ deferred.reject(err); -+ return deferred.promise; -+ } ++ return $http({ ++ method: 'GET', ++ url: DataService.getHost() + '/redfish/v1/Systems/system', ++ withCredentials: true ++ }).then( ++ function(response) { ++ console.log(JSON.stringify(response.data.Boot.BootSourceOverrideTarget)); ++ return response.data.Boot.BootSourceOverrideTarget; ++ }, ++ function(error) { ++ console.log(error); ++ }); + }, - getLastRebootTime: function() { + getRedfishSysName: function() { return $http({ method: 'GET', diff --git a/app/common/services/constants.js b/app/common/services/constants.js -index 9931f01..8da0b12 100644 +index ae82e76..e594570 100644 --- a/app/common/services/constants.js +++ b/app/common/services/constants.js -@@ -38,6 +38,10 @@ window.angular && (function(angular) { - HOST_STATE: {on: 1, off: -1, error: 0, unreachable: -2}, +@@ -42,6 +42,10 @@ window.angular && (function(angular) { + }, LED_STATE: {on: true, off: false}, LED_STATE_TEXT: {on: 'on', off: 'off'}, + FORCE_TO_BIOS_STATE_TEXT: { @@ -110,22 +75,22 @@ index 9931f01..8da0b12 100644 Emergency: 'High', Alert: 'High', diff --git a/app/common/services/dataService.js b/app/common/services/dataService.js -index 76ab381..bcd7142 100644 +index 87fddba..cc9c0b3 100644 --- a/app/common/services/dataService.js +++ b/app/common/services/dataService.js -@@ -18,6 +18,7 @@ window.angular && (function(angular) { - this.server_status = -2; - this.chassis_state = 'On'; +@@ -16,6 +16,7 @@ window.angular && (function(angular) { + this.server_health = Constants.SERVER_HEALTH.unknown; + this.server_state = 'Unreachable'; this.LED_state = Constants.LED_STATE_TEXT.off; + this.ForceToBIOS_state = Constants.FORCE_TO_BIOS_STATE_TEXT.off; this.last_updated = new Date(); this.loading = false; diff --git a/app/server-control/controllers/power-operations-controller.html b/app/server-control/controllers/power-operations-controller.html -index 3dc69d2..1f00f4a 100644 +index ddf8bda..ea46e00 100644 --- a/app/server-control/controllers/power-operations-controller.html +++ b/app/server-control/controllers/power-operations-controller.html -@@ -10,6 +10,18 @@ +@@ -10,6 +10,17 @@ <div class="row column"> <div id="power-indicator-bar" class="power__indicator-bar" ng-class="{'power__state-on': dataService.server_state == 'Running', 'power__state-off': dataService.server_state == 'Off', 'power__state-indet': dataService.server_state == 'Standby', 'power__state-error': dataService.server_state == 'Quiesced'}"> <p class="inline">{{dataService.hostname}} - {{dataService.server_id}}</p> @@ -140,18 +105,30 @@ index 3dc69d2..1f00f4a 100644 + <label for="toggle__switch-round" tabindex="0"> </label> + <h3 class="inline">Boot to BIOS</h3> + </div> -+ <h3 class="power__state inline no-margin h3"><span>{{dataService.server_state | quiescedToError}}</span></h3> </div> </div> diff --git a/app/server-control/controllers/power-operations-controller.js b/app/server-control/controllers/power-operations-controller.js -index 1a1f355..9a832e8 100644 +index 986ac3b..2c29093 100644 --- a/app/server-control/controllers/power-operations-controller.js +++ b/app/server-control/controllers/power-operations-controller.js -@@ -26,6 +26,17 @@ window.angular && (function(angular) { +@@ -10,10 +10,10 @@ window.angular && (function(angular) { + 'use strict'; - var pollChassisStatusTimer = undefined; - var pollStartTime = null; + angular.module('app.serverControl').controller('powerOperationsController', [ +- '$scope', 'APIUtils', 'dataService', 'Constants', '$interval', '$q', ++ '$route', '$scope', 'APIUtils', 'dataService', 'Constants', '$interval', '$q', + 'toastService', + function( +- $scope, APIUtils, dataService, Constants, $interval, $q, toastService) { ++ $route, $scope, APIUtils, dataService, Constants, $interval, $q, toastService) { + $scope.dataService = dataService; + // Is a || of the other 4 "confirm" variables to ensure only + // one confirm is shown at a time. +@@ -57,6 +57,17 @@ window.angular && (function(angular) { + }, Constants.POLL_INTERVALS.POWER_OP); + return deferred.promise; + }; + APIUtils.getForceToBIOSState().then( + function(data) { + if (data == APIUtils.FORCE_TO_BIOS_STATE_TEXT.on) { @@ -164,11 +141,11 @@ index 1a1f355..9a832e8 100644 + console.log(JSON.stringify(error)); + }); - //@TODO: call api and get proper state - -@@ -50,6 +61,27 @@ window.angular && (function(angular) { - (dataService.server_state == 'Running') ? 'Off' : 'Running'; - }; + APIUtils.getLastPowerTime() + .then( +@@ -74,6 +85,27 @@ window.angular && (function(angular) { + $scope.loading = false; + }); + $scope.toggleForceToBIOS = function() { + var toggleState = @@ -191,9 +168,9 @@ index 1a1f355..9a832e8 100644 + }) + }; + - $scope.powerOn = function() { - $scope.loading = true; - dataService.setUnreachableState(); + $scope.toggleState = function() { + dataService.server_state = + (dataService.server_state == 'Running') ? 'Off' : 'Running'; -- -2.19.1 +2.7.4 diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/webui/phosphor-webui_%.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/webui/phosphor-webui_%.bbappend index 97270e982..5f18206c8 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/webui/phosphor-webui_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/webui/phosphor-webui_%.bbappend @@ -1,6 +1,6 @@ FILESEXTRAPATHS_append := ":${THISDIR}/${PN}" #SRC_URI = "git://github.com/openbmc/phosphor-webui.git" -SRCREV = "ae0353989abe7d9194dba47ca26d803fe11f46b6" +SRCREV = "30d7c6377f70382088436c7a4830663eb522d588" SRC_URI += "file://0004-Implement-force-boot-to-bios-in-server-power-control.patch" |