Skip to content

Commit

Permalink
Work in progress
Browse files Browse the repository at this point in the history
  • Loading branch information
RaphaelGauthier committed Mar 15, 2017
1 parent 47b4cee commit 3af9aba
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ object DisplayDirectiveTree extends Loggable {
category.activeTechniques
// We only want to keep technique that satifies keepTechnque, that are not systems
// and that have at least one version not deprecated (deprecationInfo empty)
.filter( at => keepTechnique(at) && !at.isSystem && at.techniques.values.exists { _.deprecrationInfo.isEmpty })
.filter( at => keepTechnique(at) && !at.isSystem && ( at.directives.length > 0 || at.techniques.values.exists { _.deprecrationInfo.isEmpty }))
// We want our technique sorty by human name, default to bundle name in case we don't have any version but that should not happen
.sortBy( at => at.newestAvailableTechnique.map(_.name).getOrElse(at.techniqueName.value ))
.map ( at => displayActiveTechnique(at, localOnClickTechnique, localOnClickDirective) )
Expand All @@ -160,6 +160,10 @@ object DisplayDirectiveTree extends Loggable {

private[this] val localOnClickDirective = onClickDirective.map( f => f(activeTechnique) )

def isDeprecated = {
activeTechnique.techniques.values.forall { t => t.deprecrationInfo.isDefined }
}

override val attrs = (
("data-jstree" -> s"""{ "type" : "template" , "state" : { "disabled" : ${ !activeTechnique.isEnabled} } }""") :: ("class" -> "techniqueNode" ) :: Nil
)
Expand All @@ -173,6 +177,7 @@ object DisplayDirectiveTree extends Loggable {
x
, activeTechnique.techniques.get(x.techniqueVersion)
, localOnClickDirective
, activeTechnique
)
}
}
Expand All @@ -187,7 +192,7 @@ object DisplayDirectiveTree extends Loggable {
<p>${technique.description}</p>
</div>
"""
<span class="treeActiveTechniqueName bsTooltip" data-toggle="tooltip" data-placement="top" data-html="true" title={tooltipContent}>{technique.name}</span>
<span class={if(isDeprecated){"treeActiveTechniqueName isDeprecated bsTooltip"}else{"treeActiveTechniqueName bsTooltip"}} data-toggle="tooltip" data-placement="top" data-html="true" title={tooltipContent}>{technique.name}</span>

case None =>
<span class="error">The technique with id ''{activeTechnique.techniqueName}'' is missing from repository</span>
Expand All @@ -205,6 +210,7 @@ object DisplayDirectiveTree extends Loggable {
directive : Directive
, technique : Option[Technique]
, onClickDirective : Option[Directive => JsCmd]
, activeTechnique : FullActiveTechnique
) : JsTreeNode = new JsTreeNode {

private[this] val configService = RudderConfig.configService
Expand Down Expand Up @@ -244,13 +250,15 @@ object DisplayDirectiveTree extends Loggable {
}
}

val (isDeprecated,deprecationInfo,deprecatedIcon) = technique.flatMap(_.deprecrationInfo) match {
case Some(info) =>
/* def isDeprecated = {
activeTechnique.techniques.values.forall { t => t.deprecrationInfo.isDefined }
}
*/ (true, info.message,{<i class="ion ion-arrow-up-a deprecation-icon"></i>})
case None => (false, "", {NodeSeq.Empty})
val (isDeprecated,deprecationInfo,deprecatedIcon) =

if (activeTechnique.techniques.values.forall { t => t.deprecrationInfo.isDefined }) {
(true, technique.flatMap(_.deprecrationInfo).get.message,{<i class="fa fa-ban deprecation-icon"></i>})
} else {
technique.flatMap(_.deprecrationInfo) match {
case Some(info) => (true, info.message,{<i class="ion ion-arrow-up-a deprecation-icon"></i>})
case None => (false, "", {NodeSeq.Empty})
}
}

val xml = {
Expand All @@ -274,7 +282,7 @@ object DisplayDirectiveTree extends Loggable {
<div>
<b>Technique version:</b>
${directive.techniqueVersion.toString}${deprecatedIcon}
${if(isDeprecated){<p><b style="margin-left:8px;">↳ Deprecated:</b>{deprecationInfo}</p>}else{NodeSeq.Empty}}
${if(isDeprecated){<p><b style="margin-left:8px;">↳ Deprecated: </b>{deprecationInfo}</p>}else{NodeSeq.Empty}}
</div>
${if(!directive.isEnabled){ <div>Disable</div>} else{NodeSeq.Empty}}
${if(isAssignedTo==0){<span class="fa fa-warning text-warning-rudder min-size-icon"></span>}else{NodeSeq.Empty}}<span>Used in <b>${isAssignedTo}</b> rule${if(isAssignedTo!=1){"s"}else{""}}</span>
Expand Down
47 changes: 29 additions & 18 deletions rudder-web/src/main/webapp/style/rudder/rudder-menu.css
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,16 @@ header.main-header .logo-lg img{
white-space: pre-line;
word-break: break-word;
}
.legend-square {
width : 10px;
height : 10px;
margin: 5px;
float:left;
}
.legend {
white-space: nowrap;
overflow : hidden;
}
/* - JSON - */
tbody.toggle-color{
border-left:1px solid #c3c3c3;
Expand Down Expand Up @@ -1223,8 +1233,8 @@ label.text-fit{
padding: 0 !important;
color: #222D32;
text-align: left !important;
width: 280px;
max-width: 280px;
width: 360px;
max-width: 360px;
font-size: 12px;
box-shadow: 0px 0px 5px rgba(0, 0, 0, .12);
border-radius: 0px;
Expand Down Expand Up @@ -2455,13 +2465,26 @@ h3.box-title {
position: relative;
margin-right: -2px;
}
img.deprecation-icon{
height:14px;
color:initial;
}
.ui-tooltip-content{
color:#555;
color:#555;
}
.tooltip-content .deprecation-icon{
.tooltip-content .deprecation-icon,.{
left:0;
}

.deprecation-icon.fa-ban{
left:-1px;
top: -1px;
}
.tooltip-content .deprecation-icon.fa-ban{
left: 2px;
}
.treeActiveTechniqueName.isDeprecated{
text-decoration:line-through;
}
@keyframes opacity-1 {
0% {opacity:0;visibility: visible;}
100% {opacity:1;visibility: visible;}
Expand Down Expand Up @@ -2578,16 +2601,4 @@ h3.box-title {
0% {visibility:visible;}
1% {visibility:hidden;}
100% {visibility:hidden;}
}

.legend-square {
width : 10px;
height : 10px;
margin: 5px;
float:left;
}

.legend {
white-space: nowrap;
overflow : hidden;
}
}

0 comments on commit 3af9aba

Please sign in to comment.