Merge branch 'ent-11951-anadir-nombre-de-servidor-en-la-lista-de-servidores' into 'develop'

Added name and master server column to servers view

See merge request artica/pandorafms!6613
This commit is contained in:
Rafael Ameijeiras 2023-11-27 10:41:03 +00:00
commit b58714d769
2 changed files with 84 additions and 54 deletions

View File

@ -64,32 +64,33 @@ $table->style = [];
// $table->style[0] = 'font-weight: bold';
$table->align = [];
$table->align[1] = 'center';
$table->align[3] = 'center';
$table->align[8] = 'right';
$table->align[4] = 'center';
$table->align[9] = 'right';
$table->headstyle[1] = 'text-align:center';
$table->headstyle[3] = 'text-align:center';
$table->headstyle[8] = 'text-align:right;width: 120px;';
$table->headstyle[4] = 'text-align:center';
$table->headstyle[9] = 'text-align:right;width: 120px;';
$table->titleclass = 'tabletitle';
$table->titlestyle = 'text-transform:uppercase;';
$table->style[6] = 'display: flex;align-items: center;';
$table->style[7] = 'display: flex;align-items: center;';
$table->head = [];
$table->head[0] = __('Name');
$table->head[1] = __('Status');
$table->head[2] = __('Type');
$table->head[3] = __('Version');
$table->head[4] = __('Modules');
$table->head[5] = __('Lag').ui_print_help_tip(__('Avg. Delay(sec)/Modules delayed'), true);
$table->head[6] = __('T/Q').ui_print_help_tip(__('Threads / Queued modules currently'), true);
$table->head[3] = __('Master');
$table->head[4] = __('Version');
$table->head[5] = __('Modules');
$table->head[6] = __('Lag').ui_print_help_tip(__('Avg. Delay(sec)/Modules delayed'), true);
$table->head[7] = __('T/Q').ui_print_help_tip(__('Threads / Queued modules currently'), true);
// This will have a column of data such as "6 hours".
$table->head[7] = __('Updated');
$table->head[8] = __('Updated');
// Only Pandora Administrator can delete servers.
if ((bool) check_acl($config['id_user'], 0, 'PM') === true) {
$table->head[8] = '<span title="Operations">'.__('Op.').'</span>';
$table->head[9] = '<span title="Operations">'.__('Op.').'</span>';
}
$table->data = [];
@ -143,9 +144,11 @@ foreach ($servers as $server) {
}
// Type.
$data[2] = '<span class="nowrap">'.$server['img'];
$data[2] = '<span class="nowrap">'.$server['img'].'&nbsp;&nbsp;&nbsp;&nbsp;'.$server['name'];
if ($server['master'] == $master) {
$data[2] .= ui_print_help_tip(__('This is a master server'), true);
$data[3] .= __('Yes', true);
} else {
$data[3] .= __('-');
}
if ((int) $server['exec_proxy'] === 1) {
@ -157,27 +160,27 @@ foreach ($servers as $server) {
case 'event':
case 'autoprovision':
case 'migration':
$data[3] = $server['version'];
$data[4] = __('N/A');
$data[4] = $server['version'];
$data[5] = __('N/A');
$data[6] = __('N/A');
break;
case 'export':
$data[3] = $server['version'];
$data[4] = $server['modules'].' '.__('of').' '.$server['modules_total'];
$data[5] = __('N/A');
$data[4] = $server['version'];
$data[5] = $server['modules'].' '.__('of').' '.$server['modules_total'];
$data[6] = __('N/A');
break;
default:
$data[3] = $server['version'];
$data[4] = $server['modules'].' '.__('of').' '.$server['modules_total'];
$data[5] = '<span class="nowrap">'.$server['lag_txt'].'</span>';
$data[4] = $server['version'];
$data[5] = $server['modules'].' '.__('of').' '.$server['modules_total'];
$data[6] = '<span class="nowrap">'.$server['lag_txt'].'</span>';
break;
}
$data[6] = '';
$data[7] = '';
if ($server['queued_modules'] > 500) {
$data[6] .= '<div class="inline"><a onclick="show_dialog();" >'.html_print_image(
$data[7] .= '<div class="inline"><a onclick="show_dialog();" >'.html_print_image(
'images/info-warning.svg',
true,
[
@ -189,9 +192,9 @@ foreach ($servers as $server) {
).'</a></div>&nbsp;&nbsp;';
}
$data[6] .= $server['threads'].' : '.$server['queued_modules'];
$data[7] .= $server['threads'].' : '.$server['queued_modules'];
$data[7] = ui_print_timestamp($server['keepalive'], true);
$data[8] = ui_print_timestamp($server['keepalive'], true);
if ($server['type'] === 'data') {
$ext = '_server';
@ -208,11 +211,11 @@ foreach ($servers as $server) {
// Only Pandora Administrator can delete servers.
if ((bool) check_acl($config['id_user'], 0, 'PM') === true) {
$data[8] = '';
$data[9] = '';
if ($server['type'] === 'recon') {
$data[8] .= '<a href="'.ui_get_full_url('index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=tasklist').'">';
$data[8] .= html_print_image(
$data[9] .= '<a href="'.ui_get_full_url('index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=tasklist').'">';
$data[9] .= html_print_image(
'images/snmp-trap@svg.svg',
true,
[
@ -221,12 +224,12 @@ foreach ($servers as $server) {
]
);
$data[8] .= '</a>';
$data[9] .= '</a>';
}
if ($server['type'] === 'data') {
$data[8] .= '<a href="'.ui_get_full_url('index.php?sec=gservers&sec2=godmode/servers/modificar_server&refr=0&server_reset_counts='.$server['id_server']).'">';
$data[8] .= html_print_image(
$data[9] .= '<a href="'.ui_get_full_url('index.php?sec=gservers&sec2=godmode/servers/modificar_server&refr=0&server_reset_counts='.$server['id_server']).'">';
$data[9] .= html_print_image(
'images/force@svg.svg',
true,
[
@ -234,10 +237,10 @@ foreach ($servers as $server) {
'class' => 'main_menu_icon invert_filter',
]
);
$data[8] .= '</a>';
$data[9] .= '</a>';
} else if ($server['type'] === 'enterprise snmp') {
$data[8] .= '<a href="'.ui_get_full_url('index.php?sec=gservers&sec2=godmode/servers/modificar_server&refr=0&server_reset_snmp_enterprise='.$server['id_server']).'">';
$data[8] .= html_print_image(
$data[9] .= '<a href="'.ui_get_full_url('index.php?sec=gservers&sec2=godmode/servers/modificar_server&refr=0&server_reset_snmp_enterprise='.$server['id_server']).'">';
$data[9] .= html_print_image(
'images/force@svg.svg',
true,
[
@ -245,12 +248,12 @@ foreach ($servers as $server) {
'class' => 'main_menu_icon invert_filter',
]
);
$data[8] .= '</a>';
$data[9] .= '</a>';
}
if ($server['type'] === 'event' && (bool) check_acl($config['id_user'], 0, 'LM') === true) {
$data[8] .= '<a class="open-alerts-list-modal" href="">';
$data[8] .= html_print_image(
$data[9] .= '<a class="open-alerts-list-modal" href="">';
$data[9] .= html_print_image(
'images/alert@svg.svg',
true,
[
@ -258,11 +261,11 @@ foreach ($servers as $server) {
'class' => 'main_menu_icon invert_filter',
]
);
$data[8] .= '</a>';
$data[9] .= '</a>';
}
$data[8] .= '<a href="'.ui_get_full_url('index.php?sec=gservers&sec2=godmode/servers/modificar_server&server='.$server['id_server']).'">';
$data[8] .= html_print_image(
$data[9] .= '<a href="'.ui_get_full_url('index.php?sec=gservers&sec2=godmode/servers/modificar_server&server='.$server['id_server']).'">';
$data[9] .= html_print_image(
'images/edit.svg',
true,
[
@ -270,11 +273,11 @@ foreach ($servers as $server) {
'class' => 'main_menu_icon invert_filter',
]
);
$data[8] .= '</a>';
$data[9] .= '</a>';
if (($names_servers[$safe_server_name] === true) && ($ext === '_server' || $server['type'] === 'enterprise satellite')) {
$data[8] .= '<a href="'.ui_get_full_url('index.php?sec=gservers&sec2=godmode/servers/modificar_server&server_remote='.$server['id_server'].'&ext='.$ext.'&tab=agent_editor').'">';
$data[8] .= html_print_image(
$data[9] .= '<a href="'.ui_get_full_url('index.php?sec=gservers&sec2=godmode/servers/modificar_server&server_remote='.$server['id_server'].'&ext='.$ext.'&tab=agent_editor').'">';
$data[9] .= html_print_image(
'images/agents@svg.svg',
true,
[
@ -282,10 +285,10 @@ foreach ($servers as $server) {
'class' => 'main_menu_icon invert_filter',
]
);
$data[8] .= '</a>';
$data[9] .= '</a>';
$data[8] .= '<a href="'.ui_get_full_url('index.php?sec=gservers&sec2=godmode/servers/modificar_server&server_remote='.$server['id_server'].'&ext='.$ext).'">';
$data[8] .= html_print_image(
$data[9] .= '<a href="'.ui_get_full_url('index.php?sec=gservers&sec2=godmode/servers/modificar_server&server_remote='.$server['id_server'].'&ext='.$ext).'">';
$data[9] .= html_print_image(
'images/remote-configuration@svg.svg',
true,
[
@ -293,12 +296,12 @@ foreach ($servers as $server) {
'class' => 'main_menu_icon invert_filter',
]
);
$data[8] .= '</a>';
$data[9] .= '</a>';
$names_servers[$safe_server_name] = false;
}
$data[8] .= '<a href="'.ui_get_full_url('index.php?sec=gservers&sec2=godmode/servers/modificar_server&server_del='.$server['id_server'].'&amp;delete=1').'">';
$data[8] .= html_print_image(
$data[9] .= '<a href="'.ui_get_full_url('index.php?sec=gservers&sec2=godmode/servers/modificar_server&server_del='.$server['id_server'].'&amp;delete=1').'">';
$data[9] .= html_print_image(
'images/delete.svg',
true,
[
@ -307,14 +310,14 @@ foreach ($servers as $server) {
'class' => 'main_menu_icon invert_filter',
]
);
$data[8] .= '</a>';
$data[9] .= '</a>';
}
if ($tiny) {
unset($data[4]);
unset($data[6]);
unset($data[5]);
unset($data[7]);
unset($data[8]);
unset($data[9]);
}
$ext = '';
@ -323,10 +326,10 @@ foreach ($servers as $server) {
}
if ($tiny) {
unset($table->head[4]);
unset($table->head[6]);
unset($table->head[5]);
unset($table->head[7]);
unset($table->head[8]);
unset($table->head[9]);
}
if ($tiny) {

View File

@ -665,6 +665,7 @@ function servers_get_info($id_server=-1, $sql_limit=-1)
);
$server['type'] = 'data';
$id_modulo = 1;
$server['name'] = __('Data server');
break;
case SERVER_TYPE_NETWORK:
@ -678,6 +679,7 @@ function servers_get_info($id_server=-1, $sql_limit=-1)
);
$server['type'] = 'network';
$id_modulo = 2;
$server['name'] = __('Network server');
break;
case SERVER_TYPE_SNMP:
@ -691,6 +693,7 @@ function servers_get_info($id_server=-1, $sql_limit=-1)
);
$server['type'] = 'snmp';
$id_modulo = 0;
$server['name'] = __('SNMP Trap server');
break;
case SERVER_TYPE_DISCOVERY:
@ -704,6 +707,7 @@ function servers_get_info($id_server=-1, $sql_limit=-1)
);
$server['type'] = 'recon';
$id_modulo = 0;
$server['name'] = __('Discovery server');
break;
case SERVER_TYPE_PLUGIN:
@ -717,6 +721,7 @@ function servers_get_info($id_server=-1, $sql_limit=-1)
);
$server['type'] = 'plugin';
$id_modulo = 4;
$server['name'] = __('Plugin server');
break;
case SERVER_TYPE_PREDICTION:
@ -730,6 +735,7 @@ function servers_get_info($id_server=-1, $sql_limit=-1)
);
$server['type'] = 'prediction';
$id_modulo = 5;
$server['name'] = __('Prediction server');
break;
case SERVER_TYPE_WMI:
@ -743,6 +749,7 @@ function servers_get_info($id_server=-1, $sql_limit=-1)
);
$server['type'] = 'wmi';
$id_modulo = 6;
$server['name'] = __('WMI server');
break;
case SERVER_TYPE_EXPORT:
@ -756,6 +763,7 @@ function servers_get_info($id_server=-1, $sql_limit=-1)
);
$server['type'] = 'export';
$id_modulo = 0;
$server['name'] = __('Export server');
break;
case SERVER_TYPE_INVENTORY:
@ -769,6 +777,7 @@ function servers_get_info($id_server=-1, $sql_limit=-1)
);
$server['type'] = 'inventory';
$id_modulo = 0;
$server['name'] = __('Inventory server');
break;
case SERVER_TYPE_WEB:
@ -782,6 +791,7 @@ function servers_get_info($id_server=-1, $sql_limit=-1)
);
$server['type'] = 'web';
$id_modulo = 0;
$server['name'] = __('Web server');
break;
case SERVER_TYPE_EVENT:
@ -795,6 +805,7 @@ function servers_get_info($id_server=-1, $sql_limit=-1)
);
$server['type'] = 'event';
$id_modulo = 2;
$server['name'] = __('Event server');
break;
case SERVER_TYPE_CORRELATION:
@ -808,6 +819,7 @@ function servers_get_info($id_server=-1, $sql_limit=-1)
);
$server['type'] = 'correlation';
$id_modulo = 0;
$server['name'] = __('Correlation server');
break;
case SERVER_TYPE_ENTERPRISE_ICMP:
@ -821,6 +833,7 @@ function servers_get_info($id_server=-1, $sql_limit=-1)
);
$server['type'] = 'enterprise icmp';
$id_modulo = 2;
$server['name'] = __('Enterprise ICMP server');
break;
case SERVER_TYPE_ENTERPRISE_SNMP:
@ -834,6 +847,7 @@ function servers_get_info($id_server=-1, $sql_limit=-1)
);
$server['type'] = 'enterprise snmp';
$id_modulo = 2;
$server['name'] = __('Enterprise SNMP server');
break;
case SERVER_TYPE_ENTERPRISE_SATELLITE:
@ -847,6 +861,7 @@ function servers_get_info($id_server=-1, $sql_limit=-1)
);
$server['type'] = 'enterprise satellite';
$id_modulo = 0;
$server['name'] = __('Enterprise Satellite server');
break;
case SERVER_TYPE_ENTERPRISE_TRANSACTIONAL:
@ -860,6 +875,7 @@ function servers_get_info($id_server=-1, $sql_limit=-1)
);
$server['type'] = 'enterprise transactional';
$id_modulo = 0;
$server['name'] = __('Enterprise Transactional server');
break;
case SERVER_TYPE_MAINFRAME:
@ -873,6 +889,7 @@ function servers_get_info($id_server=-1, $sql_limit=-1)
);
$server['type'] = 'mainframe';
$id_modulo = 0;
$server['name'] = __('Mainframe server');
break;
case SERVER_TYPE_SYNC:
@ -886,6 +903,7 @@ function servers_get_info($id_server=-1, $sql_limit=-1)
);
$server['type'] = 'sync';
$id_modulo = 0;
$server['name'] = __('Sync server');
break;
case SERVER_TYPE_WUX:
@ -899,6 +917,7 @@ function servers_get_info($id_server=-1, $sql_limit=-1)
);
$server['type'] = 'wux';
$id_modulo = 0;
$server['name'] = __('Wux server');
break;
case SERVER_TYPE_SYSLOG:
@ -912,6 +931,7 @@ function servers_get_info($id_server=-1, $sql_limit=-1)
);
$server['type'] = 'syslog';
$id_modulo = 0;
$server['name'] = __('Syslog server');
break;
case SERVER_TYPE_NCM:
@ -925,6 +945,7 @@ function servers_get_info($id_server=-1, $sql_limit=-1)
);
$server['type'] = 'ncm';
$id_modulo = 0;
$server['name'] = __('NCM server');
break;
case SERVER_TYPE_AUTOPROVISION:
@ -938,6 +959,7 @@ function servers_get_info($id_server=-1, $sql_limit=-1)
);
$server['type'] = 'autoprovision';
$id_modulo = 0;
$server['name'] = __('Autoprovision server');
break;
case SERVER_TYPE_MIGRATION:
@ -951,6 +973,7 @@ function servers_get_info($id_server=-1, $sql_limit=-1)
);
$server['type'] = 'migration';
$id_modulo = 0;
$server['name'] = __('Migration server');
break;
case SERVER_TYPE_ALERT:
@ -964,6 +987,7 @@ function servers_get_info($id_server=-1, $sql_limit=-1)
);
$server['type'] = 'alert';
$id_modulo = 0;
$server['name'] = __('Alert server');
break;
case SERVER_TYPE_NETFLOW:
@ -977,6 +1001,7 @@ function servers_get_info($id_server=-1, $sql_limit=-1)
);
$server['type'] = 'netflow';
$id_modulo = 0;
$server['name'] = __('Netflow server');
break;
case SERVER_TYPE_LOG:
@ -990,6 +1015,7 @@ function servers_get_info($id_server=-1, $sql_limit=-1)
);
$server['type'] = 'log';
$id_modulo = 0;
$server['name'] = __('Log server');
break;
case SERVER_TYPE_MADE:
@ -1003,6 +1029,7 @@ function servers_get_info($id_server=-1, $sql_limit=-1)
);
$server['type'] = 'made';
$id_modulo = 0;
$server['name'] = __('MADE server');
break;
default: