Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #16326: Display compliance bar in Node details #2693

Conversation

ElaadF
Copy link
Member

@ElaadF ElaadF commented Jan 2, 2020

@ElaadF ElaadF force-pushed the ust_16326/display_compliance_bar_in_node_details branch 2 times, most recently from 2752c62 to fd8b56b Compare January 3, 2020 09:15
node <- nodeInfo
t <- asyncComplianceService.nodeCompliance(node.id)
} yield {
ComplianceLevelSerialisation.ComplianceLevelToJs(t(node.id).get).toJsArray()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

never use get !! this thows exception ! in fact your service should return a Box[ComplianceLevel], not the Map[NodeId,Option[ComplianceLevel]]

Also don't do t(node.id), it's also a get and it throws exception !!

@@ -468,6 +485,7 @@ object DisplayNode extends Loggable {

<div class="status-info col-lg-6 col-sm-5 col-xs-12">
<h3>Status information</h3>
<div id={s"compliance-bar-${nodeInfo.get.id.value}"}></div>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here you should have a class "node-compliance-bar" and define all the css done below in a css file targeting that class

@ElaadF ElaadF force-pushed the ust_16326/display_compliance_bar_in_node_details branch from fd8b56b to 60d35c0 Compare January 3, 2020 16:23
val node = new NodeCompliance(Set(nodeId), Set())
node.computeCompliance match {
case Full(contentMap) =>
contentMap.values.head match {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

head throws exception too, especially if this is empty

You shoud should do

contentMap.get(nodeId) match 
  case Some(Some(compiance)) => Full(Compliance)
  case _ =>

@ElaadF ElaadF force-pushed the ust_16326/display_compliance_bar_in_node_details branch from 60d35c0 to 0b71933 Compare January 7, 2020 10:47
VinceMacBuche
VinceMacBuche previously approved these changes Jan 7, 2020
@ElaadF ElaadF force-pushed the ust_16326/display_compliance_bar_in_node_details branch from 0b71933 to 1a2ae0a Compare January 7, 2020 11:27
@Normation-Quality-Assistant
Copy link
Contributor

OK, merging this PR

@Normation-Quality-Assistant Normation-Quality-Assistant merged commit 1a2ae0a into Normation:branches/rudder/6.0 Jan 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants