summaryrefslogtreecommitdiffstats
path: root/app/common/services
diff options
context:
space:
mode:
authorGunnar Mills <gmills@us.ibm.com>2018-06-26 16:08:59 -0500
committerGunnar Mills <gmills@us.ibm.com>2018-08-24 21:00:32 +0000
commit006aaa0fd3df33f4029b5a19b1c5d712f72b9296 (patch)
tree30b00b9646bb8c2442931406da1e7256cffe714a /app/common/services
parentb817e07afb677d48851d8408a1b9d23091f0c429 (diff)
downloadphosphor-webui-006aaa0fd3df33f4029b5a19b1c5d712f72b9296.tar.gz
phosphor-webui-006aaa0fd3df33f4029b5a19b1c5d712f72b9296.zip
Set the power cap
Created toggle button to enable power cap and a text field to set it. This form is similar to the set network form. Moved logic for displaying the power cap as disabled to the overview controller. Resolves openbmc/openbmc#3221 Tested: Set the power cap on a Witherspoon Change-Id: I62346fe3ed123b9df58d159cee2584937d46213c Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
Diffstat (limited to 'app/common/services')
-rw-r--r--app/common/services/api-utils.js39
1 files changed, 33 insertions, 6 deletions
diff --git a/app/common/services/api-utils.js b/app/common/services/api-utils.js
index a1fad8a..042dde4 100644
--- a/app/common/services/api-utils.js
+++ b/app/common/services/api-utils.js
@@ -1388,12 +1388,39 @@ window.angular && (function(angular) {
withCredentials: true
})
.then(function(response) {
- var json = JSON.stringify(response.data);
- var content = JSON.parse(json);
-
- return (false == content.data.PowerCapEnable) ?
- Constants.POWER_CAP_TEXT.disabled :
- content.data.PowerCap + ' ' + Constants.POWER_CAP_TEXT.unit;
+ return response.data;
+ });
+ },
+ setPowerCapEnable: function(powerCapEnable) {
+ return $http({
+ method: 'PUT',
+ url: DataService.getHost() +
+ '/xyz/openbmc_project/control/host0/power_cap/attr/PowerCapEnable',
+ headers: {
+ 'Accept': 'application/json',
+ 'Content-Type': 'application/json'
+ },
+ withCredentials: true,
+ data: JSON.stringify({'data': powerCapEnable})
+ })
+ .then(function(response) {
+ return response.data;
+ });
+ },
+ setPowerCap: function(powerCap) {
+ return $http({
+ method: 'PUT',
+ url: DataService.getHost() +
+ '/xyz/openbmc_project/control/host0/power_cap/attr/PowerCap',
+ headers: {
+ 'Accept': 'application/json',
+ 'Content-Type': 'application/json'
+ },
+ withCredentials: true,
+ data: JSON.stringify({'data': powerCap})
+ })
+ .then(function(response) {
+ return response.data;
});
},
setHostname: function(hostname) {
OpenPOWER on IntegriCloud