Skip to content

Commit

Permalink
Fixes #23826: Reorganize the header of the node page
Browse files Browse the repository at this point in the history
  • Loading branch information
RaphaelGauthier committed Dec 8, 2023
1 parent 79fd607 commit e6d343e
Show file tree
Hide file tree
Showing 13 changed files with 731 additions and 719 deletions.
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ 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.showDeleteButton
import com.normation.rudder.web.services.DisplayNodeGroupTree
import net.liftweb.common._
import net.liftweb.http.DispatchSnippet
Expand All @@ -66,6 +67,7 @@ import net.liftweb.http.js.JE.JsRaw
import net.liftweb.http.js.JsCmds._
import net.liftweb.http.js.JsExp
import net.liftweb.util.Helpers._

import scala.xml.NodeSeq

object ShowNodeDetailsFromNode {
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,12 @@ 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" #> showDeleteButton(inventory.node.main) &
"#node_groupTree" #>
<div id={groupTreeId}>
<ul>{DisplayNodeGroupTree.buildTreeKeepingGroupWithNode(groupLib, node, None, None, Map(("info", _ => Noop)))}</ul>
</div> &
Expand Down
Loading

0 comments on commit e6d343e

Please sign in to comment.