Change agent name in bulk operation
This commit is contained in:
parent
18bfa9e2ac
commit
5283e35ae2
|
@ -247,7 +247,10 @@ $params = array();
|
|||
$params['return'] = true;
|
||||
$params['show_helptip'] = true;
|
||||
$params['input_name'] = 'id_parent';
|
||||
$params['value'] = agents_get_name ($id_parent);
|
||||
$params['print_hidden_input_idagent'] = true;
|
||||
$params['hidden_input_idagent_name'] = 'id_agent_parent';
|
||||
$params['hidden_input_idagent_value'] = $id_parent;
|
||||
$params['value'] = db_get_value ("alias","tagente","id_agente",$id_parent);
|
||||
$table->data[3][1] = ui_print_agent_autocomplete_input($params);
|
||||
|
||||
$table->data[3][1] .= html_print_checkbox ("cascade_protection", 1, $cascade_protection, true).__('Cascade protection'). " " . ui_print_help_icon("cascade_protection", true);
|
||||
|
|
|
@ -1147,7 +1147,7 @@ if ($update_module) {
|
|||
$edit_module = true;
|
||||
|
||||
db_pandora_audit("Agent management",
|
||||
"Fail to try update module '$name' for agent " . $agent["nombre"]);
|
||||
"Fail to try update module '$name' for agent " . $agent["alias"]);
|
||||
}
|
||||
else {
|
||||
if ($prediction_module == 3) {
|
||||
|
@ -1165,7 +1165,7 @@ if ($update_module) {
|
|||
$agent = db_get_row ('tagente', 'id_agente', $id_agente);
|
||||
|
||||
db_pandora_audit("Agent management",
|
||||
"Updated module '$name' for agent ".$agent["nombre"], false, false, io_json_mb_encode($values));
|
||||
"Updated module '$name' for agent ".$agent["alias"], false, false, io_json_mb_encode($values));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1278,7 +1278,7 @@ if ($create_module) {
|
|||
$edit_module = true;
|
||||
$moduletype = $id_module;
|
||||
db_pandora_audit("Agent management",
|
||||
"Fail to try added module '$name' for agent ".$agent["nombre"]);
|
||||
"Fail to try added module '$name' for agent ".$agent["alias"]);
|
||||
}
|
||||
else {
|
||||
if ($prediction_module == 3) {
|
||||
|
@ -1296,7 +1296,7 @@ if ($create_module) {
|
|||
|
||||
$agent = db_get_row ('tagente', 'id_agente', $id_agente);
|
||||
db_pandora_audit("Agent management",
|
||||
"Added module '$name' for agent ".$agent["nombre"], false, true, io_json_mb_encode($values));
|
||||
"Added module '$name' for agent ".$agent["alias"], false, true, io_json_mb_encode($values));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1413,7 +1413,7 @@ if ($delete_module) { // DELETE agent module !
|
|||
|
||||
$agent = db_get_row ('tagente', 'id_agente', $id_agente);
|
||||
db_pandora_audit("Agent management",
|
||||
"Deleted module '".$module_data["nombre"]."' for agent ".$agent["nombre"]);
|
||||
"Deleted module '".$module_data["nombre"]."' for agent ".$agent["alias"]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1444,11 +1444,11 @@ if (!empty($duplicate_module)) { // DUPLICATE agent module !
|
|||
|
||||
if ($result) {
|
||||
db_pandora_audit("Agent management",
|
||||
"Duplicate module '".$id_duplicate_module."' for agent " . $agent["nombre"] . " with the new id for clon " . $result);
|
||||
"Duplicate module '".$id_duplicate_module."' for agent " . $agent["alias"] . " with the new id for clon " . $result);
|
||||
}
|
||||
else {
|
||||
db_pandora_audit("Agent management",
|
||||
"Fail to try duplicate module '".$id_duplicate_module."' for agent " . $agent["nombre"]);
|
||||
"Fail to try duplicate module '".$id_duplicate_module."' for agent " . $agent["alias"]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -49,13 +49,13 @@ if (is_ajax ()) {
|
|||
$agents_alerts = array();
|
||||
foreach( $groups as $group ) {
|
||||
$agents_alerts_one_group = alerts_get_agents_with_alert_template ($id_alert_template, $group,
|
||||
false, array ('tagente.nombre', 'tagente.id_agente'));
|
||||
false, array ('tagente.alias', 'tagente.id_agente'));
|
||||
if (is_array($agents_alerts_one_group)) {
|
||||
$agents_alerts = array_merge($agents_alerts, $agents_alerts_one_group);
|
||||
}
|
||||
}
|
||||
|
||||
$agents = index_array ($agents_alerts, 'id_agente', 'nombre');
|
||||
$agents = index_array ($agents_alerts, 'id_agente', 'alias');
|
||||
|
||||
asort($agents);
|
||||
|
||||
|
@ -220,8 +220,9 @@ $table->data[2][0] .= '<span id="agent_loading" class="invisible">';
|
|||
$table->data[2][0] .= html_print_image('images/spinner.png', true);
|
||||
$table->data[2][0] .= '</span>';
|
||||
$agents_alerts = alerts_get_agents_with_alert_template ($id_alert_template, $id_group,
|
||||
false, array ('tagente.nombre', 'tagente.id_agente'));
|
||||
$table->data[2][1] = html_print_select (index_array ($agents_alerts, 'id_agente', 'nombre'),
|
||||
false, array ('tagente.alias', 'tagente.id_agente'));
|
||||
html_debug($agents_alerts);
|
||||
$table->data[2][1] = html_print_select (index_array ($agents_alerts, 'id_agente', 'alias'),
|
||||
'id_agents[]', '', '', '', '', true, true, true, '', $id_alert_template == 0);
|
||||
$table->data[2][2] = __('When select agents');
|
||||
$table->data[2][2] .= '<br>';
|
||||
|
|
|
@ -39,10 +39,10 @@ if (is_ajax ()) {
|
|||
$agents_modules = modules_get_agents_with_module_name ($module_name, $id_group,
|
||||
array ('delete_pending' => 0,
|
||||
'tagente_modulo.disabled' => 0),
|
||||
array ('tagente.id_agente', 'tagente.nombre'),
|
||||
array ('tagente.id_agente', 'tagente.alias'),
|
||||
$recursion);
|
||||
|
||||
echo json_encode (index_array ($agents_modules, 'id_agente', 'nombre'));
|
||||
echo json_encode (index_array ($agents_modules, 'id_agente', 'alias'));
|
||||
return;
|
||||
}
|
||||
return;
|
||||
|
@ -686,7 +686,7 @@ $(document).ready (function () {
|
|||
|
||||
option = $("<option></option>")
|
||||
.attr ("value", value["id_agente"])
|
||||
.html (value["nombre"]);
|
||||
.html (value["alias"]);
|
||||
$("#id_agents").append (option);
|
||||
});
|
||||
},
|
||||
|
@ -712,6 +712,12 @@ $(document).ready (function () {
|
|||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
if("<?php echo $delete ?>"){
|
||||
if("<?php echo $selection_mode ?>" == 'agents'){
|
||||
$("#groups_select").trigger("change");
|
||||
}
|
||||
}
|
||||
});
|
||||
/* ]]> */
|
||||
</script>
|
||||
|
|
|
@ -59,7 +59,7 @@ if ($update_agents) {
|
|||
if (get_parameter ('id_os', '') != -1)
|
||||
$values['id_os'] = get_parameter ('id_os');
|
||||
if (get_parameter ('id_parent', '') != '')
|
||||
$values['id_parent'] = agents_get_agent_id(get_parameter('id_parent'));
|
||||
$values['id_parent'] = get_parameter('id_agent_parent', 0);
|
||||
if (get_parameter ('server_name', '') != -1)
|
||||
$values['server_name'] = get_parameter ('server_name');
|
||||
if (get_parameter ('description', '') != '')
|
||||
|
@ -269,7 +269,10 @@ $params = array();
|
|||
$params['return'] = true;
|
||||
$params['show_helptip'] = true;
|
||||
$params['input_name'] = 'id_parent';
|
||||
$params['value'] = agents_get_name ($id_parent);
|
||||
$params['print_hidden_input_idagent'] = true;
|
||||
$params['hidden_input_idagent_name'] = 'id_agent_parent';
|
||||
$params['hidden_input_idagent_value'] = $id_parent;
|
||||
$params['value'] = db_get_value ("alias","tagente","id_agente",$id_parent);
|
||||
$table->data[0][1] = ui_print_agent_autocomplete_input($params);
|
||||
|
||||
$table->data[0][1] .= "<b>" . __('Cascade protection'). "</b> " .
|
||||
|
|
|
@ -954,7 +954,7 @@ $(document).ready (function () {
|
|||
|
||||
option = $("<option></option>")
|
||||
.attr("value", value["id_agente"])
|
||||
.html(value["nombre"]);
|
||||
.html(value["alias"]);
|
||||
$("#id_agents").append (option);
|
||||
});
|
||||
},
|
||||
|
@ -966,6 +966,13 @@ $(document).ready (function () {
|
|||
$("#status_agents").change(function() {
|
||||
$("#groups_select").trigger("change");
|
||||
});
|
||||
|
||||
|
||||
if("<?php echo $update ?>"){
|
||||
if("<?php echo $selection_mode ?>" == 'agents'){
|
||||
$("#groups_select").trigger("change");
|
||||
}
|
||||
}
|
||||
});
|
||||
/* ]]> */
|
||||
</script>
|
||||
|
|
|
@ -49,8 +49,8 @@ if (is_ajax ()) {
|
|||
$disabled = (int) get_parameter ('disabled');
|
||||
|
||||
$agents_alerts = alerts_get_agents_with_alert_template ($id_alert_templates, false,
|
||||
array('order' => 'tagente.nombre, talert_template_modules.disabled', 'talert_template_modules.disabled' => $disabled),
|
||||
array ('CONCAT(tagente.nombre, " - ", tagente_modulo.nombre) as agent_agentmodule_name',
|
||||
array('order' => 'tagente.alias, talert_template_modules.disabled', 'talert_template_modules.disabled' => $disabled),
|
||||
array ('CONCAT(tagente.alias, " - ", tagente_modulo.nombre) as agent_agentmodule_name',
|
||||
'talert_template_modules.id as template_module_id'), $id_agents);
|
||||
|
||||
echo json_encode (index_array ($agents_alerts, 'template_module_id', 'agent_agentmodule_name'));
|
||||
|
@ -156,8 +156,8 @@ $table->data[3][0] .= '<span id="alerts_loading" class="invisible">';
|
|||
$table->data[3][0] .= html_print_image("images/spinner.png", true);
|
||||
$table->data[3][0] .= '</span>';
|
||||
$agents_alerts = alerts_get_agents_with_alert_template ($id_alert_templates, $id_group,
|
||||
false, array ('tagente.nombre', 'tagente.id_agente'));
|
||||
$table->data[3][1] = html_print_select (index_array ($agents_alerts, 'id_agente', 'nombre'),
|
||||
false, array ('tagente.alias', 'tagente.id_agente'));
|
||||
$table->data[3][1] = html_print_select (index_array ($agents_alerts, 'id_agente', 'alias'),
|
||||
'id_enabled_alerts[]', '', '', '', '', true, true, true, '', $id_alert_templates == 0);
|
||||
|
||||
$table->data[4][0] = __('Action');
|
||||
|
|
|
@ -49,8 +49,8 @@ if (is_ajax ()) {
|
|||
$standby = (int) get_parameter ('standby');
|
||||
|
||||
$agents_alerts = alerts_get_agents_with_alert_template ($id_alert_templates, false,
|
||||
array('order' => 'tagente.nombre, talert_template_modules.standby', 'talert_template_modules.standby' => $standby),
|
||||
array ('CONCAT(tagente.nombre, " - ", tagente_modulo.nombre) as agent_agentmodule_name',
|
||||
array('order' => 'tagente.alias, talert_template_modules.standby', 'talert_template_modules.standby' => $standby),
|
||||
array ('CONCAT(tagente.alias, " - ", tagente_modulo.nombre) as agent_agentmodule_name',
|
||||
'talert_template_modules.id as template_module_id'), $id_agents);
|
||||
|
||||
echo json_encode (index_array ($agents_alerts, 'template_module_id', 'agent_agentmodule_name'));
|
||||
|
@ -156,8 +156,8 @@ $table->data[3][0] .= '<span id="alerts_loading" class="invisible">';
|
|||
$table->data[3][0] .= html_print_image('images/spinner.png', true);
|
||||
$table->data[3][0] .= '</span>';
|
||||
$agents_alerts = alerts_get_agents_with_alert_template ($id_alert_templates, $id_group,
|
||||
false, array ('tagente.nombre', 'tagente.id_agente'));
|
||||
$table->data[3][1] = html_print_select (index_array ($agents_alerts, 'id_agente', 'nombre'),
|
||||
false, array ('tagente.alias', 'tagente.id_agente'));
|
||||
$table->data[3][1] = html_print_select (index_array ($agents_alerts, 'id_agente', 'alias'),
|
||||
'id_not_standby_alerts[]', '', '', '', '', true, true, true, '', $id_alert_templates == 0);
|
||||
|
||||
$table->data[4][0] = __('Action');
|
||||
|
@ -172,7 +172,7 @@ $table->data[5][0] = __('Standby alerts').ui_print_help_tip(__('Format').":<br>
|
|||
$table->data[5][0] .= '<span id="alerts_loading2" class="invisible">';
|
||||
$table->data[5][0] .= html_print_image('images/spinner.png', true);
|
||||
$table->data[5][0] .= '</span>';
|
||||
$table->data[5][1] = html_print_select (index_array ($agents_alerts, 'id_agente2', 'nombre'),
|
||||
$table->data[5][1] = html_print_select (index_array ($agents_alerts, 'id_agente2', 'alias'),
|
||||
'id_standby_alerts[]', '', '', '', '', true, true, true, '', $id_alert_templates == 0);
|
||||
$table->data[5][1] .= '</form>';
|
||||
|
||||
|
|
|
@ -98,8 +98,8 @@ if (is_ajax ()) {
|
|||
$filter['order'] = "nombre ASC";
|
||||
|
||||
// Build fields
|
||||
$fields = array('id_agente', 'nombre');
|
||||
|
||||
$fields = array('id_agente', 'alias');
|
||||
|
||||
// Perform search
|
||||
$agents = db_get_all_rows_filter('tagente', $filter, $fields);
|
||||
if (empty($agents)) $agents = array();
|
||||
|
@ -148,8 +148,8 @@ if (is_ajax ()) {
|
|||
|
||||
$groups = users_get_groups ($config["id_user"], "AW", false);
|
||||
$group_id_list = ($groups ? join(",",array_keys($groups)):"0");
|
||||
|
||||
$sql = 'SELECT DISTINCT(t1.nombre) as name
|
||||
|
||||
$sql = 'SELECT DISTINCT(t1.alias) as name
|
||||
FROM tagente t1, tagente_modulo t2
|
||||
WHERE t1.id_agente = t2.id_agente
|
||||
AND t1.id_grupo IN (' . $group_id_list .')
|
||||
|
@ -162,9 +162,9 @@ if (is_ajax ()) {
|
|||
WHERE t3.id_agente = t4.id_agente AND t1.nombre = t3.nombre
|
||||
AND t4.nombre IN (\'' . implode('\',\'', $nameModules) . '\')) = '.count($nameModules);
|
||||
}
|
||||
|
||||
$sql .= ' ORDER BY t1.nombre';
|
||||
|
||||
|
||||
$sql .= ' ORDER BY t1.alias';
|
||||
|
||||
$nameAgents = db_get_all_rows_sql($sql);
|
||||
|
||||
if ($nameAgents == false)
|
||||
|
|
Loading…
Reference in New Issue