Merge branch 'ent-5193-IPAM-Supernet-Map-Tree-View' into 'develop'
implemented supernet treeview See merge request artica/pandorafms!4431
This commit is contained in:
commit
04d683286f
|
@ -40,6 +40,7 @@ if (is_ajax() === true) {
|
|||
include_once $config['homedir'].'/include/class/TreeGroup.class.php';
|
||||
include_once $config['homedir'].'/include/class/TreeService.class.php';
|
||||
include_once $config['homedir'].'/include/class/TreeGroupEdition.class.php';
|
||||
enterprise_include_once('include/class/TreeIPAMSupernet.class.php');
|
||||
enterprise_include_once('include/class/TreePolicies.class.php');
|
||||
enterprise_include_once('include/class/TreeGroupMeta.class.php');
|
||||
include_once $config['homedir'].'/include/functions_reporting.php';
|
||||
|
@ -190,6 +191,18 @@ if (is_ajax() === true) {
|
|||
);
|
||||
break;
|
||||
|
||||
case 'IPAM_supernets':
|
||||
$tree = new TreeIPAMSupernet(
|
||||
$type,
|
||||
$rootType,
|
||||
$id,
|
||||
$rootID,
|
||||
$serverID,
|
||||
$childrenMethod,
|
||||
$access
|
||||
);
|
||||
break;
|
||||
|
||||
default:
|
||||
// No error handler.
|
||||
return;
|
||||
|
|
|
@ -159,6 +159,21 @@ var TreeController = {
|
|||
}
|
||||
};
|
||||
|
||||
var IPAMSupernetCounterTitles = {
|
||||
total_networks: {
|
||||
totals: "Networks"
|
||||
}
|
||||
};
|
||||
|
||||
var IPAMNetworkCounterTitles = {
|
||||
alive_ips: {
|
||||
totals: "Alive IPs"
|
||||
},
|
||||
total_ips: {
|
||||
totals: "Total IPs"
|
||||
}
|
||||
};
|
||||
|
||||
try {
|
||||
var title = "";
|
||||
|
||||
|
@ -192,6 +207,12 @@ var TreeController = {
|
|||
case "services":
|
||||
title = serviceCounterTitles[counterType].totals;
|
||||
break;
|
||||
case "IPAM_supernets":
|
||||
title = IPAMSupernetCounterTitles[counterType].totals;
|
||||
break;
|
||||
case "IPAM_networks":
|
||||
title = IPAMNetworkCounterTitles[counterType].totals;
|
||||
break;
|
||||
default:
|
||||
if (
|
||||
typeof controller.counterTitles != "undefined" &&
|
||||
|
@ -333,6 +354,113 @@ var TreeController = {
|
|||
|
||||
hasCounters = true;
|
||||
}
|
||||
} else if (type == "IPAM_supernets") {
|
||||
var $counters = $("<div></div>");
|
||||
$counters.addClass("tree-node-counters");
|
||||
|
||||
if (counters.total_networks > 0) {
|
||||
// Open the parentheses
|
||||
$counters.append(" (");
|
||||
|
||||
if (
|
||||
typeof counters.total_networks !== "undefined" &&
|
||||
counters.total_networks >= 0
|
||||
) {
|
||||
var $networksCounter = $("<div></div>");
|
||||
$networksCounter
|
||||
.addClass("tree-node-counter")
|
||||
.addClass("total")
|
||||
.html(counters.total_networks);
|
||||
|
||||
_processNodeCounterTitle(
|
||||
$networksCounter,
|
||||
type,
|
||||
"total_networks"
|
||||
);
|
||||
|
||||
$counters.append($networksCounter);
|
||||
} else {
|
||||
var $networksCounter = $("<div></div>");
|
||||
$networksCounter
|
||||
.addClass("tree-node-counter")
|
||||
.addClass("total")
|
||||
.html("0");
|
||||
|
||||
_processNodeCounterTitle(
|
||||
$networksCounter,
|
||||
type,
|
||||
"total_networks"
|
||||
);
|
||||
|
||||
$counters.append($networksCounter);
|
||||
}
|
||||
|
||||
// Close the parentheses
|
||||
$counters.append(")");
|
||||
|
||||
hasCounters = true;
|
||||
}
|
||||
} else if (type == "IPAM_networks") {
|
||||
var $counters = $("<div></div>");
|
||||
$counters.addClass("tree-node-counters");
|
||||
|
||||
// Open the parentheses
|
||||
$counters.append(" (");
|
||||
|
||||
if (
|
||||
typeof counters.alive_ips !== "undefined" &&
|
||||
counters.alive_ips >= 0
|
||||
) {
|
||||
var $aliveCounter = $("<div></div>");
|
||||
$aliveCounter
|
||||
.addClass("tree-node-counter")
|
||||
.addClass("total")
|
||||
.html(counters.alive_ips);
|
||||
|
||||
_processNodeCounterTitle($aliveCounter, type, "alive_ips");
|
||||
|
||||
$counters.append($aliveCounter);
|
||||
} else {
|
||||
var $aliveCounter = $("<div></div>");
|
||||
$aliveCounter
|
||||
.addClass("tree-node-counter")
|
||||
.addClass("total")
|
||||
.html("0");
|
||||
|
||||
_processNodeCounterTitle($aliveCounter, type, "alive_ips");
|
||||
|
||||
$counters.append($aliveCounter);
|
||||
}
|
||||
|
||||
if (
|
||||
typeof counters.total_ips !== "undefined" &&
|
||||
counters.total_ips >= 0
|
||||
) {
|
||||
var $totalCounter = $("<div></div>");
|
||||
$totalCounter
|
||||
.addClass("tree-node-counter")
|
||||
.addClass("total")
|
||||
.html(counters.total_ips);
|
||||
|
||||
_processNodeCounterTitle($totalCounter, type, "total_ips");
|
||||
|
||||
$counters.append(" : ").append($totalCounter);
|
||||
} else {
|
||||
var $totalCounter = $("<div></div>");
|
||||
$totalCounter
|
||||
.addClass("tree-node-counter")
|
||||
.addClass("total")
|
||||
.html("0");
|
||||
|
||||
_processNodeCounterTitle($totalCounter, type, "total_ips");
|
||||
|
||||
$counters.append(" : ").append($totalCounter);
|
||||
}
|
||||
|
||||
// Close the parentheses
|
||||
$counters.append(")");
|
||||
|
||||
hasCounters = true;
|
||||
} else {
|
||||
var $counters = $("<div></div>");
|
||||
$counters.addClass("tree-node-counters");
|
||||
|
@ -637,6 +765,87 @@ var TreeController = {
|
|||
}
|
||||
|
||||
$content.append(" " + element.alias);
|
||||
break;
|
||||
case "IPAM_supernets":
|
||||
var IPAMSupernetDetailImage = $(
|
||||
'<img class="invert_filter" src="' +
|
||||
(controller.baseURL.length > 0 ? controller.baseURL : "") +
|
||||
'images/transactional_map.png" /> '
|
||||
);
|
||||
|
||||
if (typeof element.id !== "undefined") {
|
||||
IPAMSupernetDetailImage.click(function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
var postData = {
|
||||
page: "enterprise/include/ajax/ipam.ajax",
|
||||
show_networkmap_statistics: 1,
|
||||
"node_data[id_net]": element.id,
|
||||
"node_data[type_net]": "supernet"
|
||||
};
|
||||
|
||||
$.ajax({
|
||||
url: controller.ajaxURL,
|
||||
type: "POST",
|
||||
dataType: "html",
|
||||
data: postData,
|
||||
success: function(data, textStatus, xhr) {
|
||||
controller.detailRecipient
|
||||
.render("IPAMsupernets", data)
|
||||
.open();
|
||||
}
|
||||
});
|
||||
}).css("cursor", "pointer");
|
||||
|
||||
$content.append(IPAMSupernetDetailImage);
|
||||
}
|
||||
|
||||
if (element.name !== null) {
|
||||
$content.append(" " + element.name);
|
||||
}
|
||||
|
||||
break;
|
||||
case "IPAM_networks":
|
||||
$content.addClass("ipam-network");
|
||||
|
||||
var IPAMNetworkDetailImage = $(
|
||||
'<img class="invert_filter" src="' +
|
||||
(controller.baseURL.length > 0 ? controller.baseURL : "") +
|
||||
'images/list.png" /> '
|
||||
);
|
||||
|
||||
if (typeof element.id !== "undefined") {
|
||||
IPAMNetworkDetailImage.click(function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
//window.location.href = element.IPAMNetworkDetail;
|
||||
var postData = {
|
||||
page: "enterprise/include/ajax/ipam.ajax",
|
||||
show_networkmap_statistics: 1,
|
||||
"node_data[id_net]": element.id,
|
||||
"node_data[type_net]": "network"
|
||||
};
|
||||
|
||||
$.ajax({
|
||||
url: controller.ajaxURL,
|
||||
type: "POST",
|
||||
dataType: "html",
|
||||
data: postData,
|
||||
success: function(data, textStatus, xhr) {
|
||||
controller.detailRecipient
|
||||
.render("IPAMnetwork", data)
|
||||
.open();
|
||||
}
|
||||
});
|
||||
}).css("cursor", "pointer");
|
||||
|
||||
$content.append(IPAMNetworkDetailImage);
|
||||
}
|
||||
|
||||
if (element.name !== null) {
|
||||
$content.append(" " + element.name);
|
||||
}
|
||||
|
||||
break;
|
||||
case "services":
|
||||
if (
|
||||
|
@ -960,7 +1169,7 @@ var TreeController = {
|
|||
return;
|
||||
}
|
||||
}
|
||||
// If exist the detail container, show the data
|
||||
// If detail container exists, show the data.
|
||||
if (
|
||||
typeof controller.detailRecipient !== "undefined" ||
|
||||
disabled == false
|
||||
|
|
|
@ -189,3 +189,7 @@ div#tree-controller-recipient {
|
|||
.tree-node .disabled {
|
||||
filter: opacity(0.3);
|
||||
}
|
||||
|
||||
.ipam-network {
|
||||
font-size: 9pt;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue