Mayor improvements and fixes

This commit is contained in:
Alejandro Gallardo Escobar 2015-01-29 21:00:30 +01:00
parent 81a844d1f3
commit 58b5813eab
2 changed files with 172 additions and 130 deletions

View File

@ -45,6 +45,9 @@ class Tree {
global $config; global $config;
include_once($config['homedir']."/include/functions_servers.php"); include_once($config['homedir']."/include/functions_servers.php");
if (defined("METACONSOLE"))
enterprise_include_once("meta/include/functions_ui_meta.php");
$this->strictACL = (bool) db_get_value("strict_acl", "tusuario", "id_user", $config['id_user']); $this->strictACL = (bool) db_get_value("strict_acl", "tusuario", "id_user", $config['id_user']);
if ($this->strictACL) { if ($this->strictACL) {
@ -377,9 +380,10 @@ class Tree {
ORDER BY $order_fields"; ORDER BY $order_fields";
} }
else { else {
$columns = 'ta.id_agente AS id, ta.nombre AS name, ta.fired_count, $columns = 'ta.id_agente AS id, ta.nombre AS name,
ta.normal_count, ta.warning_count, ta.critical_count, ta.fired_count, ta.normal_count, ta.warning_count,
ta.unknown_count, ta.notinit_count, ta.total_count'; ta.critical_count, ta.unknown_count, ta.notinit_count,
ta.total_count, ta.quiet';
$order_fields = 'ta.nombre ASC, ta.id_agente ASC'; $order_fields = 'ta.nombre ASC, ta.id_agente ASC';
$sql = "SELECT $columns $sql = "SELECT $columns
@ -508,9 +512,10 @@ class Tree {
} }
} }
else { else {
$columns = 'ta.id_agente AS id, ta.nombre AS name, ta.fired_count, $columns = 'ta.id_agente AS id, ta.nombre AS name,
ta.normal_count, ta.warning_count, ta.critical_count, ta.fired_count, ta.normal_count, ta.warning_count,
ta.unknown_count, ta.notinit_count, ta.total_count'; ta.critical_count, ta.unknown_count, ta.notinit_count,
ta.total_count, ta.quiet';
$order_fields = 'ta.nombre ASC, ta.id_agente ASC'; $order_fields = 'ta.nombre ASC, ta.id_agente ASC';
$sql = "SELECT $columns $sql = "SELECT $columns
@ -603,9 +608,10 @@ class Tree {
} }
} }
else { else {
$columns = 'ta.id_agente AS id, ta.nombre AS name, ta.fired_count, $columns = 'ta.id_agente AS id, ta.nombre AS name,
ta.normal_count, ta.warning_count, ta.critical_count, ta.fired_count, ta.normal_count, ta.warning_count,
ta.unknown_count, ta.notinit_count, ta.total_count'; ta.critical_count, ta.unknown_count, ta.notinit_count,
ta.total_count, ta.quiet';
$order_fields = 'ta.nombre ASC, ta.id_agente ASC'; $order_fields = 'ta.nombre ASC, ta.id_agente ASC';
$sql = "SELECT $columns $sql = "SELECT $columns
@ -701,9 +707,10 @@ class Tree {
} }
} }
else { else {
$columns = 'ta.id_agente AS id, ta.nombre AS name, ta.fired_count, $columns = 'ta.id_agente AS id, ta.nombre AS name,
ta.normal_count, ta.warning_count, ta.critical_count, ta.fired_count, ta.normal_count, ta.warning_count,
ta.unknown_count, ta.notinit_count, ta.total_count'; ta.critical_count, ta.unknown_count, ta.notinit_count,
ta.total_count, ta.quiet';
$order_fields = 'ta.nombre ASC, ta.id_agente ASC'; $order_fields = 'ta.nombre ASC, ta.id_agente ASC';
$sql = "SELECT $columns $sql = "SELECT $columns
@ -802,9 +809,10 @@ class Tree {
} }
} }
else { else {
$columns = 'ta.id_agente AS id, ta.nombre AS name, ta.fired_count, $columns = 'ta.id_agente AS id, ta.nombre AS name,
ta.normal_count, ta.warning_count, ta.critical_count, ta.fired_count, ta.normal_count, ta.warning_count,
ta.unknown_count, ta.notinit_count, ta.total_count'; ta.critical_count, ta.unknown_count, ta.notinit_count,
ta.total_count, ta.quiet';
$order_fields = 'ta.nombre ASC, ta.id_agente ASC'; $order_fields = 'ta.nombre ASC, ta.id_agente ASC';
$symbols = ' !"#$%&\'()*+,./:;<=>?@[\\]^{|}~'; $symbols = ' !"#$%&\'()*+,./:;<=>?@[\\]^{|}~';
@ -887,7 +895,6 @@ class Tree {
$module_status_join); $module_status_join);
} }
html_debug_print($sql, true);
return $sql; return $sql;
} }
@ -928,7 +935,7 @@ class Tree {
return strcmp($a["name"], $b["name"]); return strcmp($a["name"], $b["name"]);
} }
protected function getGroupsChildren($groups, $parent_id, $server_id = false) { protected function getGroupsChildren($groups, $parent_id, $server = false) {
$children = array(); $children = array();
foreach ($groups as $key => $group) { foreach ($groups as $key => $group) {
unset($groups[$key]); unset($groups[$key]);
@ -936,7 +943,7 @@ class Tree {
if ((isset($group['parent']) && $group['parent'] == $parent_id) if ((isset($group['parent']) && $group['parent'] == $parent_id)
|| (isset($group['_parent_id_']) && $group['_parent_id_'] == $parent_id)) { || (isset($group['_parent_id_']) && $group['_parent_id_'] == $parent_id)) {
$children_aux = $this->getProcessedItem($group, $server_id, $groups); $children_aux = $this->getProcessedItem($group, $server, $groups);
if (!empty($children_aux)) if (!empty($children_aux))
$children[] = $children_aux; $children[] = $children_aux;
} }
@ -945,7 +952,7 @@ class Tree {
return $children; return $children;
} }
protected function getProcessedItem ($item, $server_id = false, $items = array()) { protected function getProcessedItem ($item, $server = false, $items = array()) {
$processed_item = array(); $processed_item = array();
$processed_item['id'] = $item['id']; $processed_item['id'] = $item['id'];
$processed_item['name'] = $item['name']; $processed_item['name'] = $item['name'];
@ -972,8 +979,8 @@ class Tree {
$processed_item['icon'] = "without_group.png"; $processed_item['icon'] = "without_group.png";
} }
if (defined ('METACONSOLE') && $server_id) { if (defined("METACONSOLE") && !empty($server)) {
$processed_item['server_id'] = $server_id; $processed_item['server_id'] = $server['id'];
} }
$counters = array(); $counters = array();
@ -994,7 +1001,7 @@ class Tree {
if ($processed_item['type'] == 'group' && !empty($items)) { if ($processed_item['type'] == 'group' && !empty($items)) {
$children = $this->getGroupsChildren($items, $item['id'], $server_id); $children = $this->getGroupsChildren($items, $item['id'], $server);
if (!empty($children)) { if (!empty($children)) {
$processed_item['children'] = $children; $processed_item['children'] = $children;
@ -1109,7 +1116,7 @@ class Tree {
return $mergedItems; return $mergedItems;
} }
protected function processModule (&$module) { protected function processModule (&$module, $server = false) {
global $config; global $config;
$module['type'] = 'module'; $module['type'] = 'module';
@ -1119,7 +1126,11 @@ class Tree {
$module['server_type'] = (int) $module['id_modulo']; $module['server_type'] = (int) $module['id_modulo'];
$module['status'] = $module['estado']; $module['status'] = $module['estado'];
$module['value'] = $module['datos']; $module['value'] = $module['datos'];
// $module['icon'] = modules_get_type_icon($module['id_tipo_modulo']);
if (defined("METACONSOLE") && !empty($server)) {
$module['server_id'] = $server['id'];
$module['server_name'] = $server['server_name'];
}
if (!isset($module['value'])) if (!isset($module['value']))
$module['value'] = modules_get_last_value($module['id']); $module['value'] = modules_get_last_value($module['id']);
@ -1180,6 +1191,7 @@ class Tree {
$graphType = return_graphtype($module['id']); $graphType = return_graphtype($module['id']);
$winHandle = dechex(crc32($module['id'] . $module['name'])); $winHandle = dechex(crc32($module['id'] . $module['name']));
if (!defined('METACONSOLE')) {
$moduleGraphURL = $config['homeurl'] . $moduleGraphURL = $config['homeurl'] .
"/operation/agentes/stat_win.php?" . "/operation/agentes/stat_win.php?" .
"type=$graphType&" . "type=$graphType&" .
@ -1187,20 +1199,35 @@ class Tree {
"id=" . $module['id'] . "&" . "id=" . $module['id'] . "&" .
"label=" . rawurlencode(urlencode(base64_encode($module['name']))) . "&" . "label=" . rawurlencode(urlencode(base64_encode($module['name']))) . "&" .
"refresh=600"; "refresh=600";
}
else if (!empty($server)) {
$moduleGraphURL = ui_meta_get_url_console_child(
$server, null, null, null, null,
"operation/agentes/stat_win.php?" .
"type=$graph_type&" .
"period=86400&" .
"id=" . $module["id"] . "&" .
"label=" . rawurlencode(urlencode(base64_encode($module['name']))) . "&" .
"refresh=600");
}
if (!empty($moduleGraphURL)) {
$module['moduleGraph'] = array( $module['moduleGraph'] = array(
'url' => $moduleGraphURL, 'url' => $moduleGraphURL,
'handle' => $winHandle 'handle' => $winHandle
); );
} }
}
protected function processModules (&$modules) { protected function processModules (&$modules, $server = false) {
foreach ($modules as $iterator => $module) { foreach ($modules as $iterator => $module) {
$this->processModule($modules[$iterator]); $this->processModule($modules[$iterator], $server);
} }
} }
protected function processAgent (&$agent, $server_id = false) { protected function processAgent (&$agent, $server = false) {
global $config;
$agent['type'] = 'agent'; $agent['type'] = 'agent';
$agent['id'] = (int) $agent['id']; $agent['id'] = (int) $agent['id'];
$agent['name'] = $agent['name']; $agent['name'] = $agent['name'];
@ -1209,9 +1236,9 @@ class Tree {
$agent['rootType'] = $this->rootType; $agent['rootType'] = $this->rootType;
$id = $agent['id']; $id = $agent['id'];
if ($server_id) { if (defined("METACONSOLE") && !empty($server)) {
$agent['id'] = array(); $agent['id'] = array();
$agent['id'][$server_id] = $id; $agent['id'][$server['id']] = $id;
} }
// Counters // Counters
@ -1265,6 +1292,10 @@ class Tree {
// Alerts fired image // Alerts fired image
$agent["alertImageHTML"] = agents_tree_view_alert_img_ball($agent['counters']['alerts']); $agent["alertImageHTML"] = agents_tree_view_alert_img_ball($agent['counters']['alerts']);
// Quiet image
if (isset($agent['quiet']) && $agent['quiet'])
$agent['quietImageHTML'] = html_print_image("/images/dot_green.disabled.png", true, array("title" => __('Quiet')));
// Status // Status
$agent['statusRaw'] = agents_get_status($id); $agent['statusRaw'] = agents_get_status($id);
switch ($agent['statusRaw']) { switch ($agent['statusRaw']) {
@ -1317,10 +1348,10 @@ class Tree {
} }
} }
protected function processAgents (&$agents, $server_id = false) { protected function processAgents (&$agents, $server = false) {
if (!empty($agents)) { if (!empty($agents)) {
foreach ($agents as $iterator => $agent) { foreach ($agents as $iterator => $agent) {
$this->processAgent($agents[$iterator], $server_id); $this->processAgent($agents[$iterator], $server);
} }
} }
} }
@ -1394,7 +1425,7 @@ class Tree {
$this->id = $id; $this->id = $id;
$newItems = $this->getItems(); $newItems = $this->getItems();
$this->processModules($newItems); $this->processModules($newItems, $server);
$items = array_merge($items, $newItems); $items = array_merge($items, $newItems);
metaconsole_restore_db(); metaconsole_restore_db();
@ -1519,7 +1550,7 @@ class Tree {
if (isset($item['_monitors_alerts_fired_'])) if (isset($item['_monitors_alerts_fired_']))
$item['total_fired_count'] = $item['_monitors_alerts_fired_']; $item['total_fired_count'] = $item['_monitors_alerts_fired_'];
$processed_items[] = $this->getProcessedItem($item, $server['id'], $items); $processed_items[] = $this->getProcessedItem($item, $server, $items);
} }
} }
$unmerged_items += $processed_items; $unmerged_items += $processed_items;
@ -1549,7 +1580,7 @@ class Tree {
$this->rootID = $rootID; $this->rootID = $rootID;
$newItems = $this->getItems(); $newItems = $this->getItems();
$this->processAgents($newItems, $serverID); $this->processAgents($newItems, $server);
$items = array_merge($items, $newItems); $items = array_merge($items, $newItems);
metaconsole_restore_db(); metaconsole_restore_db();
@ -1606,7 +1637,7 @@ class Tree {
if (empty($item['parent'])) { if (empty($item['parent'])) {
unset($items[$key]); unset($items[$key]);
$processed_items[] = $this->getProcessedItem($item, $server['id'], $items); $processed_items[] = $this->getProcessedItem($item, $server, $items);
} }
} }
@ -1637,7 +1668,7 @@ class Tree {
$this->rootID = $rootID; $this->rootID = $rootID;
$newItems = $this->getItems(); $newItems = $this->getItems();
$this->processAgents($newItems, $serverID); $this->processAgents($newItems, $server);
$items = array_merge($items, $newItems); $items = array_merge($items, $newItems);
metaconsole_restore_db(); metaconsole_restore_db();
@ -1696,7 +1727,7 @@ class Tree {
} }
} }
$processed_item = $this->getProcessedItem($item, $server['id']); $processed_item = $this->getProcessedItem($item, $server);
$processed_items[] = $processed_item; $processed_items[] = $processed_item;
} }
$item_list = array_merge($item_list, $processed_items); $item_list = array_merge($item_list, $processed_items);
@ -1726,7 +1757,7 @@ class Tree {
$this->rootID = $rootID; $this->rootID = $rootID;
$newItems = $this->getItems(); $newItems = $this->getItems();
$this->processAgents($newItems, $serverID); $this->processAgents($newItems, $server);
$items = array_merge($items, $newItems); $items = array_merge($items, $newItems);
metaconsole_restore_db(); metaconsole_restore_db();
@ -1814,7 +1845,7 @@ class Tree {
'_articapandora_'.ord('!').'_pandoraartica_'), '_articapandora_'.ord('!').'_pandoraartica_'),
io_safe_output($item['name'])); io_safe_output($item['name']));
$processed_item = $this->getProcessedItem($item, $server['id']); $processed_item = $this->getProcessedItem($item, $server);
$processed_item['id'] = $name; $processed_item['id'] = $name;
$processed_item['rootID'] = $name; $processed_item['rootID'] = $name;
@ -1847,7 +1878,7 @@ class Tree {
$this->rootID = $rootID; $this->rootID = $rootID;
$newItems = $this->getItems(); $newItems = $this->getItems();
$this->processAgents($newItems, $serverID); $this->processAgents($newItems, $server);
$items = array_merge($items, $newItems); $items = array_merge($items, $newItems);
metaconsole_restore_db(); metaconsole_restore_db();
@ -1906,7 +1937,7 @@ class Tree {
} }
} }
$processed_item = $this->getProcessedItem($item, $server['id']); $processed_item = $this->getProcessedItem($item, $server);
$processed_items[] = $processed_item; $processed_items[] = $processed_item;
} }
$item_list = array_merge($item_list, $processed_items); $item_list = array_merge($item_list, $processed_items);
@ -1936,7 +1967,7 @@ class Tree {
$this->rootID = $rootID; $this->rootID = $rootID;
$newItems = $this->getItems(); $newItems = $this->getItems();
$this->processAgents($newItems, $serverID); $this->processAgents($newItems, $server);
$items = array_merge($items, $newItems); $items = array_merge($items, $newItems);
metaconsole_restore_db(); metaconsole_restore_db();
@ -1996,7 +2027,7 @@ class Tree {
} }
} }
$processed_item = $this->getProcessedItem($item, $server['id']); $processed_item = $this->getProcessedItem($item, $server);
$processed_item['icon'] = $item['os_icon']; $processed_item['icon'] = $item['os_icon'];
$processed_items[] = $processed_item; $processed_items[] = $processed_item;
} }
@ -2027,7 +2058,7 @@ class Tree {
$this->rootID = $rootID; $this->rootID = $rootID;
$newItems = $this->getItems(); $newItems = $this->getItems();
$this->processAgents($newItems, $serverID); $this->processAgents($newItems, $server);
$items = array_merge($items, $newItems); $items = array_merge($items, $newItems);
metaconsole_restore_db(); metaconsole_restore_db();

View File

@ -77,10 +77,10 @@ TreeController = {
modules: "Total modules", modules: "Total modules",
none: "Total" none: "Total"
}, },
fired: { alerts: {
agents: "Alert fired", agents: "Alerts fired",
modules: "Alert fired", modules: "Alerts fired",
none: "Alert fired" none: "Alerts fired"
}, },
critical: { critical: {
agents: "Critical agents", agents: "Critical agents",
@ -173,16 +173,16 @@ TreeController = {
$counters.append($totalCounter); $counters.append($totalCounter);
if (typeof counters.fired != 'undefined' if (typeof counters.alerts != 'undefined'
&& counters.fired > 0) { && counters.alerts > 0) {
var $firedCounter = $("<div></div>"); var $firedCounter = $("<div></div>");
$firedCounter $firedCounter
.addClass('tree-node-counter') .addClass('tree-node-counter')
.addClass('fired') .addClass('alerts')
.addClass('orange') .addClass('orange')
.html(counters.fired); .html(counters.alerts);
_processNodeCounterTitle($firedCounter, type, "fired"); _processNodeCounterTitle($firedCounter, type, "alerts");
$counters $counters
.append(" : ") .append(" : ")
@ -311,6 +311,14 @@ TreeController = {
$content.append(element.name); $content.append(element.name);
break; break;
case 'agent': case 'agent':
// Is quiet
if (typeof element.quietImageHTML != 'undefined'
&& element.quietImageHTML.length > 0) {
var $quietImage = $(element.quietImageHTML);
$quietImage.addClass("agent-quiet");
$content.append($quietImage);
}
// Status image // Status image
if (typeof element.statusImageHTML != 'undefined' if (typeof element.statusImageHTML != 'undefined'
&& element.statusImageHTML.length > 0) { && element.statusImageHTML.length > 0) {
@ -361,14 +369,14 @@ TreeController = {
winopeng(element.moduleGraph.url, element.moduleGraph.handle); winopeng(element.moduleGraph.url, element.moduleGraph.handle);
} }
catch (error) { catch (error) {
console.log(error); // console.log(error);
} }
}); });
} }
// Data pop-up // Data pop-up
if (typeof element.id != 'undefined' if (typeof element.id != 'undefined' && !isNaN(element.id)) {
&& !isNaN(element.id)) {
var $dataImage = $('<img src="'+(controller.baseURL.length > 0 ? controller.baseURL : '') var $dataImage = $('<img src="'+(controller.baseURL.length > 0 ? controller.baseURL : '')
+'images/binary.png" /> '); +'images/binary.png" /> ');
$dataImage $dataImage
@ -377,8 +385,9 @@ TreeController = {
e.preventDefault(); e.preventDefault();
try { try {
var serverName = element.server_name.length > 0 ? element.server_name : '';console.log(serverName);
if ($("#module_details_window").length > 0) if ($("#module_details_window").length > 0)
show_module_detail_dialog(element.id, '', '', 0, 86400); show_module_detail_dialog(element.id, '', serverName, 0, 86400);
} }
catch (error) { catch (error) {
console.log(error); console.log(error);
@ -419,6 +428,7 @@ TreeController = {
// If exist the detail container, show the data // If exist the detail container, show the data
if (typeof controller.detailRecipient != 'undefined' && controller.detailRecipient.length > 0) { if (typeof controller.detailRecipient != 'undefined' && controller.detailRecipient.length > 0) {
if (element.type == 'agent' || element.type == 'module') {
$content.click(function (e) { $content.click(function (e) {
TreeNodeDetailController.getController().init({ TreeNodeDetailController.getController().init({
recipient: controller.detailRecipient, recipient: controller.detailRecipient,
@ -428,7 +438,9 @@ TreeController = {
ajaxURL: controller.ajaxURL, ajaxURL: controller.ajaxURL,
ajaxPage: controller.ajaxPage ajaxPage: controller.ajaxPage
}); });
}); })
.css('cursor', 'pointer');
}
} }
$node $node
@ -648,15 +660,16 @@ TreeNodeDetailController = {
} }
}, },
removeControllers: function () { removeControllers: function () {
if (TreeNodeDetailController.controllers.length > 0) { try {
TreeNodeDetailController.controllers.forEach(function(elements, type) { $.each(TreeNodeDetailController.controllers, function(type, elements) {console.log(elements);console.log(type);
if (elements.length > 0) { $.each(elements, function(id, element) {console.log(element);console.log(id);
elements.forEach(function(element, id) {
element.remove(); element.remove();
}); });
}
}); });
} }
catch (error) {
// console.log(error);
}
}, },
getController: function () { getController: function () {
var controller = { var controller = {
@ -687,17 +700,18 @@ TreeNodeDetailController = {
this.container = $("<div></div>"); this.container = $("<div></div>");
this.container this.container
.addClass("tree-element-detail") .addClass("tree-element-detail")
.addClass("tree-element-detail-closed")
.append($label) .append($label)
.data('label', $label) .data('label', $label)
.append($content) .append($content)
.data('content', $content) .data('content', $content);
.hide();
$label.addClass('tree-element-detail-loading'); $label.addClass('tree-element-detail-loading');
$.ajax({ $.ajax({
url: this.ajaxURL, url: this.ajaxURL,
type: 'POST', type: 'POST',
dataType: 'json', dataType: 'html',
async: true,
data: { data: {
page: this.ajaxPage, page: this.ajaxPage,
getDetail: 1, getDetail: 1,
@ -708,16 +722,10 @@ TreeNodeDetailController = {
$label.removeClass('tree-element-detail-loading'); $label.removeClass('tree-element-detail-loading');
}, },
success: function(data, textStatus, xhr) { success: function(data, textStatus, xhr) {
if (data.success) {
$label.addClass('tree-element-detail-loaded'); $label.addClass('tree-element-detail-loaded');
$content.html(data.html); $content.html(data);
controller.open(); controller.open();
}
else {
$label.addClass('tree-element-detail-error');
$content.html(controller.errorMessage);
}
}, },
error: function(xhr, textStatus, errorThrown) { error: function(xhr, textStatus, errorThrown) {
$label.addClass('tree-element-detail-error'); $label.addClass('tree-element-detail-error');
@ -726,16 +734,15 @@ TreeNodeDetailController = {
}); });
this.recipient.append(this.container); this.recipient.append(this.container);
this.open();
}, },
load: function () { load: function () {
this.reload(); this.reload();
}, },
toggle: function () { toggle: function () {
if (typeof this.container != 'undefined' && this.container.length > 0) { if (typeof this.container == 'undefined' || this.container.length <= 0) {
return false; return false;
} }
if (this.container.isClosed) { if (this.container.hasClass("tree-element-detail-closed")) {
this.open(); this.open();
} }
else { else {
@ -743,21 +750,23 @@ TreeNodeDetailController = {
} }
}, },
open: function () { open: function () {
if (typeof this.container != 'undefined' && this.container.length > 0) { if (typeof this.container == 'undefined' || this.container.length <= 0) {
return false; return false;
} }
if (this.container.isClosed) { if (this.container.hasClass("tree-element-detail-closed")) {
this.container.data('content').slideLeft(); this.container
this.container.isClosed = false; .removeClass("tree-element-detail-closed")
.data('content').show();
} }
}, },
close: function () { close: function () {
if (typeof this.container != 'undefined' && this.container.length > 0) { if (typeof this.container == 'undefined' || this.container.length <= 0) {
return false; return false;
} }
if (!this.container.isClosed) { if (!this.container.hasClass("tree-element-detail-closed")) {
this.container.data('content').slideRight(); this.container
this.container.isClosed = true; .addClass("tree-element-detail-closed")
.data('content').hide();
} }
}, },
init: function (data) { init: function (data) {
@ -826,27 +835,29 @@ TreeNodeDetailController = {
} }
}, },
closeOther: function () { closeOther: function () {
if (TreeNodeDetailController.controllers.length > 0) { try {
TreeNodeDetailController.controllers.forEach(function(elements, type) { $.each(TreeNodeDetailController.controllers, function(type, elements) {
if (elements.length > 0) { $.each(elements, function(id, element) {
elements.forEach(function(element, id) { if (controller.type != type && controller.id != id)
if (this.type != type && this.id != id)
element.close(); element.close();
}, this); });
});
} }
}, this); catch (error) {
// console.log(error);
} }
}, },
removeOther: function () { removeOther: function () {
if (TreeNodeDetailController.controllers.length > 0) { try {
TreeNodeDetailController.controllers.forEach(function(elements, type) { TreeNodeDetailController.controllers.forEach(function(elements, type) {
if (elements.length > 0) {
elements.forEach(function(element, id) { elements.forEach(function(element, id) {
if (this.type != type && this.id != id) if (controller.type != type && controller.id != id)
element.remove(); element.remove();
}, this); });
});
} }
}, this); catch (error) {
// console.log(error);
} }
} }
} }