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 8, 2023
1 parent 79fd607 commit 178af4f
Show file tree
Hide file tree
Showing 13 changed files with 738 additions and 728 deletions.
Expand Up @@ -95,24 +95,6 @@ function refuseEnter(event)
}
}

/* portlet */

$(function() {

$(".portlet").addClass("ui-widget ui-widget-content ui-helper-clearfix arrondis")
.find(".portlet-header")
.addClass("ui-widget-header")
.end()
.find(".portlet-content");

$(".portlet-header .ui-icon").click(function() {
$(this).toggleClass("ui-icon-minusthick").toggleClass("ui-icon-plusthick");
$(this).parents(".portlet:first").find(".portlet-content").toggle();
});

});


/**
* Check all checkbox named name according to the status of the checkbox with id id
* @param id
Expand Down
Expand Up @@ -58,10 +58,12 @@ import com.normation.rudder.web.ChooseTemplate
import com.normation.rudder.web.model.JsNodeId
import com.normation.rudder.web.services.CurrentUser
import com.normation.rudder.web.services.DisplayNode
import com.normation.rudder.web.services.DisplayNode.removeNode
import com.normation.rudder.web.services.DisplayNodeGroupTree
import net.liftweb.common._
import net.liftweb.http.DispatchSnippet
import net.liftweb.http.S
import net.liftweb.http.SHtml
import net.liftweb.http.js.JE.JsRaw
import net.liftweb.http.js.JsCmds._
import net.liftweb.http.js.JsExp
Expand Down Expand Up @@ -261,12 +263,12 @@ class ShowNodeDetailsFromNode(
val jsId = JsNodeId(nodeId, "")
def htmlId(jsId: JsNodeId, prefix: String): String = prefix + jsId.toString
val detailsId = htmlId(jsId, "details_")

configService.rudder_global_policy_mode().toBox match {
case Full(globalMode) =>
bindNode(node, sm, withinPopup, globalMode) ++ Script(
DisplayNode.jsInit(node.id, sm.node.softwareIds, "") &
JsRaw(s"""
$$('#nodeHostname').html("${xml.Utility.escape(sm.node.main.hostname)}");
$$( "#${detailsId}" ).tabs({ active : ${tab} } );
$$('#nodeInventory .ui-tabs-vertical .ui-tabs-nav li a').on('click',function(){
var tab = $$(this).attr('href');
Expand Down Expand Up @@ -299,9 +301,18 @@ class ShowNodeDetailsFromNode(
* Show the content of a node in the portlet
* @return
*/

private def bindNode(node: NodeInfo, inventory: FullInventory, withinPopup: Boolean, globalMode: GlobalPolicyMode): NodeSeq = {
val id = JsNodeId(node.id)
("#node_groupTree" #>
("#nodeHeader" #> DisplayNode.showNodeHeader(inventory, Some(node)) &
"#confirmNodeDeletion" #> {
SHtml.ajaxButton(
"Confirm",
() => { removeNode(inventory.node.main) },
("class", "btn btn-danger")
)
} &
"#node_groupTree" #>
<div id={groupTreeId}>
<ul>{DisplayNodeGroupTree.buildTreeKeepingGroupWithNode(groupLib, node, None, None, Map(("info", _ => Noop)))}</ul>
</div> &
Expand Down

0 comments on commit 178af4f

Please sign in to comment.