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 13, 2017
1 parent cbee93e commit f1f8ba6
Show file tree
Hide file tree
Showing 7 changed files with 126 additions and 56 deletions.
Expand Up @@ -110,15 +110,16 @@ object DisplayDirectiveTree extends Loggable {

private[this] val localOnClickDirective = onClickDirective.map( _.curried(category) )

private[this] val tooltipId = Helpers.nextFuncName
private[this] val tooltipContent = s"""
<h4>${category.name}</h4>
<div class="tooltip-content">
<p>${category.description}</p>
</div>
"""
private[this] val xml = (
<span class="treeActiveTechniqueCategoryName tooltipable" tooltipid={tooltipId} title="">
<span class="treeActiveTechniqueCategoryName bsTooltip" data-toggle="tooltip" data-placement="top" data-html="true" title={tooltipContent}>
{Text(category.name)}
</span>
<div class="tooltipContent" id={tooltipId}>
<h3>{category.name}</h3>
<div>{category.description}</div>
</div>
)

override def body = onClickCategory match {
Expand Down Expand Up @@ -160,7 +161,7 @@ object DisplayDirectiveTree extends Loggable {
private[this] val localOnClickDirective = onClickDirective.map( f => f(activeTechnique) )

override val attrs = (
("data-jstree" -> s"""{ "type" : "template" , "state" : { "disabled" : ${ !activeTechnique.isEnabled} } }""") :: Nil
("data-jstree" -> s"""{ "type" : "template" , "state" : { "disabled" : ${ !activeTechnique.isEnabled} } }""") :: ("class" -> "techniqueNode" ) :: Nil
)

override def children = {
Expand All @@ -177,18 +178,18 @@ object DisplayDirectiveTree extends Loggable {
}

override def body = {
val tooltipId = Helpers.nextFuncName

//display information (name, etc) relative to last technique version

val xml = activeTechnique.newestAvailableTechnique match {
case Some(technique) =>
<span class="treeActiveTechniqueName tooltipable" tooltipid={tooltipId} title="">{technique.name}
</span>
<div class="tooltipContent" id={tooltipId}>
<h3>{technique.name}</h3>
<div>{technique.description}</div>
</div>
val tooltipContent = s"""
<h4>${technique.name}</h4>
<div class="tooltip-content">
<p>${technique.description}</p>
</div>
"""
<span class="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 Down Expand Up @@ -216,7 +217,7 @@ object DisplayDirectiveTree extends Loggable {
val classes = {
val includedClass = if (included.contains(directive.id)) {"included"} else ""
val disabled = if(directive.isEnabled) "" else "disableTreeNode"
s"${disabled} ${includedClass}"
s"${disabled} ${includedClass} directiveNode"
}
val htmlId = s"jsTree-${directive.id.value}"
val directiveTags = JsObj(directive.tags.map(tag => (tag.name.value, Str(tag.value.value))).toList:_*)
Expand All @@ -228,12 +229,11 @@ object DisplayDirectiveTree extends Loggable {
)

override def body = {

val editButton = {
if (addEditLink && ! directive.isSystem) {
val tooltipId = Helpers.nextFuncName
<span class="treeActions">
<span class="tooltipable treeAction noRight directiveDetails fa fa-pencil" tooltipid={tooltipId} title="" onclick={redirectToDirectiveLink(directive.id).toJsCmd}> </span>
<span class="tooltipable treeAction noRight directiveDetails fa fa-pencil" tooltipid={tooltipId} title="" onclick={redirectToDirectiveLink(directive.id).toJsCmd}> </span>
<div class="tooltipContent" id={tooltipId}><div>Configure this Directive.</div></div>
</span>
} else {
Expand Down Expand Up @@ -264,27 +264,34 @@ object DisplayDirectiveTree extends Loggable {
}

val tooltipId = Helpers.nextFuncName
<span class="treeDirective tooltipable" tooltipid={tooltipId} title="" ><span id={"badge-apm-"+tooltipId}>[BADGE]</span>[{directive.techniqueVersion.toString}] {directive.name}
val tooltipContent = s"""
<h4>${scala.xml.Utility.escape(directive.name)}</h4>
<div class="tooltip-content">
<p>${scala.xml.Utility.escape(directive.shortDescription)}</p>
<div><b>Technique version:</b> ${directive.techniqueVersion.toString}</div>
<div>Used in <b>${isAssignedTo}</b> rule${if(isAssignedTo!=1){"s"}else{""}}</div>
${ if(!directive.isEnabled){ <div>Disable</div> }else{NodeSeq.Empty}}
</div>
"""
<span id={"badge-apm-"+tooltipId}>[BADGE]</span>
<span class="treeDirective bsTooltip" data-toggle="tooltip" data-placement="top" data-html="true" title={tooltipContent}>
<span class="techversion">{directive.techniqueVersion.toString}</span>
{directive.name}
</span> ++
deprecated ++
<span>
{

if(isAssignedTo <= 0) {
<span style="padding-left:5px" class="fa fa-warning text-warning-rudder"></span>
} else {
NodeSeq.Empty
}
if(isAssignedTo <= 0) {
<span style="padding-left:5px" class="fa fa-warning text-warning-rudder"></span>
} else {
NodeSeq.Empty
}
}
</span> ++
Script(JsRaw(s"""$$('#badge-apm-${tooltipId}').replaceWith(createBadgeAgentPolicyMode('directive',"${policyMode}", "${explanation.toString()}"))""")) ++
deprecated ++
</span> ++
editButton ++
<div class="tooltipContent" id={tooltipId}>
<h3>{directive.name}</h3>
<div>{directive.shortDescription}</div>
<div>Technique version: {directive.techniqueVersion.toString}</div>
<div>{s"Used in ${isAssignedTo} rules" }</div>
{ if(!directive.isEnabled) <div>Disable</div> }
</div>

Script(JsRaw(s"""
$$('#badge-apm-${tooltipId}').replaceWith(createBadgeAgentPolicyMode('directive',"${policyMode}", "${explanation.toString()}"))""")
)
}

onClickDirective match {
Expand All @@ -295,13 +302,15 @@ object DisplayDirectiveTree extends Loggable {
}
}

displayCategory(directiveLib, "jstn_0").toXml ++ Script(OnLoad(JsRaw("""
var scopeElmnt = '#directiveFilter'
S.appendJs(JsRaw("""
var scopeElmnt = '#directiveFilter';
if(!angular.element(scopeElmnt).scope()){
angular.bootstrap(scopeElmnt, ['filters']);
}
adjustHeight('#activeTechniquesTree');
""")))
$(".bsTooltip").bsTooltip({container: '#boxDirectiveTree'})
"""))
directiveLib.subCategories.filterNot(_.isSystem).sortBy( _.name ).flatMap { cat => displayCategory(cat, cat.id.value).toXml }
}

}
Expand Up @@ -224,10 +224,9 @@ object DisplayNodeGroupTree extends Loggable {
case Some(f) => SHtml.a( () => f(targetInfo), xml)
}
}

}

displayCategory(groupLib).toXml
groupLib.subCategories.sortBy( _.name ).flatMap { cat => displayCategory(cat).toXml }
}

//build the tree category, filtering only category with groups
Expand Down
Expand Up @@ -39,7 +39,7 @@

<div class="tw-bs no-background">
<div class="row col-small-padding">
<div class="col-xs-12 col-lg-3 col-md-4">
<div class="col-xs-12 col-sm-30">
<div class="box">
<div class="box-header with-border">
<h3 class="box-title"><i class="fa fa-filter" aria-hidden="true"></i>Filters</h3>
Expand Down Expand Up @@ -122,11 +122,11 @@ <h3 class="box-title"><i class="fa fa-filter" aria-hidden="true"></i>Filters</h3
</div>
</div>
<div class="box" id="boxDirectiveTree">
<div class="box-header with-border">
<div class="box-header with-border spacing">
<h3 class="box-title"><i class="fa fa-list" aria-hidden="true"></i>Directive library</h3>
<div class="box-tools pull-right">
<lift:authz role="technique_write">
<a class="new-icon btn btn-success btn-sm tech" href="/secure/utilities/techniqueEditor">Edit Techniques</a>
<a class="new-icon btn btn-success btn-sm tech" href="/secure/utilities/techniqueEditor"></a>
</lift:authz>
<button class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-chevron-down"></i></button>
</div>
Expand All @@ -144,7 +144,7 @@ <h3 class="box-title"><i class="fa fa-list" aria-hidden="true"></i>Directive lib
</div>
</div>

<div id="directiveDetails" class="col-xs-12 col-lg-9 col-md-8">
<div id="directiveDetails" class="col-xs-12 col-sm-70">
<div data-lift="configuration.DirectiveManagement.techniqueDetails">
<div id="techniqueDetails" ng-app="techniqueDetails">
<div class="box">
Expand Down
41 changes: 41 additions & 0 deletions rudder-web/src/main/webapp/style/rudder/rudder-directives.css
Expand Up @@ -70,6 +70,7 @@
overflow-y:auto;
overflow-x:hidden;
}

#directiveRulesTab {
margin-top: 20px;
}
Expand Down Expand Up @@ -117,4 +118,44 @@
}
.version-group select.form-control{
margin-right:5px;
}
.new-icon.tech:before{
content:"Edit techniques";
}
.tw-bs .btn.btn-box-tool{
padding-left:2px;
padding-right:2px;
}
.new-icon.tech + .btn.btn-box-tool > .fa{
margin-left:0;
}
@media (min-width: 991px) and (max-width: 1300px){
.new-icon.tech:before{
content:"Edit";
position:relative;
left:2px;
}
.new-icon.tech:after{
content:"";
}
}
.directiveNode > a.jstree-anchor, .techniqueNode > a.jstree-anchor {
position:relative;
padding-left:20px !important;
}
.directiveNode > a.jstree-anchor > i.fa-file-text, .techniqueNode > a.jstree-anchor > i.fa-gear{
position:absolute;
left:0;
}

span.techversion {
font-weight: 300;
color: #777;
font-size: 10px;
}
.directiveNode .rudder-label + .tooltip{
margin-left:40px;
}
.directiveNode .rudder-label + .tooltip .tooltip-arrow{
margin-left: -45px;
}
39 changes: 30 additions & 9 deletions rudder-web/src/main/webapp/style/rudder/rudder-menu.css
Expand Up @@ -55,6 +55,16 @@
padding-right:7px;
}

@media (min-width: 992px){
.tw-bs .col-sm-30 {
width: 30%;
}
.tw-bs .col-sm-70 {
width: 70%;
padding: 0 0 0 15px;
}
}

/*LOGO RUDDER*/
header.main-header .logo-mini img{
width:35px;
Expand Down Expand Up @@ -420,7 +430,7 @@ a.sidebar-toggle{

.rudder_col {
background-color: rgb(236, 240, 245);
padding: 15px 15px 10px;
padding: 15px;
}
.content-wrapper {
height: auto;
Expand Down Expand Up @@ -1192,7 +1202,7 @@ table > tbody > tr > td.action{
font-weight: bold !important;
}
label.text-fit{
font-weight:normal !important;
font-weight:normal !important;
}
/* --- LABEL --- */
#badge-apm{
Expand Down Expand Up @@ -1277,12 +1287,16 @@ form .tooltip-content p {
.tw-bs .jstree-container-ul .rudder-label.label-sm,.dataTable .rudder-label.label-sm{
padding: 0 !important;
min-width: 45px !important;
margin-right: 6px;
margin-right: -1px;
margin-left: 0;
position: relative;
top: -2px;
top: -1px;
height: 18px;
line-height: 18px;
font-style:normal !important;
font-style: normal !important;
}
.dataTable .rudder-label.label-sm{
margin-right:5px;
}
#nodeDetails .rudder-label{
position: relative;
Expand Down Expand Up @@ -2366,15 +2380,22 @@ h3.box-title {
color: #999;
margin-right:10px;
}
.box-header.with-border.spacing{
padding:3px 10px;
}
.box-header.with-border.spacing .box-title{
min-height: 34px;
display: inline-block;
line-height: 34px;
}
.box-header.with-border.spacing >.box-tools {
position: static;
}
.box-tools > .btn-xs {
position:relative;
top:-2px;
max-height: 21px;
}
.box-tools > .btn.tech{
position: relative;
top: -2px;
}
.box-tools > .btn-sm.btn-box-tool > .fa {
font-size: 14px;
}
Expand Down
2 changes: 1 addition & 1 deletion rudder-web/src/main/webapp/style/rudder/rudder-tags.css
Expand Up @@ -71,7 +71,7 @@
overflow-y: auto;
overflow-x: hidden;
margin: 0 -10px;
padding: 0 30px 0 15px;
padding: 0 20px 0 5px;
width: calc(100% + 20px);
}
.filterTag .panel-default{
Expand Down
2 changes: 1 addition & 1 deletion rudder-web/src/main/webapp/style/rudder/rudder.css
Expand Up @@ -2146,7 +2146,7 @@ div.topQuickSearchResults.ac_results {
color: #555
}

span.treeDirective.tooltipable {
span.treeDirective.tooltipable,span.treeDirective.bsTooltip {
color: #555;
font-weight: 600;
}
Expand Down

0 comments on commit f1f8ba6

Please sign in to comment.