From 902c38ca3432e57884b6662404d1c68098ea1cef Mon Sep 17 00:00:00 2001 From: Gunnar Mills Date: Fri, 23 Feb 2018 10:12:39 -0600 Subject: Add additional "Image States" Added the following Activation States or as they are known on the GUI, "Image States": "NotReady", "Invalid", "Activating", and "Failed". Instead of having a variable for each state, these "Image States" are now tracked under one variable. Also, moved to looking at the value of "Activation", github.com/openbmc/phosphor-dbus-interfaces/blob/master/xyz/openbmc_project/Software/Activation.interface.yaml#L17, so if more states are added in the future they will be picked up. Resolves openbmc/openbmc#2928 Tested: Verified when I activated an image I see the "Activating" state. Change-Id: I1f5e408ebe31f3eb6c3f0417d6605bff06c9ac19 Signed-off-by: Gunnar Mills --- app/common/directives/firmware-list.html | 16 +++++++--------- app/common/services/api-utils.js | 25 ++++++++++++------------- 2 files changed, 19 insertions(+), 22 deletions(-) diff --git a/app/common/directives/firmware-list.html b/app/common/directives/firmware-list.html index c53a417..0be4625 100644 --- a/app/common/directives/firmware-list.html +++ b/app/common/directives/firmware-list.html @@ -21,23 +21,21 @@
-
+
Boot priority:
Image state: - Functional - Active - Ready + {{firmware.activationStatus}}
Version:{{firmware.Version}} @@ -59,10 +57,10 @@
Action: - - + +
- \ No newline at end of file + diff --git a/app/common/services/api-utils.js b/app/common/services/api-utils.js index 9b619bd..6268f8c 100644 --- a/app/common/services/api-utils.js +++ b/app/common/services/api-utils.js @@ -608,10 +608,7 @@ window.angular && (function (angular) { var json = JSON.stringify(response.data); var content = JSON.parse(json); var data = []; - var active = false; - var functional = false; - var ready = false; - var activationStatus = {active: false, ready: false, functional: false}; + var activationStatus = ""; var isExtended = false; var bmcActiveVersion = ""; var hostActiveVersion = ""; @@ -646,11 +643,14 @@ window.angular && (function (angular) { for(var key in content.data){ if(content.data.hasOwnProperty(key) && content.data[key].hasOwnProperty('Version')){ - - functional = (content.data[key].Priority == 0); - active = !functional && (/\.Active$/).test(content.data[key].Activation); - ready = (/\.Ready$/).test(content.data[key].Activation); - activationStatus = {functional: functional, active: active, ready: ready}; + // If the image is "Functional" use that for the + // activation status, else use the value of "Activation" + // github.com/openbmc/phosphor-dbus-interfaces/blob/master/xyz/openbmc_project/Software/Activation.interface.yaml + activationStatus = content.data[key].Activation.split(".").pop(); + if (content.data[key].Priority == 0) + { + activationStatus = "Functional"; + } imageType = content.data[key].Purpose.split(".").pop(); isExtended = content.data[key].hasOwnProperty('ExtendedVersion') && content.data[key].ExtendedVersion != ""; if(isExtended){ @@ -658,8 +658,7 @@ window.angular && (function (angular) { } data.push(Object.assign({ path: key, - functional: functional, - activationFlags: activationStatus, + activationStatus: activationStatus, imageId: key.split("/").pop(), imageType: imageType, isExtended: isExtended, @@ -670,11 +669,11 @@ window.angular && (function (angular) { data: {key: key, value: content.data[key]} }, content.data[key])); - if(functional && imageType == 'BMC'){ + if(activationStatus == 'Functional' && imageType == 'BMC'){ bmcActiveVersion = content.data[key].Version; } - if(functional && imageType == 'Host'){ + if(activationStatus == 'Functional' && imageType == 'Host'){ hostActiveVersion = content.data[key].Version; } } -- cgit v1.2.1