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 #16578: Node details show properties in each pages #2726

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ import JsCmds._
import JE._
import com.normation.rudder.web.ChooseTemplate

import scala.xml.NodeSeq

class AgentPolicyModeEditForm extends DispatchSnippet with Loggable {

// Html template
def agentPolicyModeTemplate = ChooseTemplate(
def agentPolicyModeTemplate: NodeSeq = ChooseTemplate(
List("templates-hidden", "components", "ComponentAgentPolicyMode")
, "agentpolicymode-form"
)
Expand All @@ -19,7 +21,7 @@ class AgentPolicyModeEditForm extends DispatchSnippet with Loggable {
case "cfagentPolicyModeConfiguration" => (xml) => cfagentPolicyModeConfiguration
}

def cfagentPolicyModeConfiguration = {
def cfagentPolicyModeConfiguration: NodeSeq = {
agentPolicyModeTemplate ++ Script(OnLoad(JsRaw("angular.bootstrap('#auditMode', ['auditmode']);")))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ package com.normation.rudder.web.components

import net.liftweb.http.DispatchSnippet
import net.liftweb.common._
import net.liftweb.http.{SHtml,S}
import net.liftweb.http.{S, SHtml}
import net.liftweb.http.DispatchSnippet
import net.liftweb.http.js._
import JsCmds._
Expand All @@ -48,6 +48,8 @@ import net.liftweb.util.Helpers._
import com.normation.rudder.reports.AgentRunInterval
import com.normation.rudder.web.ChooseTemplate

import scala.xml.NodeSeq

/**
* Component to display and configure the Agent Schedule
*/
Expand All @@ -59,7 +61,7 @@ class AgentScheduleEditForm(
) extends DispatchSnippet with Loggable {

// Html template
def agentScheduleTemplate = ChooseTemplate(
def agentScheduleTemplate: NodeSeq = ChooseTemplate(
List("templates-hidden", "components", "ComponentAgentSchedule")
, "schedule-agentschedule"
)
Expand Down Expand Up @@ -129,7 +131,7 @@ class AgentScheduleEditForm(
}
}

def cfagentScheduleConfiguration = {
def cfagentScheduleConfiguration: NodeSeq = {

val transform = (for {
schedule <- getConfigureCallback().map(_.json)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ package com.normation.rudder.web.components

import net.liftweb.http.DispatchSnippet
import net.liftweb.common._
import net.liftweb.http.{SHtml,S}
import net.liftweb.http.{S, SHtml}
import net.liftweb.http.DispatchSnippet
import net.liftweb.http.js._
import JsCmds._
Expand All @@ -55,6 +55,8 @@ import com.normation.rudder.reports.GlobalComplianceMode
import com.normation.rudder.reports.NodeComplianceMode
import com.normation.rudder.web.ChooseTemplate

import scala.xml.NodeSeq

/**
* Component to display and configure the compliance Mode (and it's heartbeat)
*/
Expand Down Expand Up @@ -142,7 +144,7 @@ class ComplianceModeEditForm [T <: ComplianceMode] (
) (implicit p: ParseComplianceMode[T]) extends DispatchSnippet with Loggable {

// Html template
def complianceModeTemplate = ChooseTemplate(
def complianceModeTemplate: NodeSeq = ChooseTemplate(
List("templates-hidden", "components", "ComponentComplianceMode")
, "property-compliancemode"
)
Expand Down Expand Up @@ -197,7 +199,7 @@ class ComplianceModeEditForm [T <: ComplianceMode] (
compactRender(json)
}

def complianceModeConfiguration = {
def complianceModeConfiguration: NodeSeq = {

val transform = (for {
complianceMode <- getConfigureCallback
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ object PendingChangeRequestDisplayer extends Loggable{
xml : NodeSeq
, id : T
, check : checkFunction[T]
) = {
): NodeSeq = {
if (RudderConfig.configService.rudder_workflow_enabled().toBox.getOrElse(false)) {
val crs = check(id,true)
displayPendingChangeRequest(xml,crs)
Expand All @@ -106,15 +106,15 @@ object PendingChangeRequestDisplayer extends Loggable{
}
}

def checkByRule(xml:NodeSeq,ruleId:RuleId) = {
def checkByRule(xml:NodeSeq,ruleId:RuleId): NodeSeq = {
checkChangeRequest(xml,ruleId,workflowLevel.getByRule)
}

def checkByGroup(xml:NodeSeq,groupId:NodeGroupId) = {
def checkByGroup(xml:NodeSeq,groupId:NodeGroupId): NodeSeq = {
checkChangeRequest(xml,groupId,workflowLevel.getByNodeGroup)
}

def checkByDirective(xml:NodeSeq,directiveId:DirectiveId) = {
def checkByDirective(xml:NodeSeq,directiveId:DirectiveId): NodeSeq = {
checkChangeRequest(xml,directiveId,workflowLevel.getByDirective)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ import com.normation.box._
import com.normation.errors._

object RuleCompliance {
private def details = ChooseTemplate(
private def details: NodeSeq = ChooseTemplate(
"templates-hidden" :: "components" :: "ComponentRuleEditForm" :: Nil
, "component-details"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ class RuleDisplayer (
, ("id","includeCheckbox")
)
}
def actionButtonCategory =
def actionButtonCategory: NodeSeq =
if (directive.isEmpty) {
SHtml.ajaxButton("", () => showCategoryPopup(None), ("class" -> "new-icon category btn btn-success btn-outline btn-sm"))
} else {
Expand Down Expand Up @@ -173,7 +173,7 @@ class RuleDisplayer (
}
}

def actionButtonRule = {
def actionButtonRule: NodeSeq = {
if (directive.isDefined) {
NodeSeq.Empty
} else {
Expand Down Expand Up @@ -343,7 +343,7 @@ class RuleDisplayer (
}
}

def ruleCreationPopup (ruleToClone:Option[Rule]) = {
def ruleCreationPopup (ruleToClone:Option[Rule]): NodeSeq = {
ruleCategoryTree match {
case Full(ruleCategoryTree) =>
val root = ruleCategoryTree.getRoot
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,12 @@ object RuleEditForm {
, "component-staticinit"
)

private def body = ChooseTemplate(
private def body: NodeSeq = ChooseTemplate(
"templates-hidden" :: "components" :: "ComponentRuleEditForm" :: Nil
, "component-body"
)

private def crForm = ChooseTemplate(
private def crForm: NodeSeq = ChooseTemplate(
"templates-hidden" :: "components" :: "ComponentRuleEditForm" :: Nil
, "component-form"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ class RuleGrid(
case FromConfig => configService.display_changes_graph.toBox.openOr(true)
})

def reportTemplate = ChooseTemplate(
def reportTemplate: NodeSeq = ChooseTemplate(
List("templates-hidden", "reports_grid")
, "reports-report"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,12 @@ class SearchNodeComponent(
private[this] val queryProcessor = RudderConfig.acceptedNodeQueryProcessor

// The portlet for the server detail
private[this] def searchNodes = ChooseTemplate(
private[this] def searchNodes: NodeSeq = ChooseTemplate(
List("templates-hidden", "server", "server_details")
, "query-searchnodes"
)

private[this] def queryline = {
private[this] def queryline: NodeSeq = {
<tr class="error"></tr>
<tr class="query_line">
<td class="first objectType"></td>
Expand Down Expand Up @@ -239,7 +239,7 @@ class SearchNodeComponent(
* Caution, we pass an html different at the init part (whole content-query)
*
*/
def displayQuery(html: NodeSeq) = {
def displayQuery(html: NodeSeq): NodeSeq = {
val Query(otName,comp, criteria) = query.get
val checkBox = {
SHtml.checkbox(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ object ShowNodeDetailsFromNode {

private val groupTreeId = "node_groupTree"

private def serverDetailsTemplate = ChooseTemplate(
private def serverDetailsTemplate: NodeSeq = ChooseTemplate(
List("templates-hidden", "server", "server_details")
, "detail-server"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,20 @@ import com.normation.rudder.domain.policies.JsonTagSerialisation
import com.normation.rudder.repository.json.DataExtractor.CompleteJson
import com.normation.rudder.web.ChooseTemplate

import scala.xml.NodeSeq

class TagsEditForm(tags : Tags) extends Loggable {

val templatePath = List("templates-hidden", "components", "ComponentTags")
def tagsTemplate = ChooseTemplate(templatePath, "tags-form")
def tagsTemplate: NodeSeq = ChooseTemplate(templatePath, "tags-form")

def editTagsTemplate = ChooseTemplate(templatePath, "tags-editform")
def editTagsTemplate: NodeSeq = ChooseTemplate(templatePath, "tags-editform")

val jsTags = JsonTagSerialisation.serializeTags(tags)

def parseResult(s : String) : Box[Tags] = CompleteJson.unserializeTags(s)

def tagsForm(controllerId:String, appId : String, update : Box[Tags] => Unit, isRule : Boolean) = {
def tagsForm(controllerId:String, appId : String, update : Box[Tags] => Unit, isRule : Boolean): NodeSeq = {

val valueInput = SHtml.textarea("", {s => update(parseResult(s))}, ("ng-model","result"), ("ng-hide", "true") )
val css: CssSel =
Expand All @@ -33,11 +35,11 @@ class TagsEditForm(tags : Tags) extends Loggable {
css(tagTemplate(controllerId, appId, true,isRule))
}

def viewTags(controllerId:String, appId : String, isRule : Boolean) = {
def viewTags(controllerId:String, appId : String, isRule : Boolean): NodeSeq = {
tagTemplate(controllerId, appId, false, isRule)
}

private[this] def tagTemplate(controllerId:String, appId : String, isEditForm : Boolean, isRule : Boolean) = {
private[this] def tagTemplate(controllerId:String, appId : String, isEditForm : Boolean, isRule : Boolean): NodeSeq = {

val filterId = if (isRule) {
"showFiltersRules"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,13 @@ object TechniqueEditForm {
*/
def staticInit:NodeSeq = ChooseTemplate(componentTechniqueEditForm, "component-staticinit")

private def body = ChooseTemplate(componentTechniqueEditForm, "component-body")
private def body: NodeSeq = ChooseTemplate(componentTechniqueEditForm, "component-body")

private def popupRemoveForm = ChooseTemplate(componentTechniqueEditForm, "component-popupremoveform")
private def popupRemoveForm: NodeSeq = ChooseTemplate(componentTechniqueEditForm, "component-popupremoveform")

private def popupDisactivateForm = ChooseTemplate(componentTechniqueEditForm, "component-popupdisableform")
private def popupDisactivateForm: NodeSeq = ChooseTemplate(componentTechniqueEditForm, "component-popupdisableform")

private def crForm = ChooseTemplate(componentTechniqueEditForm, "component-form")
private def crForm: NodeSeq = ChooseTemplate(componentTechniqueEditForm, "component-form")

val htmlId_techniqueConf = "techniqueConfiguration"
val htmlId_addPopup = "addPopup"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class CreateActiveTechniqueCategoryPopup(onSuccessCallback : () => JsCmd = { ()
) extends DispatchSnippet with Loggable {

// Load the template from the popup
def popupTemplate = ChooseTemplate(
def popupTemplate: NodeSeq = ChooseTemplate(
"templates-hidden" :: "Popup" :: "createActiveTechniqueCategory" :: Nil
, "technique-createcategorypopup"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class CreateCategoryOrGroupPopup(
) extends DispatchSnippet with Loggable {

// Load the template from the popup
def popupTemplate = ChooseTemplate(
def popupTemplate: NodeSeq = ChooseTemplate(
List("templates-hidden", "Popup", "createCategoryOrGroup")
, "groups-creategrouppopup"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class CreateCloneGroupPopup(
)(popupTemplate) )
}

def popupTemplate = ChooseTemplate(
def popupTemplate: NodeSeq = ChooseTemplate(
List("templates-hidden", "Popup", "createCloneGroupPopup")
, "groups-createclonegrouppopup"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ class CreateOrUpdateGlobalParameterPopup(

private[this] def error(msg:String) = Text(msg)

def popupContent() = {
def popupContent(): NodeSeq = {
val (buttonName, classForButton) = workflowEnabled match {
case true =>
("Open Request", "wideButton btn-primary")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,13 @@ class CreateOrCloneRulePopup(

// Load the template from the popup
def templatePath = List("templates-hidden", "Popup", "createRule")
def template() = Templates(templatePath) match {
def template(): NodeSeq = Templates(templatePath) match {
case Empty | Failure(_,_,_) =>
error("Template for creation popup not found. I was looking for %s.html".format(templatePath.mkString("/")))
case Full(n) => n
}

def popupTemplate = ChooseTemplate(
def popupTemplate: NodeSeq = ChooseTemplate(
List("templates-hidden", "Popup", "createRule")
, "rule-createrulepopup"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ import com.normation.box._

object ExpectedPolicyPopup {

def expectedTechnique = ChooseTemplate(
def expectedTechnique: NodeSeq = ChooseTemplate(
List("templates-hidden", "Popup", "expected_policy_popup")
, "expectedpolicypopup-template"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class GiveReasonPopup(
) extends DispatchSnippet with Loggable {

// Load the template from the popup
def popupTemplate = ChooseTemplate(
def popupTemplate: NodeSeq = ChooseTemplate(
List("templates-hidden", "Popup", "giveReason")
, "reason-givereasonpopup"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ class ModificationValidationPopup(
// _1 is explanation message, _2 is dependant rules
def popupContent() : NodeSeq = {

def workflowMessage(directiveCreation: Boolean) = (
def workflowMessage(directiveCreation: Boolean): NodeSeq = (
<h4 class="col-lg-12 col-sm-12 col-xs-12 audit-title">Change Request</h4>
<hr class="css-fix"/>
<div class="col-lg-12 col-sm-12 col-xs-12 alert alert-info text-center">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,12 @@ class RuleCategoryPopup(
) extends DispatchSnippet with Loggable {

// Load the template from the popup
private def html = ChooseTemplate(
private def html: NodeSeq = ChooseTemplate(
"templates-hidden" :: "Popup" :: "RuleCategoryPopup" :: Nil
, "component-creationpopup"
)

private def deleteHtml = ChooseTemplate(
private def deleteHtml: NodeSeq = ChooseTemplate(
"templates-hidden" :: "Popup" :: "RuleCategoryPopup" :: Nil
, "component-deletepopup"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ import com.normation.rudder.web.ChooseTemplate
object RuleModificationValidationPopup extends Loggable {
val htmlId_popupContainer = "validationContainer"

private def html = ChooseTemplate(
private def html: NodeSeq = ChooseTemplate(
"templates-hidden" :: "Popup" :: "RuleModificationValidationPopup" :: Nil
, "component-validationpopup"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ import net.liftweb.http.js.JsCmds._
import net.liftweb.http.js.JE._
import bootstrap.liftweb.StaticResourceRewrite

import scala.xml.NodeSeq

/**
*
* This class deals with the base URL of the application.
Expand All @@ -54,7 +56,7 @@ class BaseUrl {
* We still need to have a base url for some javascript
* But now we use it as a javascript variable
*/
def display = Script(JsRaw(s"""var contextPath = '${S.contextPath}'; var resourcesPath = '${S.contextPath}/${StaticResourceRewrite.prefix}'"""))
def display: NodeSeq = Script(JsRaw(s"""var contextPath = '${S.contextPath}'; var resourcesPath = '${S.contextPath}/${StaticResourceRewrite.prefix}'"""))

/*I keep the old base url as a reminder <base href={(urlService.baseUrl getOrElse S.hostAndPath)+"/"} />*/
}