fixed error with node link events list dashboard

This commit is contained in:
marcos 2021-09-01 16:54:07 +02:00
parent f12f3d6cf4
commit f49d6d3088
1 changed files with 10 additions and 2 deletions

View File

@ -613,6 +613,8 @@ class EventsListWidget extends Widget
'tg.nombre as group_name',
];
$home_url = $config['homeurl'];
if ((bool) \is_metaconsole() === false
|| $this->nodeId > 0
) {
@ -626,6 +628,12 @@ class EventsListWidget extends Widget
$fields[] = 'te.server_id';
}
// If its node, get direccion value and contruct rute.
if ($this->nodeId !== null && $this->nodeId > 0) {
$result = db_get_all_rows_sql('SELECT direccion FROM tagente WHERE id_agente = '.$this->nodeId.'');
$home_url = 'http://'.$result[0]['direccion'].'/pandora_console';
}
$events = \events_get_all(
// Fields.
$fields,
@ -684,8 +692,8 @@ class EventsListWidget extends Widget
$agent_alias = \agents_get_alias($event['id_agente']);
if ($agent_alias !== '') {
$data[1] = '<a href="'.$config['homeurl'];
$data[1] .= 'index.php?sec=estado';
$data[1] = '<a href="'.$home_url;
$data[1] .= '/index.php?sec=estado';
$data[1] .= '&sec2=operation/agentes/ver_agente';
$data[1] .= '&id_agente='.$event['id_agente'];
$data[1] .= '" title="'.$event['evento'].'">';