mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-28 00:04:37 +02:00
relationship management JS
Former-commit-id: 82216265dece0e5d9f77a82b1b22d6ff00265ee1
This commit is contained in:
parent
e1a4250d01
commit
dad791b887
@ -2992,7 +2992,11 @@ class NetworkMap
|
|||||||
|
|
||||||
$table->data = [];
|
$table->data = [];
|
||||||
|
|
||||||
$table->data['interface_row']['node_source_interface'] = html_print_label('', 'node_source_interface');
|
$table->data['interface_row']['node_source_interface'] = html_print_label(
|
||||||
|
'',
|
||||||
|
'node_source_interface',
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
$table->data['interface_row']['interface_source_select'] = html_print_select(
|
$table->data['interface_row']['interface_source_select'] = html_print_select(
|
||||||
[],
|
[],
|
||||||
@ -3016,10 +3020,11 @@ class NetworkMap
|
|||||||
|
|
||||||
$table->data['interface_row']['node_target_interface'] = html_print_label(
|
$table->data['interface_row']['node_target_interface'] = html_print_label(
|
||||||
'',
|
'',
|
||||||
'node_target_interface'
|
'node_target_interface',
|
||||||
|
true
|
||||||
);
|
);
|
||||||
|
|
||||||
$output .= 'br><br>';
|
$output .= '<br>';
|
||||||
|
|
||||||
$table->data['interface_row']['interface_link_button'] = html_print_button(
|
$table->data['interface_row']['interface_link_button'] = html_print_button(
|
||||||
__('Add interface link'),
|
__('Add interface link'),
|
||||||
|
@ -83,7 +83,7 @@ function draw_minimap() {
|
|||||||
|
|
||||||
context_minimap.arc(center_orig_x, center_orig_y, 2, 0, Math.PI * 2, false);
|
context_minimap.arc(center_orig_x, center_orig_y, 2, 0, Math.PI * 2, false);
|
||||||
//Check if the pandora point
|
//Check if the pandora point
|
||||||
if (value.id_agent == -1) {
|
if (value.type == 2) {
|
||||||
context_minimap.fillStyle = "#364D1F";
|
context_minimap.fillStyle = "#364D1F";
|
||||||
} else {
|
} else {
|
||||||
context_minimap.fillStyle = "#000";
|
context_minimap.fillStyle = "#000";
|
||||||
@ -868,7 +868,7 @@ function edit_node(data_node, dblClick) {
|
|||||||
); // It doesn't eval the possible XSS so it's ok
|
); // It doesn't eval the possible XSS so it's ok
|
||||||
$("#dialog_node_edit").dialog("open");
|
$("#dialog_node_edit").dialog("open");
|
||||||
|
|
||||||
if (node_selected.id_agent == undefined || node_selected.id_agent == -2) {
|
if (node_selected.id_agent == undefined || node_selected.type == 3) {
|
||||||
//Fictional node
|
//Fictional node
|
||||||
$("#node_options-fictional_node_name").css("display", "");
|
$("#node_options-fictional_node_name").css("display", "");
|
||||||
$("input[name='edit_name_fictional_node']").val(node_selected.text); // It doesn't eval the possible XSS so it's ok
|
$("input[name='edit_name_fictional_node']").val(node_selected.text); // It doesn't eval the possible XSS so it's ok
|
||||||
@ -1681,7 +1681,8 @@ function clear_selection() {
|
|||||||
function update_networkmap() {
|
function update_networkmap() {
|
||||||
if (enterprise_installed) {
|
if (enterprise_installed) {
|
||||||
node.each(function(d) {
|
node.each(function(d) {
|
||||||
if (d.id_agent != -1) {
|
// Do not update Pandora FMS node.
|
||||||
|
if (d.type != 2) {
|
||||||
var params = [];
|
var params = [];
|
||||||
params.push("update_node_color=1");
|
params.push("update_node_color=1");
|
||||||
params.push("id=" + d.id_db);
|
params.push("id=" + d.id_db);
|
||||||
@ -1896,7 +1897,7 @@ function show_menu(item, data) {
|
|||||||
icon: "interface_link_children",
|
icon: "interface_link_children",
|
||||||
disabled: function() {
|
disabled: function() {
|
||||||
if (enterprise_installed) {
|
if (enterprise_installed) {
|
||||||
if (data.type == 3) {
|
if (data.type == 3 || data.type == 2) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
@ -1966,7 +1967,7 @@ function show_menu(item, data) {
|
|||||||
icon: "interface_link_parent",
|
icon: "interface_link_parent",
|
||||||
disabled: function() {
|
disabled: function() {
|
||||||
if (enterprise_installed) {
|
if (enterprise_installed) {
|
||||||
if (data.type == 3) {
|
if (data.type == 3 || data.type == 2) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
@ -2052,7 +2053,8 @@ function show_menu(item, data) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data.id_agent != -1) {
|
// Avoid deletion if Pandora FMS node.
|
||||||
|
if (data.type != 2) {
|
||||||
items_list["delete"] = {
|
items_list["delete"] = {
|
||||||
name: delete_menu,
|
name: delete_menu,
|
||||||
icon: "delete",
|
icon: "delete",
|
||||||
@ -2291,26 +2293,25 @@ function add_interface_link_js() {
|
|||||||
cancel_set_parent_interface();
|
cancel_set_parent_interface();
|
||||||
$("#dialog_interface_link").dialog("close");
|
$("#dialog_interface_link").dialog("close");
|
||||||
|
|
||||||
source_value = $("#interface_source_select").val();
|
var source_value = $("#interface_source_select").val();
|
||||||
source_text = $("#interface_source_select")
|
var source_text = $("#interface_source_select")
|
||||||
.find("option:selected")
|
.find("option:selected")
|
||||||
.text();
|
.text();
|
||||||
target_value = $("#interface_target_select").val();
|
var target_value = $("#interface_target_select").val();
|
||||||
target_text = $("#interface_target_select")
|
var target_text = $("#interface_target_select")
|
||||||
.find("option:selected")
|
.find("option:selected")
|
||||||
.text();
|
.text();
|
||||||
|
|
||||||
var params = [];
|
|
||||||
params.push("add_interface_relation=1");
|
|
||||||
params.push("id=" + networkmap_id);
|
|
||||||
params.push("source_value=" + source_value);
|
|
||||||
params.push("target_value=" + target_value);
|
|
||||||
params.push("source_text=" + source_text);
|
|
||||||
params.push("target_text=" + target_text);
|
|
||||||
params.push("page=enterprise/operation/agentes/pandora_networkmap.view");
|
|
||||||
|
|
||||||
jQuery.ajax({
|
jQuery.ajax({
|
||||||
data: params.join("&"),
|
data: {
|
||||||
|
page: "enterprise/operation/agentes/pandora_networkmap.view",
|
||||||
|
add_interface_relation: 1,
|
||||||
|
id: networkmap_id,
|
||||||
|
source_value: source_value,
|
||||||
|
target_value: target_value,
|
||||||
|
source_text: source_text,
|
||||||
|
target_text: target_text
|
||||||
|
},
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: "ajax.php",
|
url: "ajax.php",
|
||||||
@ -2326,8 +2327,9 @@ function add_interface_link_js() {
|
|||||||
if (data["type_source"] == 1) {
|
if (data["type_source"] == 1) {
|
||||||
temp_link["arrow_start"] = "module";
|
temp_link["arrow_start"] = "module";
|
||||||
temp_link["id_module_start"] = source_value;
|
temp_link["id_module_start"] = source_value;
|
||||||
temp_link["status_start"] = data["status"];
|
temp_link["status_start"] = data["status_start"];
|
||||||
temp_link["link_color"] = data["status"] == "1" ? "#FC4444" : "#999";
|
temp_link["link_color"] =
|
||||||
|
data["status_start"] == "1" ? "#FC4444" : "#999";
|
||||||
} else {
|
} else {
|
||||||
temp_link["arrow_start"] = "";
|
temp_link["arrow_start"] = "";
|
||||||
temp_link["id_agent_start"] = source_value;
|
temp_link["id_agent_start"] = source_value;
|
||||||
@ -2336,8 +2338,9 @@ function add_interface_link_js() {
|
|||||||
if (data["type_target"] == 1) {
|
if (data["type_target"] == 1) {
|
||||||
temp_link["arrow_end"] = "module";
|
temp_link["arrow_end"] = "module";
|
||||||
temp_link["id_module_end"] = target_value;
|
temp_link["id_module_end"] = target_value;
|
||||||
temp_link["status_end"] = data["status"];
|
temp_link["status_end"] = data["status_end"];
|
||||||
temp_link["link_color"] = data["status"] == "1" ? "#FC4444" : "#999";
|
temp_link["link_color"] =
|
||||||
|
data["status_end"] == "1" ? "#FC4444" : "#999";
|
||||||
} else {
|
} else {
|
||||||
temp_link["arrow_end"] = "";
|
temp_link["arrow_end"] = "";
|
||||||
temp_link["id_agent_end"] = target_value;
|
temp_link["id_agent_end"] = target_value;
|
||||||
@ -3474,6 +3477,7 @@ function draw_elements_graph() {
|
|||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
function(d) {
|
function(d) {
|
||||||
|
console.log(d);
|
||||||
return (
|
return (
|
||||||
d.source.id +
|
d.source.id +
|
||||||
networkmap_id +
|
networkmap_id +
|
||||||
|
Loading…
x
Reference in New Issue
Block a user