Skip to content

Commit

Permalink
Work in progress
Browse files Browse the repository at this point in the history
  • Loading branch information
RaphaelGauthier committed Dec 26, 2016
1 parent 3b84a19 commit b4526d8
Show file tree
Hide file tree
Showing 16 changed files with 976 additions and 98 deletions.
Expand Up @@ -276,6 +276,7 @@ class DirectiveEditForm(
</a> &
"#techniqueDescription *" #> technique.description &
"#nameField" #> {piName.toForm_!} &
"#tagField *" #> tagsEditForm.cfTagsDirectiveConfiguration &
"#rudderID *" #> {directive.id.value} &
"#shortDescriptionField" #> piShortDescription.toForm_! &
"#longDescriptionField" #> piLongDescription.toForm_! &
Expand Down Expand Up @@ -423,6 +424,8 @@ class DirectiveEditForm(
override def subContainerClassName = "col-xs-12"
}

def tagsEditForm = new TagsEditForm()

def showDeprecatedVersion (version : TechniqueVersion) = {
val deprecationInfo = fullActiveTechnique.techniques(version).deprecrationInfo match {
case Some(_) => "(deprecated)"
Expand Down
Expand Up @@ -97,12 +97,13 @@ class RuleCompliance (
private[this] val getAllNodeInfos = RudderConfig.nodeInfoService.getAll _

import RuleCompliance._

def tagsEditForm = new TagsEditForm()
def display : NodeSeq = {

(
"#ruleName" #> rule.name &
"#ruleCategory" #> categoryService.shortFqdn(rootRuleCategory, rule.categoryId) &
"#tagField *" #> tagsEditForm.cfTagsRuleConfiguration &
"#rudderID" #> rule.id.value &
"#ruleShortDescription" #> rule.shortDescription &
"#ruleLongDescription" #> rule.longDescription &
Expand Down
Expand Up @@ -260,8 +260,8 @@ class RuleGrid(
logger.warn(fail.messageChain)
(true, Some(fail.msg))
}
val onLoad =
s"""createRuleTable (
val onLoad = s"""
createRuleTable (
"${htmlId_rulesGridId}"
, ${tableData.json.toJsCmd}
, ${showCheckboxColumn}
Expand All @@ -275,13 +275,70 @@ class RuleGrid(
);
createTooltip();
createTooltiptr();
$$('#${htmlId_rulesGridWrapper}').css("margin","10px 0px 0px 0px");
angular.bootstrap('#showFiltersRules', ['filters']);
"""
<div id={htmlId_rulesGridZone}>
<span class="error" id="ruleTableError">{errorProperty.getOrElse("")}</span>
<div id={htmlId_modalReportsPopup} class="nodisplay">
<div id={htmlId_reportsPopup} ></div>
</div>
<div id="showFiltersRules" ng-controller="filterTagRuleCtrl" class="filters tw-bs" ng-cloak="">
<div class="filters-container">
<form class="filterTag">
<div class="panel-group" role="tablist" aria-multiselectable="true">
<div class="panel panel-default">
<div class="panel-heading" role="tab" id="headingOne">
<h4 class="panel-title">
<a role="button" href="#form-tag" ng-click="toggleFilter($event,'#activeTechniquesTree')" aria-expanded="true" aria-controls="form-tag">
Filters
<i id="help-tag" class="fa fa-question-circle"></i>
<span class="glyphicon glyphicon-chevron-down pull-right"></span>
</a>
</h4>
</div>
<div id="form-tag" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingOne">
<div class="panel-body">
<div class="form-group">
<label>Search</label>
<input type="text" class="form-control" ng-model="strSearch" ng-keyup="filterGlobal(strSearch)"/>
</div>
<div class="form-group">
<label>Tags</label>
<div class="input-group">
<input placeholder="key" class="form-control input-sm input-key " type="text" ng-model="newTag.key"/>
<span class="input-group-addon addon-json">=</span>
<input placeholder="value" class="form-control input-sm input-value" type="text" ng-model="newTag.value"/>
<span class="input-group-btn">
<button type="button" ng-click="addTag('#activeTechniquesTree')" class="btn btn-success btn-sm" ng-disabled=" (isEmptyOrBlank(newTag.key) && isEmptyOrBlank(newTag.value)); ">
<span class="fa fa-plus"></span>
</button>
</span>
</div>
</div>
<div class="only-tags">
<a href="" ng-click="onlyAll($event)" class="all" ng-class="{'active': getOnlyAllValue() }" > All </a>
<span class="separator">/</span>
<a href="" ng-click="onlyKey($event)" class="key" ng-class="{'active':only.key}"> Filter keys only </a>
<span class="separator">/</span>
<a href="" ng-click="onlyValue($event)" class="value" ng-class="{'active':only.value}"> Filter values only </a>
</div>
</div>
</div>
<div class="panel-footer">
<div class="tags-container" ng-show="tags.length>0">
<span class="rudder-tag" ng-repeat="tag in tags" ng-class="{'onlyKey':only.key, 'onlyValue':only.value, 'already-exist':tag.alreadyExist}">
<span class="tag-key" ng-bind="tag.key"></span>
<span class="tag-separator">=</span>
<span class="tag-value" ng-bind="tag.value"></span>
<span class="fa fa-times" ng-click="removeTag($index, '#activeTechniquesTree')"></span>
</span>
</div>
</div>
</div>
</div>
</form>
</div>
</div>
<table id={htmlId_rulesGridId} class="display" cellspacing="0"> </table>
<div class={htmlId_rulesGridId +"_pagination, paginatescala"} >
<div id={htmlId_rulesGridId +"_paginate_area"}></div>
Expand Down Expand Up @@ -640,6 +697,8 @@ class RuleGrid(
val t5 = System.currentTimeMillis
TimingDebugLogger.trace(s"Rule grid: transforming into data: get rule data: callback: ${t5-t4}ms")

val tags = """[{"key":"environment","value":"production"},{"key":"customer","value":"Acme prod"}]"""

RuleLine (
line.rule.name
, line.rule.id
Expand All @@ -653,6 +712,7 @@ class RuleGrid(
, reasons
, policyMode
, explanation
, tags
)
}
}
Expand Down Expand Up @@ -687,6 +747,7 @@ case class RuleLine (
, reasons : Option[String]
, policyMode : String
, explanation : String
, tags : String
) extends JsTableLine {

/* Would love to have a reflexive way to generate that map ... */
Expand All @@ -710,6 +771,7 @@ case class RuleLine (
, ( "trClass", trClass )
, ( "policyMode", policyMode )
, ( "explanation", explanation )
, ( "tags", tags)
)

base +* JsObj(optFields:_*)
Expand Down
Expand Up @@ -218,7 +218,7 @@ object DisplayDirectiveTree extends Loggable {
}
val htmlId = s"jsTree-${directive.id.value}"
override val attrs = (
("data-jstree" -> """{ "type" : "directive" }""") ::
("data-jstree" -> """{"type":"directive", "tags":[{"key":"environment", "value":"production"},{"key":"customer", "value":"Acme corp"}]}""") ::
( "id" -> htmlId) ::
("class" -> classes ) ::
Nil
Expand All @@ -231,8 +231,8 @@ object DisplayDirectiveTree extends Loggable {
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>
<div class="tooltipContent" id={tooltipId}><div>Configure this Directive.</div></div>
</span>
<div class="tooltipContent" id={tooltipId}><div>Configure this Directive.</div></div>
</span>
} else {
NodeSeq.Empty
}
Expand Down Expand Up @@ -280,7 +280,7 @@ object DisplayDirectiveTree extends Loggable {
<div>Technique version: {directive.techniqueVersion.toString}</div>
<div>{s"Used in ${isAssignedTo} rules" }</div>
{ if(!directive.isEnabled) <div>Disable</div> }
</div>
</div>

}

Expand All @@ -292,7 +292,7 @@ object DisplayDirectiveTree extends Loggable {
}
}

displayCategory(directiveLib, "jstn_0").toXml
displayCategory(directiveLib, "jstn_0").toXml ++ Script(OnLoad(JsRaw("angular.bootstrap('#activeTechniquesTree_actions_zone', ['filters']);")))
}

}

0 comments on commit b4526d8

Please sign in to comment.