added check to disable satellite servers from exec servers available in snmp wizard in case it is not a satellite agent or has remote config

This commit is contained in:
alejandro-campos 2020-01-16 17:42:31 +01:00
parent 8b6c1261a9
commit fb7cb57f03
3 changed files with 36 additions and 17 deletions

View File

@ -45,3 +45,22 @@ switch ($wizard_section) {
*/
require 'agent_wizard.'.$wizard_section.'.php';
?>
<script language="javascript" type="text/javascript">
function satellite_remote_warn(id_satellite, remote)
{
if(!remote)
{
$('#server_to_exec option[value='+id_satellite+']').prop('disabled', true);
$('#satellite_remote_tip').removeAttr("style").show();
}
else
{
$('#satellite_remote_tip').removeAttr("style").hide();
}
}
</script>

View File

@ -738,11 +738,16 @@ $servers_to_exec[0] = __('Local console');
if (enterprise_installed()) {
enterprise_include_once('include/functions_satellite.php');
$rows = get_proxy_servers(true);
$rows = get_proxy_servers();
// Check if satellite server has remote configuration enabled.
$satellite_remote = config_agents_has_remote_configuration($id_agent);
foreach ($rows as $row) {
if ($row['server_type'] != 13) {
$s_type = ' (Standard)';
} else {
$id_satellite = $row['id_server'];
$s_type = ' (Satellite)';
}
@ -751,7 +756,15 @@ if (enterprise_installed()) {
}
$table->data[1][2] = '<b>'.__('Server to execute command').'</b>'.ui_print_help_icon('agent_snmp_explorer_tab', true);
$table->data[1][3] = html_print_select($servers_to_exec, 'server_to_exec', $server_to_exec, '', '', '', true);
$table->data[1][3] = html_print_select(
$servers_to_exec,
'server_to_exec',
$server_to_exec,
'satellite_remote_warn('.$id_satellite.','.$satellite_remote.')',
'',
'',
true
);
$snmp_versions['1'] = 'v. 1';
$snmp_versions['2'] = 'v. 2';
@ -1020,6 +1033,8 @@ ui_require_javascript_file('pandora_modules');
var separator = '<?php echo $separator; ?>';
$(document).ready (function () {
$('#server_to_exec option').trigger('change');
$("#walk_form").submit(function() {
$("#oid_loading").show ();
});

View File

@ -734,20 +734,5 @@ function snmp_changed_by_multiple_snmp (event, id_snmp, selected) {
"json");
}
function satellite_remote_warn(id_satellite, remote)
{
if(!remote)
{
$('#server_to_exec option[value='+id_satellite+']').prop('disabled', true);
$('#satellite_remote_tip').removeAttr("style").show();
}
else
{
$('#satellite_remote_tip').removeAttr("style").hide();
}
}
/* ]]> */
</script>