Added the AppraisalStatus message for a failure tagged into a Platform

Certificate.  It will display on the details page as a tool tip on a red
component.  However it is not refined. [no ci]
This commit is contained in:
Cyrus 2023-03-30 20:21:49 -04:00
parent e7b0f5396d
commit 5f3be5915b
5 changed files with 53 additions and 1 deletions

View File

@ -781,6 +781,7 @@ public class SupplyChainValidationServiceImpl implements SupplyChainValidationSe
case FAIL:
if (!result.getAdditionalInfo().isEmpty()) {
pc.setComponentFailures(result.getAdditionalInfo());
pc.setComponentFailureMessage(result.getMessage());
this.certificateManager.update(pc);
}
return buildValidationRecord(validationType, AppraisalStatus.Status.FAIL,
@ -817,6 +818,7 @@ public class SupplyChainValidationServiceImpl implements SupplyChainValidationSe
case FAIL:
if (!result.getAdditionalInfo().isEmpty()) {
base.setComponentFailures(result.getAdditionalInfo());
base.setComponentFailureMessage(result.getMessage());
this.certificateManager.update(base);
}
// we are adding things to componentFailures

View File

@ -373,6 +373,7 @@ public final class CertificateStringMapBuilder {
if (!certificate.getComponentFailures().isEmpty()) {
data.put("failures", certificate.getComponentFailures());
data.put("failureMessages", certificate.getComponentFailureMessage());
}
//Get platform Configuration values and set map with it

View File

@ -619,7 +619,8 @@
<div class="panel panel-default">
<c:choose>
<c:when test="${fn:contains(initialData.failures, combined)}">
<div class="panel-heading" style="background-color: red; color: white">
<div class="tooltip" style="background-color: red; color: white">
<span class="tooltiptext">
</c:when>
<c:otherwise>
<div class="panel-heading">
@ -633,6 +634,9 @@
<span data-toggle="tooltip" data-placement="top" title="Component Class">Platform Components</span>
</c:otherwise>
</c:choose>
<c:when test="${fn:contains(initialData.failures, combined)}">
</span>
</c:when>
</div>
<div class="panel-body">
<span class="fieldHeader">Manufacturer:</span>

View File

@ -64,3 +64,30 @@
cursor: pointer;
border-radius: 2px;
}
/* Tooltip container */
.tooltip {
position: relative;
display: inline-block;
border-bottom: 1px dotted black; /* If you want dots under the hoverable text */
}
/* Tooltip text */
.tooltip .tooltiptext {
visibility: hidden;
width: 120px;
background-color: black;
color: #fff;
text-align: center;
padding: 5px 0;
border-radius: 6px;
/* Position the tooltip text - see examples below! */
position: absolute;
z-index: 1;
}
/* Show the tooltip text when you mouse over the tooltip container */
.tooltip:hover .tooltiptext {
visibility: visible;
}

View File

@ -255,6 +255,8 @@ public class PlatformCredential extends DeviceAssociatedCertificate {
@Column(length = MAX_MESSAGE_LENGTH)
private String componentFailures = Strings.EMPTY;
@Column(length = MAX_MESSAGE_LENGTH)
private String componentFailureMessage = Strings.EMPTY;
@Transient
private EndorsementCredential endorsementCredential = null;
@ -736,6 +738,22 @@ public class PlatformCredential extends DeviceAssociatedCertificate {
this.componentFailures = componentFailures;
}
/**
* Getter for the component failures message.
* @return string of failures.
*/
public String getComponentFailureMessage() {
return componentFailureMessage;
}
/**
* Setter for the component failure message instance.
* @param componentFailureMessage a string of failures.
*/
public void setComponentFailureMessage(final String componentFailureMessage) {
this.componentFailureMessage = componentFailureMessage;
}
/**
* Get the Platform Configuration Attribute from the Platform Certificate.
* @return a map with all the attributes