* Adjust host treemap load type.

This commit is contained in:
caoyanyi
2023-11-14 14:52:45 +08:00
parent 4aca00ed4e
commit 69f5ef89b7
3 changed files with 10 additions and 5 deletions
+4
View File
@@ -0,0 +1,4 @@
window.onTreemapNodeClick = function(node)
{
loadModal($.createLink('host', 'view', 'hostID=' + node.hostid));
}
+4 -4
View File
@@ -309,7 +309,7 @@ class hostModel extends model
if(is_array($hosts))
{
$hostNameList = array();
foreach($hosts as $host) $hostNameList[] = array('text' => htmlspecialchars($host->name));
foreach($hosts as $host) $hostNameList[] = array('text' => htmlspecialchars($host->name), 'hostid' => $host->id);
$subChildren['children'][] = array(
'text' => htmlspecialchars($cabinet),
'collapsed' => false,
@@ -318,7 +318,7 @@ class hostModel extends model
}
else
{
$subChildren['children'][] = array('text' => htmlspecialchars($hosts->name));
$subChildren['children'][] = array('text' => htmlspecialchars($hosts->name), 'hostid' => $hosts->id);
}
}
$children['children'][] = $subChildren;
@@ -372,7 +372,7 @@ class hostModel extends model
$treemap[$module->id] = array('text' => $module->name, 'collapsed' => false, 'children' => array());
foreach($hostGroups[$module->id] as $host)
{
$treemap[$module->id]['children'][] = array('text' => htmlspecialchars($host->name));
$treemap[$module->id]['children'][] = array('text' => htmlspecialchars($host->name), 'hostid' => $host->id);
}
}
}
@@ -383,7 +383,7 @@ class hostModel extends model
if(isset($hostGroups[0]))
{
foreach($hostGroups[0] as $host) $groupTree['children'][] = array('text' => htmlspecialchars($host->name));
foreach($hostGroups[0] as $host) $groupTree['children'][] = array('text' => htmlspecialchars($host->name), 'hostid' => $host->id));
}
$treemap[0] = $groupTree;
}
+2 -1
View File
@@ -24,5 +24,6 @@ featureBar
treemap
(
setClass('canvas'),
set::data($treemap)
set::data($treemap),
set::onNodeClick(jsRaw('(node) => window.onTreemapNodeClick(node)'))
);