Merge remote-tracking branch 'origin/develop' into ent-4755-base-de-datos-historico-revision

This commit is contained in:
fbsanchez 2021-03-24 13:16:54 +01:00
commit 0179e89740
77 changed files with 1198 additions and 420 deletions

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix package: pandorafms-agent-unix
Version: 7.0NG.752-210322 Version: 7.0NG.752-210324
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
pandora_version="7.0NG.752-210322" pandora_version="7.0NG.752-210324"
echo "Test if you has the tools for to make the packages." echo "Test if you has the tools for to make the packages."
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null

View File

@ -1016,7 +1016,7 @@ my $Sem = undef;
my $ThreadSem = undef; my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.752'; use constant AGENT_VERSION => '7.0NG.752';
use constant AGENT_BUILD => '210322'; use constant AGENT_BUILD => '210324';
# Agent log default file size maximum and instances # Agent log default file size maximum and instances
use constant DEFAULT_MAX_LOG_SIZE => 600000; use constant DEFAULT_MAX_LOG_SIZE => 600000;

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_agent_unix %define name pandorafms_agent_unix
%define version 7.0NG.752 %define version 7.0NG.752
%define release 210322 %define release 210324
Summary: Pandora FMS Linux agent, PERL version Summary: Pandora FMS Linux agent, PERL version
Name: %{name} Name: %{name}

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_agent_unix %define name pandorafms_agent_unix
%define version 7.0NG.752 %define version 7.0NG.752
%define release 210322 %define release 210324
Summary: Pandora FMS Linux agent, PERL version Summary: Pandora FMS Linux agent, PERL version
Name: %{name} Name: %{name}

View File

@ -10,7 +10,7 @@
# ********************************************************************** # **********************************************************************
PI_VERSION="7.0NG.752" PI_VERSION="7.0NG.752"
PI_BUILD="210322" PI_BUILD="210324"
OS_NAME=`uname -s` OS_NAME=`uname -s`
FORCE=0 FORCE=0

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{} {}
Version Version
{210322} {210324}
ViewReadme ViewReadme
{Yes} {Yes}

View File

@ -30,7 +30,7 @@ using namespace Pandora;
using namespace Pandora_Strutils; using namespace Pandora_Strutils;
#define PATH_SIZE _MAX_PATH+1 #define PATH_SIZE _MAX_PATH+1
#define PANDORA_VERSION ("7.0NG.752(Build 210322)") #define PANDORA_VERSION ("7.0NG.752(Build 210324)")
string pandora_path; string pandora_path;
string pandora_dir; string pandora_dir;

View File

@ -11,7 +11,7 @@ BEGIN
VALUE "LegalCopyright", "Artica ST" VALUE "LegalCopyright", "Artica ST"
VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "OriginalFilename", "PandoraAgent.exe"
VALUE "ProductName", "Pandora FMS Windows Agent" VALUE "ProductName", "Pandora FMS Windows Agent"
VALUE "ProductVersion", "(7.0NG.752(Build 210322))" VALUE "ProductVersion", "(7.0NG.752(Build 210324))"
VALUE "FileVersion", "1.0.0.0" VALUE "FileVersion", "1.0.0.0"
END END
END END

View File

@ -1,5 +1,5 @@
package: pandorafms-console package: pandorafms-console
Version: 7.0NG.752-210322 Version: 7.0NG.752-210324
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
pandora_version="7.0NG.752-210322" pandora_version="7.0NG.752-210324"
package_pear=0 package_pear=0
package_pandora=1 package_pandora=1

View File

@ -902,7 +902,9 @@ if ($config['menu_type'] == 'classic') {
blinkpubli(); blinkpubli();
<?php <?php
if ($_GET['refr'] || $do_refresh === true) { if ($_GET['refr']
|| (isset($do_refresh) === true && $do_refresh === true)
) {
if ($_GET['sec2'] == 'operation/events/events') { if ($_GET['sec2'] == 'operation/events/events') {
$autorefresh_draw = true; $autorefresh_draw = true;
} }
@ -966,7 +968,7 @@ if ($config['menu_type'] == 'classic') {
var newValue = btoa(JSON.stringify(values)); var newValue = btoa(JSON.stringify(values));
<?php <?php
// Check if the url has the parameter fb64. // Check if the url has the parameter fb64.
if ($_GET['fb64']) { if (isset($_GET['fb64']) === true) {
$fb64 = $_GET['fb64']; $fb64 = $_GET['fb64'];
?> ?>
var fb64 = '<?php echo $fb64; ?>'; var fb64 = '<?php echo $fb64; ?>';

View File

@ -188,7 +188,12 @@ try {
$double_auth_enabled = (bool) db_get_value('id', 'tuser_double_auth', 'id_user', $config['id_user']); $double_auth_enabled = (bool) db_get_value('id', 'tuser_double_auth', 'id_user', $config['id_user']);
if (!$double_auth_enabled && $config['2FA_all_users'] != '' if (isset($config['2FA_all_users']) === false) {
$config['2FA_all_users'] = null;
}
if (!$double_auth_enabled
&& $config['2FA_all_users'] != ''
&& $config['2Fa_auth'] != '1' && $config['2Fa_auth'] != '1'
&& $config['double_auth_enabled'] && $config['double_auth_enabled']
) { ) {

View File

@ -548,10 +548,7 @@ class AgentsAlerts extends HTML
if (empty($templates_raw)) { if (empty($templates_raw)) {
$templates_raw = []; $templates_raw = [];
} }
} };
// Is needed sort templates for show in the row.
sort($templates);
$alerts = []; $alerts = [];
$ntemplates = 0; $ntemplates = 0;
@ -600,20 +597,22 @@ class AgentsAlerts extends HTML
} }
$templates[$temp['id']] = $temp['name']; $templates[$temp['id']] = $temp['name'];
}
}
if (empty($temp['name']) === false) { foreach ($templates as $id => $name) {
$outputLine = html_print_div( if (empty($name) === false) {
[ $outputLine = html_print_div(
'id' => 'line_header_'.$temp['id'], [
'class' => 'rotate_text_module position_text_module', 'id' => 'line_header_'.$id,
'style' => '', 'class' => 'rotate_text_module position_text_module',
'content' => '<div title="'.io_safe_output($temp['name']).'">'.ui_print_truncate_text(io_safe_output($temp['name']), 20).'</div>', 'style' => '',
], 'content' => '<div title="'.io_safe_output($name).'">'.ui_print_truncate_text(io_safe_output($name), 20).'</div>',
true ],
); true
);
echo sprintf('<th class="th_class_module_r header_table_caption_cell" style="width:%s">%s</th>', $thSize, $outputLine); echo sprintf('<th class="th_class_module_r header_table_caption_cell" style="width:%s">%s</th>', $thSize, $outputLine);
}
} }
} }
@ -651,7 +650,7 @@ class AgentsAlerts extends HTML
$alias = db_get_row('tagente', 'id_agente', $agent['id_agente']); $alias = db_get_row('tagente', 'id_agente', $agent['id_agente']);
echo '<tr>'; echo '<tr>';
// Name of the agent. // Name of the agent.
echo '<td class="bolder right">'.$alias['alias'].'</td>'; echo '<td class="bolder" style="text-align: right" >'.$alias['alias'].'</td>';
// Alerts of the agent. // Alerts of the agent.
foreach ($templates as $tid => $tname) { foreach ($templates as $tid => $tname) {
$anyfired = 0; $anyfired = 0;

View File

@ -666,7 +666,6 @@ class ConsoleSupervisor
case 'NOTIF.PANDORADB.HISTORICAL': case 'NOTIF.PANDORADB.HISTORICAL':
case 'NOTIF.HISTORYDB.MR': case 'NOTIF.HISTORYDB.MR':
case 'NOTIF.EXT.ELASTICSEARCH': case 'NOTIF.EXT.ELASTICSEARCH':
case 'NOTIF.EXT.LOGSTASH':
case 'NOTIF.METACONSOLE.DB_CONNECTION': case 'NOTIF.METACONSOLE.DB_CONNECTION':
case 'NOTIF.DOWNTIME': case 'NOTIF.DOWNTIME':
case 'NOTIF.UPDATEMANAGER.REGISTRATION': case 'NOTIF.UPDATEMANAGER.REGISTRATION':
@ -1804,7 +1803,6 @@ class ConsoleSupervisor
{ {
global $config; global $config;
// Cannot check logstash, configuration is only available from server.
// Cannot check selenium, configuration is only available from server. // Cannot check selenium, configuration is only available from server.
if (isset($config['log_collector']) if (isset($config['log_collector'])
&& $config['log_collector'] == 1 && $config['log_collector'] == 1

View File

@ -782,8 +782,40 @@ class HTML
} }
if (isset($data['form']) === true) { if (isset($data['form']) === true) {
$output_head .= '<form name="'.$form['name'].'" id="'.$form['id'].'" class="discovery '.$form['class'].'" onsubmit="'.$form['onsubmit'].'" enctype="'.$form['enctype'].'" action="'.$form['action'].'" method="'.$form['method']; $output_head .= '<form ';
$output_head .= '" '.$form['extra'].'>'; if (isset($form['name']) === true) {
$output_head .= 'name="'.$form['name'].'" ';
}
if (isset($form['id']) === true) {
$output_head .= 'id="'.$form['id'].'" ';
}
if (isset($form['class']) === true) {
$output_head .= 'class="discovery '.$form['class'].'" ';
}
if (isset($form['onsubmit']) === true) {
$output_head .= 'onsubmit="'.$form['onsubmit'].'" ';
}
if (isset($form['enctype']) === true) {
$output_head .= 'enctype="'.$form['enctype'].'" ';
}
if (isset($form['action']) === true) {
$output_head .= 'action="'.$form['action'].'" ';
}
if (isset($form['method']) === true) {
$output_head .= 'method="'.$form['method'].'" ';
}
if (isset($form['extra']) === true) {
$output_head .= $form['extra'];
}
$output_head .= '>';
} }
if ($return === false) { if ($return === false) {

View File

@ -20,7 +20,7 @@
/** /**
* Pandora build version and version * Pandora build version and version
*/ */
$build_version = 'PC210322'; $build_version = 'PC210324';
$pandora_version = 'v7.0NG.752'; $pandora_version = 'v7.0NG.752';
// Do not overwrite default timezone set if defined. // Do not overwrite default timezone set if defined.
@ -52,6 +52,10 @@ if ((int) $develop_bypass === 1) {
} }
ini_set('display_errors', 1); ini_set('display_errors', 1);
} else {
// Leave user decide error_level, but limit errors to be displayed only in
// logs.
ini_set('display_errors', 0);
} }
// Check if mysqli is available // Check if mysqli is available

View File

@ -3319,7 +3319,7 @@ function get_um_url()
*/ */
function config_return_in_bytes($val) function config_return_in_bytes($val)
{ {
$val = trim($val); $val = (int) trim($val);
$last = strtolower($val[(strlen($val) - 1)]); $last = strtolower($val[(strlen($val) - 1)]);
switch ($last) { switch ($last) {
// The 'G' modifier is available since PHP 5.1.0. // The 'G' modifier is available since PHP 5.1.0.

View File

@ -675,6 +675,33 @@ function events_update_status($id_evento, $status, $filter=null, $history=false)
* *
* @param array $fields Fields to retrieve. * @param array $fields Fields to retrieve.
* @param array $filter Filters to be applied. * @param array $filter Filters to be applied.
* Available filters:
* [
* 'date_from'
* 'time_from'
* 'date_to'
* 'time_to'
* 'event_view_hr'
* 'id_agent'
* 'event_type'
* 'severity'
* 'id_group_filter'
* 'status'
* 'agent_alias'
* 'search'
* 'id_extra'
* 'id_source_event'
* 'user_comment'
* 'source'
* 'id_user_ack'
* 'tag_with'
* 'tag_without'
* 'filter_only_alert'
* 'module_search'
* 'group_rep'
* 'server_id'
* ].
*
* @param integer $offset Offset (pagination). * @param integer $offset Offset (pagination).
* @param integer $limit Limit (pagination). * @param integer $limit Limit (pagination).
* @param string $order Sort order. * @param string $order Sort order.
@ -683,6 +710,8 @@ function events_update_status($id_evento, $status, $filter=null, $history=false)
* @param boolean $return_sql Return SQL (true) or execute it (false). * @param boolean $return_sql Return SQL (true) or execute it (false).
* @param string $having Having filter. * @param string $having Having filter.
* @param boolean $validatedEvents If true, evaluate validated events. * @param boolean $validatedEvents If true, evaluate validated events.
* @param boolean $recursiveGroups If true, filtered groups and their children
* will be search.
* *
* @return array Events. * @return array Events.
* @throws Exception On error. * @throws Exception On error.
@ -697,7 +726,8 @@ function events_get_all(
$history=false, $history=false,
$return_sql=false, $return_sql=false,
$having='', $having='',
$validatedEvents=false $validatedEvents=false,
$recursiveGroups=true
) { ) {
global $config; global $config;
@ -873,17 +903,56 @@ function events_get_all(
} }
$groups = $filter['id_group_filter']; $groups = $filter['id_group_filter'];
if (isset($groups) === true && $groups > 0) { if ((bool) $user_is_admin === false
$children = groups_get_children($groups); && isset($groups) === false
) {
// Not being filtered by group but not an admin, limit results.
$groups = array_keys(users_get_groups(false, 'AR'));
}
$_groups = [ $groups ]; if (isset($groups) === true
if (empty($children) === false) { && (is_array($groups) === true || ($groups > 0))
foreach ($children as $child) { ) {
$_groups[] = (int) $child['id_grupo']; if ($recursiveGroups === true) {
// Add children groups.
$children = [];
if (is_array($groups) === true) {
foreach ($groups as $g) {
$children = array_merge(
groups_get_children($g),
$children
);
}
} else {
$children = groups_get_children($groups);
} }
if (is_array($groups) === true) {
$_groups = $groups;
} else {
$_groups = [ $groups ];
}
if (empty($children) === false) {
foreach ($children as $child) {
$_groups[] = (int) $child['id_grupo'];
}
}
if ((bool) $user_is_admin === false) {
$user_groups = users_get_groups(false, 'AR');
$_groups = array_intersect(
$_groups,
array_keys($user_groups)
);
}
$groups = $_groups;
} }
$groups = $_groups; if (is_array($groups) === false) {
$groups = [ $groups ];
}
$sql_filters[] = sprintf( $sql_filters[] = sprintf(
' AND (te.id_grupo IN (%s) OR tasg.id_group IN (%s))', ' AND (te.id_grupo IN (%s) OR tasg.id_group IN (%s))',
@ -1466,6 +1535,8 @@ function events_get_all(
/** /**
* @deprecated Use events_get_all instead.
*
* Get all rows of events from the database, that * Get all rows of events from the database, that
* pass the filter, and can get only some fields. * pass the filter, and can get only some fields.
* *
@ -1502,7 +1573,9 @@ function events_get_all(
*/ */
function events_get_events($filter=false, $fields=false) function events_get_events($filter=false, $fields=false)
{ {
if ($filter['criticity'] == EVENT_CRIT_WARNING_OR_CRITICAL) { if (isset($filter['criticity']) === true
&& (int) $filter['criticity'] === EVENT_CRIT_WARNING_OR_CRITICAL
) {
$filter['criticity'] = [ $filter['criticity'] = [
EVENT_CRIT_WARNING, EVENT_CRIT_WARNING,
EVENT_CRIT_CRITICAL, EVENT_CRIT_CRITICAL,
@ -7409,3 +7482,40 @@ function events_get_instructions($event)
return $output; return $output;
} }
/**
* Return class name matching criticity received.
*
* @param integer $criticity Event's criticity.
*
* @return string
*/
function events_get_criticity_class($criticity)
{
switch ($criticity) {
case EVENT_CRIT_CRITICAL:
return 'datos_red';
case EVENT_CRIT_MAINTENANCE:
return 'datos_grey';
case EVENT_CRIT_INFORMATIONAL:
return 'datos_blue';
case EVENT_CRIT_MAJOR:
return 'datos_pink';
case EVENT_CRIT_MINOR:
return 'datos_pink';
case EVENT_CRIT_NORMAL:
return 'datos_green';
case EVENT_CRIT_WARNING:
return 'datos_yellow';
default:
return 'datos_blue';
}
}

View File

@ -467,10 +467,9 @@ function html_print_select_groups(
$output = ''; $output = '';
global $config; global $config;
$select2_css = 'select2.min';
if ($config['style'] === 'pandora') { if ($config['style'] === 'pandora_black') {
$select2_css = 'select2.min';
} else {
$select2_css = 'select2_dark.min'; $select2_css = 'select2_dark.min';
} }

View File

@ -227,7 +227,7 @@ function io_safe_output_array(&$item, $key=false, $utf8=true)
* @param string|array $value String or array of strings to be cleaned. * @param string|array $value String or array of strings to be cleaned.
* @param boolean $utf8 Flag, set the output encoding in utf8, by default true. * @param boolean $utf8 Flag, set the output encoding in utf8, by default true.
* *
* @return string * @return mixed
*/ */
function io_safe_output($value, $utf8=true) function io_safe_output($value, $utf8=true)
{ {

View File

@ -5018,25 +5018,25 @@ function reporting_get_agents_by_status($data, $graph_width=250, $graph_height=1
$agent_data = []; $agent_data = [];
$agent_data[0] = html_print_image('images/agent_critical.png', true, ['title' => __('Agents critical')]); $agent_data[0] = html_print_image('images/agent_critical.png', true, ['title' => __('Agents critical')]);
$agent_data[1] = "<a style='color: ".COL_CRITICAL.";' href='".$links['agents_critical']."'><b><span class='red_color font_12pt bolder'>".format_numeric($data['agent_critical']).'</span></b></a>'; $agent_data[1] = "<a style='color: ".COL_CRITICAL.";' href='".$links['agents_critical']."'><b><span class='red_color font_12pt bolder big_data'>".format_numeric($data['agent_critical']).'</span></b></a>';
$agent_data[2] = html_print_image('images/agent_warning.png', true, ['title' => __('Agents warning')]); $agent_data[2] = html_print_image('images/agent_warning.png', true, ['title' => __('Agents warning')]);
$agent_data[3] = "<a style='color: ".COL_WARNING.";' href='".$links['agents_warning']."'><b><span class='yellow_color font_12pt bolder'>".format_numeric($data['agent_warning']).'</span></b></a>'; $agent_data[3] = "<a style='color: ".COL_WARNING.";' href='".$links['agents_warning']."'><b><span class='yellow_color font_12pt bolder big_data'>".format_numeric($data['agent_warning']).'</span></b></a>';
$table_agent->data[] = $agent_data; $table_agent->data[] = $agent_data;
$agent_data = []; $agent_data = [];
$agent_data[0] = html_print_image('images/agent_ok.png', true, ['title' => __('Agents ok')]); $agent_data[0] = html_print_image('images/agent_ok.png', true, ['title' => __('Agents ok')]);
$agent_data[1] = "<a style='color: ".COL_NORMAL.";' href='".$links['agents_ok']."'><b><span class='green_color font_12pt bolder'>".format_numeric($data['agent_ok']).'</span></b></a>'; $agent_data[1] = "<a style='color: ".COL_NORMAL.";' href='".$links['agents_ok']."'><b><span class='green_color font_12pt bolder big_data'>".format_numeric($data['agent_ok']).'</span></b></a>';
$agent_data[2] = html_print_image('images/agent_unknown.png', true, ['title' => __('Agents unknown')]); $agent_data[2] = html_print_image('images/agent_unknown.png', true, ['title' => __('Agents unknown')]);
$agent_data[3] = "<a style='color: ".COL_UNKNOWN.";' href='".$links['agents_unknown']."'><b><span class='grey_color font_12pt bolder'>".format_numeric($data['agent_unknown']).'</span></b></a>'; $agent_data[3] = "<a style='color: ".COL_UNKNOWN.";' href='".$links['agents_unknown']."'><b><span class='grey_color font_12pt bolder big_data'>".format_numeric($data['agent_unknown']).'</span></b></a>';
$table_agent->data[] = $agent_data; $table_agent->data[] = $agent_data;
$agent_data = []; $agent_data = [];
$agent_data[0] = html_print_image('images/agent_notinit.png', true, ['title' => __('Agents not init')]); $agent_data[0] = html_print_image('images/agent_notinit.png', true, ['title' => __('Agents not init')]);
$agent_data[1] = "<a style='color: ".COL_NOTINIT.";' href='".$links['agents_not_init']."'><b><span class='blue_color_ligther font_12pt bolder'>".format_numeric($data['agent_not_init']).'</span></b></a>'; $agent_data[1] = "<a style='color: ".COL_NOTINIT.";' href='".$links['agents_not_init']."'><b><span class='blue_color_ligther font_12pt bolder big_data'>".format_numeric($data['agent_not_init']).'</span></b></a>';
$agent_data[2] = ''; $agent_data[2] = '';
$agent_data[3] = ''; $agent_data[3] = '';

View File

@ -1202,7 +1202,7 @@ function servers_show_type($id)
case 8: case 8:
$return = html_print_image( $return = html_print_image(
'images/module_wux.png', 'images/module-wux.png',
true, true,
[ [
'title' => get_product_name().' WUX server', 'title' => get_product_name().' WUX server',

View File

@ -604,9 +604,11 @@ function snmp_browser_print_oid(
if ($custom_action != '') { if ($custom_action != '') {
$table->head[0] = '<span id="snmp_custom_action">'.$closer.$custom_action.'</span>'; $table->head[0] = '<span id="snmp_custom_action">'.$closer.$custom_action.'</span>';
} else { } else {
$table->headstyle[0] = 'text-align: left';
$table->head[0] = $closer; $table->head[0] = $closer;
} }
$table->headstyle[1] = 'text-align: left';
$table->head[1] = __('OID Information'); $table->head[1] = __('OID Information');
$output .= html_print_table($table, true); $output .= html_print_table($table, true);
@ -636,7 +638,7 @@ function snmp_browser_print_oid(
__('Create network component'), __('Create network component'),
'create_network_component', 'create_network_component',
false, false,
'class="sub add float-left"', 'class="sub add float-left mrgn_right_20px"',
true true
); );
@ -1065,16 +1067,16 @@ function snmp_browser_print_container(
); );
$output .= '<div id="search_results" class="search_results"></div>'; $output .= '<div id="search_results" class="search_results"></div>';
$output .= '<div id="spinner" class="spinner_none_padding">'.html_print_image('images/spinner.gif', true).'</div>'; $output .= '<div id="spinner" class="spinner_none_padding" style="display:none">'.html_print_image('images/spinner.gif', true).'</div>';
$output .= '<div id="snmp_browser">'; $output .= '<div id="snmp_browser">';
$output .= '</div>'; $output .= '</div>';
$output .= '<div class="databox mrgn_5px" id="snmp_data"></div>'; $output .= '<div class="databox" id="snmp_data"></div>';
$output .= '</div>'; $output .= '</div>';
$output .= '</div>'; $output .= '</div>';
$output .= '</div>'; $output .= '</div>';
if ($show_massive_buttons) { if ($show_massive_buttons) {
$output .= '<div id="snmp_create_buttons" class="invisible">'; $output .= '<div id="snmp_create_buttons" style="display:none">';
$output .= html_print_submit_button( $output .= html_print_submit_button(
__('Create agent modules'), __('Create agent modules'),
'create_modules_agent', 'create_modules_agent',

View File

@ -3272,12 +3272,6 @@ function visual_map_get_status_element($layoutData)
} }
} }
$module_value = db_get_sql(
'SELECT datos
FROM tagente_estado
WHERE id_agente_modulo = '.$layoutData['id_agente_modulo']
);
// Linked to other layout ?? - Only if not module defined // Linked to other layout ?? - Only if not module defined
if (!empty($layoutData['id_layout_linked'])) { if (!empty($layoutData['id_layout_linked'])) {
if (!empty($layoutData['linked_layout_node_id'])) { if (!empty($layoutData['linked_layout_node_id'])) {
@ -3379,6 +3373,11 @@ function visual_map_get_status_element($layoutData)
case PERCENTILE_BUBBLE: case PERCENTILE_BUBBLE:
case CIRCULAR_PROGRESS_BAR: case CIRCULAR_PROGRESS_BAR:
case CIRCULAR_INTERIOR_PROGRESS_BAR: case CIRCULAR_INTERIOR_PROGRESS_BAR:
$module_value = db_get_sql(
'SELECT datos
FROM tagente_estado
WHERE id_agente_modulo = '.$layoutData['id_agente_modulo']
);
if (empty($module_value) || $module_value == '') { if (empty($module_value) || $module_value == '') {
return VISUAL_MAP_STATUS_UNKNOWN; return VISUAL_MAP_STATUS_UNKNOWN;
@ -3907,9 +3906,19 @@ function visual_map_get_layout_status($layout_id, $status_data=[], $depth=0)
return VISUAL_MAP_STATUS_UNKNOWN; return VISUAL_MAP_STATUS_UNKNOWN;
} }
$layout_items = db_get_all_rows_filter( $layout_items = db_get_all_rows_sql(
'tlayout_data', sprintf(
['id_layout' => $layout_id] 'SELECT tld.*
FROM tlayout_data tld
LEFT JOIN tagente ta
ON ta.id_agente=tld.id_agent
LEFT JOIN tagente_modulo tam
ON tam.id_agente_modulo = tld.id_agente_modulo
WHERE tld.id_layout = %d
AND (ta.disabled = 0 OR ta.disabled is null)
AND (tam.disabled = 0 OR tam.disabled is null)',
$layout_id
)
); );
if ($layout_items === false) { if ($layout_items === false) {

View File

@ -1000,3 +1000,11 @@ function check_massive_response_event(
counter++; counter++;
}); });
} }
function event_widget_options() {
if ($("#customFilter").val() != "-1") {
$(".event-widget-input").disable();
} else {
$(".event-widget-input").enable();
}
}

View File

@ -202,33 +202,70 @@ function load_modal(settings) {
if (Array.isArray(settings.form) === false) { if (Array.isArray(settings.form) === false) {
$("#" + settings.form + " :input").each(function() { $("#" + settings.form + " :input").each(function() {
if (this.checkValidity() === false) { if (this.checkValidity() === false) {
$(this).attr("title", this.validationMessage); var select2 = $(this).attr("data-select2-id");
$(this).tooltip({ if (typeof select2 !== typeof undefined && select2 !== false) {
tooltipClass: "uitooltip", $(this)
position: { .next()
my: "right bottom", .attr("title", this.validationMessage);
at: "right top", $(this)
using: function(position, feedback) { .next()
$(this).css(position); .tooltip({
$("<div>") tooltipClass: "uitooltip",
.addClass("arrow") position: {
.addClass(feedback.vertical) my: "right bottom",
.addClass(feedback.horizontal) at: "right top",
.appendTo(this); using: function(position, feedback) {
} $(this).css(position);
} $("<div>")
}); .addClass("arrow")
$(this).tooltip("open"); .addClass(feedback.vertical)
.addClass(feedback.horizontal)
.appendTo(this);
}
}
});
$(this)
.next()
.tooltip("open");
var element = $(this); var element = $(this).next();
setTimeout( setTimeout(
function(element) { function(element) {
element.tooltip("destroy"); element.tooltip("destroy");
element.removeAttr("title"); element.removeAttr("title");
}, },
3000, 3000,
element element
); );
} else {
$(this).attr("title", this.validationMessage);
$(this).tooltip({
tooltipClass: "uitooltip",
position: {
my: "right bottom",
at: "right top",
using: function(position, feedback) {
$(this).css(position);
$("<div>")
.addClass("arrow")
.addClass(feedback.vertical)
.addClass(feedback.horizontal)
.appendTo(this);
}
}
});
$(this).tooltip("open");
var element = $(this);
setTimeout(
function(element) {
element.tooltip("destroy");
element.removeAttr("title");
},
3000,
element
);
}
flagError = true; flagError = true;
} }

View File

@ -455,7 +455,6 @@ function createVisualConsole(
}, },
createItem: function(typeString) { createItem: function(typeString) {
var type; var type;
console.log(typeString);
switch (typeString) { switch (typeString) {
case "STATIC_GRAPH": case "STATIC_GRAPH":
type = 0; type = 0;

View File

@ -641,6 +641,14 @@ var TreeController = {
$content.append($statusImage); $content.append($statusImage);
} }
var image_tooltip =
'<span><img src="' +
(controller.baseURL.length > 0 ? controller.baseURL : "") +
'images/help.png" class="img_help" title="' +
element.name +
'" alt="' +
element.name +
'"/></span> ';
var $serviceDetailImage = $( var $serviceDetailImage = $(
'<img src="' + '<img src="' +
@ -661,6 +669,8 @@ var TreeController = {
.css("cursor", "pointer"); .css("cursor", "pointer");
$content.append($serviceDetailImage); $content.append($serviceDetailImage);
$content.append(" " + image_tooltip);
if ( if (
typeof element.elementDescription !== "undefined" && typeof element.elementDescription !== "undefined" &&
element.elementDescription != "" element.elementDescription != ""
@ -674,7 +684,6 @@ var TreeController = {
} else { } else {
$content.append(" " + element.name); $content.append(" " + element.name);
} }
// $content.append(" " + element.name);
} else { } else {
$content.remove($node); $content.remove($node);
} }

View File

@ -257,6 +257,23 @@ class Manager
$extradata = \get_parameter('extradata', ''); $extradata = \get_parameter('extradata', '');
if (empty($extradata) === false) { if (empty($extradata) === false) {
$extradata = json_decode(\io_safe_output($extradata), true); $extradata = json_decode(\io_safe_output($extradata), true);
if (isset($extradata['dashboardId']) === false) {
$extradata['dashboardId'] = null;
}
if (isset($extradata['cellId']) === false) {
$extradata['cellId'] = null;
}
if (isset($extradata['offset']) === false) {
$extradata['offset'] = null;
}
if (isset($extradata['widgetId']) === false) {
$extradata['widgetId'] = null;
}
$this->dashboardId = (int) $extradata['dashboardId']; $this->dashboardId = (int) $extradata['dashboardId'];
$this->cellId = (int) $extradata['cellId']; $this->cellId = (int) $extradata['cellId'];
$this->offset = (int) $extradata['offset']; $this->offset = (int) $extradata['offset'];
@ -1031,6 +1048,10 @@ class Manager
); );
} }
if (isset($config['public_dashboard']) === false) {
$config['public_dashboard'] = false;
}
// View. // View.
if ($this->slides === 0 || $this->cellModeSlides === 0) { if ($this->slides === 0 || $this->cellModeSlides === 0) {
View::render( View::render(
@ -1341,6 +1362,7 @@ class Manager
$instance = $this->instanceWidget(); $instance = $this->instanceWidget();
$htmlInputs = $instance->getFormInputs([]); $htmlInputs = $instance->getFormInputs([]);
$js = $instance->getFormJS();
View::render( View::render(
'dashboard/configurationWidgets', 'dashboard/configurationWidgets',
@ -1348,6 +1370,7 @@ class Manager
'dashboardId' => $this->dashboardId, 'dashboardId' => $this->dashboardId,
'cellId' => $this->cellId, 'cellId' => $this->cellId,
'htmlInputs' => $htmlInputs, 'htmlInputs' => $htmlInputs,
'js' => $js,
] ]
); );
@ -1450,4 +1473,21 @@ class Manager
} }
/**
* Prints error.
*
* @param string $msg Message.
*
* @return void
*/
public function error(string $msg)
{
if ((bool) \is_ajax() === true) {
echo json_encode(['error' => $msg]);
} else {
\ui_print_error_message($msg);
}
}
} }

View File

@ -21,7 +21,7 @@ class Widget
* *
* @var integer * @var integer
*/ */
private $cellId; protected $cellId;
/** /**
* Widget Id. * Widget Id.
@ -99,8 +99,6 @@ class Widget
*/ */
public function getOptionsWidget():array public function getOptionsWidget():array
{ {
global $config;
$result = []; $result = [];
if (empty($this->dataCell['options']) === false) { if (empty($this->dataCell['options']) === false) {
$result = \json_decode($this->dataCell['options'], true); $result = \json_decode($this->dataCell['options'], true);
@ -591,4 +589,48 @@ class Widget
} }
/**
* Get description should be implemented for each child.
*
* @return string
*/
public static function getDescription()
{
return '**NOT DEFINED**';
}
/**
* Load should be implemented for each child.
*
* @return string
*/
public function load()
{
return '**NOT DEFINED**';
}
/**
* Get name should be implemented for each child.
*
* @return string
*/
public static function getName()
{
return '**NOT DEFINED**';
}
/**
* Return aux javascript code for forms.
*
* @return string
*/
public function getFormJS()
{
return '';
}
} }

View File

@ -172,7 +172,7 @@ class EventsListWidget extends Widget
$this->className = $class->getShortName(); $this->className = $class->getShortName();
// Title. // Title.
$this->title = __('List of latest events'); $this->title = \__('List of latest events');
// Name. // Name.
if (empty($this->name) === true) { if (empty($this->name) === true) {
@ -242,6 +242,14 @@ class EventsListWidget extends Widget
$values['groupId'] = $decoder['id_groups']; $values['groupId'] = $decoder['id_groups'];
} }
if (isset($decoder['groupRecursion']) === true) {
$values['groupRecursion'] = $decoder['groupRecursion'];
}
if (isset($decoder['customFilter']) === true) {
$values['customFilter'] = $decoder['customFilter'];
}
if (isset($decoder['groupId']) === true) { if (isset($decoder['groupId']) === true) {
$values['groupId'] = $decoder['groupId']; $values['groupId'] = $decoder['groupId'];
} }
@ -254,6 +262,17 @@ class EventsListWidget extends Widget
} }
/**
* Aux javascript to be run after form load.
*
* @return string
*/
public function getFormJS(): string
{
return '$( document ).ready(function() {event_widget_options();});';
}
/** /**
* Generates inputs for form (specific). * Generates inputs for form (specific).
* *
@ -270,8 +289,23 @@ class EventsListWidget extends Widget
// Retrieve global - common inputs. // Retrieve global - common inputs.
$inputs = parent::getFormInputs(); $inputs = parent::getFormInputs();
// Select pre built filter.
$inputs[] = [
'label' => \__('Custom filters'),
'arguments' => [
'type' => 'select',
'id' => 'select-custom-filter',
'fields' => \events_get_event_filter_select(false),
'name' => 'customFilter',
'script' => 'event_widget_options();',
'nothing' => \__('None'),
'nothing_value' => -1,
'selected' => $this->values['customFilter'],
],
];
$fields = \get_event_types(); $fields = \get_event_types();
$fields['not_normal'] = __('Not normal'); $fields['not_normal'] = \__('Not normal');
// Default values. // Default values.
if (isset($values['maxHours']) === false) { if (isset($values['maxHours']) === false) {
@ -284,24 +318,26 @@ class EventsListWidget extends Widget
// Event Type. // Event Type.
$inputs[] = [ $inputs[] = [
'label' => __('Event type'), 'label' => \__('Event type'),
'arguments' => [ 'arguments' => [
'type' => 'select', 'type' => 'select',
'fields' => $fields, 'fields' => $fields,
'class' => 'event-widget-input',
'name' => 'eventType', 'name' => 'eventType',
'selected' => $values['eventType'], 'selected' => $values['eventType'],
'return' => true, 'return' => true,
'nothing' => __('Any'), 'nothing' => \__('Any'),
'nothing_value' => 0, 'nothing_value' => 0,
], ],
]; ];
// Max. hours old. Default 8. // Max. hours old. Default 8.
$inputs[] = [ $inputs[] = [
'label' => __('Max. hours old'), 'label' => \__('Max. hours old'),
'arguments' => [ 'arguments' => [
'name' => 'maxHours', 'name' => 'maxHours',
'type' => 'number', 'type' => 'number',
'class' => 'event-widget-input',
'value' => $values['maxHours'], 'value' => $values['maxHours'],
'return' => true, 'return' => true,
'min' => 0, 'min' => 0,
@ -320,10 +356,11 @@ class EventsListWidget extends Widget
]; ];
$inputs[] = [ $inputs[] = [
'label' => __('Limit'), 'label' => \__('Limit'),
'arguments' => [ 'arguments' => [
'type' => 'select', 'type' => 'select',
'fields' => $fields, 'fields' => $fields,
'class' => 'event-widget-input',
'name' => 'limit', 'name' => 'limit',
'selected' => $values['limit'], 'selected' => $values['limit'],
'return' => true, 'return' => true,
@ -332,16 +369,17 @@ class EventsListWidget extends Widget
// Event status. // Event status.
$fields = [ $fields = [
-1 => __('All event'), -1 => \__('All event'),
1 => __('Only validated'), 1 => \__('Only validated'),
0 => __('Only pending'), 0 => \__('Only pending'),
]; ];
$inputs[] = [ $inputs[] = [
'label' => __('Event status'), 'label' => \__('Event status'),
'arguments' => [ 'arguments' => [
'type' => 'select', 'type' => 'select',
'fields' => $fields, 'fields' => $fields,
'class' => 'event-widget-input',
'name' => 'eventStatus', 'name' => 'eventStatus',
'selected' => $values['eventStatus'], 'selected' => $values['eventStatus'],
'return' => true, 'return' => true,
@ -352,14 +390,15 @@ class EventsListWidget extends Widget
$fields = \get_priorities(); $fields = \get_priorities();
$inputs[] = [ $inputs[] = [
'label' => __('Severity'), 'label' => \__('Severity'),
'arguments' => [ 'arguments' => [
'type' => 'select', 'type' => 'select',
'fields' => $fields, 'fields' => $fields,
'class' => 'event-widget-input',
'name' => 'severity', 'name' => 'severity',
'selected' => $values['severity'], 'selected' => $values['severity'],
'return' => true, 'return' => true,
'nothing' => __('All'), 'nothing' => \__('All'),
'nothing_value' => -1, 'nothing_value' => -1,
], ],
]; ];
@ -367,17 +406,22 @@ class EventsListWidget extends Widget
$return_all_group = false; $return_all_group = false;
$selected_groups_array = explode(',', $values['groupId'][0]); $selected_groups_array = explode(',', $values['groupId'][0]);
if (users_can_manage_group_all('RM') || ($selected_groups_array[0] !== '' && in_array(0, $selected_groups_array) === true)) { if ((bool) \users_can_manage_group_all('RM') === true
// Return all group if user has permissions or it is a currently selected group. || ($selected_groups_array[0] !== ''
&& in_array(0, $selected_groups_array) === true)
) {
// Return all group if user has permissions or it is a currently
// selected group.
$return_all_group = true; $return_all_group = true;
} }
// Groups. // Groups.
$inputs[] = [ $inputs[] = [
'label' => __('Groups'), 'label' => \__('Groups'),
'arguments' => [ 'arguments' => [
'type' => 'select_groups', 'type' => 'select_groups',
'name' => 'groupId[]', 'name' => 'groupId[]',
'class' => 'event-widget-input',
'returnAllGroup' => true, 'returnAllGroup' => true,
'privilege' => 'AR', 'privilege' => 'AR',
'selected' => $selected_groups_array, 'selected' => $selected_groups_array,
@ -387,18 +431,33 @@ class EventsListWidget extends Widget
], ],
]; ];
// Group recursion.
$inputs[] = [
'label' => \__('Group recursion'),
'arguments' => [
'type' => 'switch',
'name' => 'groupRecursion',
'class' => 'event-widget-input',
'value' => $values['groupRecursion'],
'return' => true,
],
];
// Tags. // Tags.
$fields = tags_get_user_tags($config['id_user'], 'AR'); $fields = \tags_get_user_tags($config['id_user'], 'AR');
$inputs[] = [ $inputs[] = [
'label' => __('Tags'), 'label' => \__('Tags'),
'arguments' => [ 'arguments' => [
'type' => 'select', 'type' => 'select',
'fields' => $fields, 'fields' => $fields,
'name' => 'tagsId[]', 'class' => 'event-widget-input',
'selected' => explode(',', $values['tagsId'][0]), 'name' => 'tagsId[]',
'return' => true, 'selected' => explode(',', $values['tagsId'][0]),
'multiple' => true, 'return' => true,
'multiple' => true,
'nothing' => __('None'),
'nothing_value' => 0,
], ],
]; ];
@ -423,6 +482,8 @@ class EventsListWidget extends Widget
$values['severity'] = \get_parameter_switch('severity', -1); $values['severity'] = \get_parameter_switch('severity', -1);
$values['groupId'] = \get_parameter_switch('groupId', []); $values['groupId'] = \get_parameter_switch('groupId', []);
$values['tagsId'] = \get_parameter_switch('tagsId', []); $values['tagsId'] = \get_parameter_switch('tagsId', []);
$values['groupRecursion'] = \get_parameter_switch('groupRecursion', 0);
$values['customFilter'] = \get_parameter('customFilter', -1);
return $values; return $values;
} }
@ -439,99 +500,144 @@ class EventsListWidget extends Widget
$output = ''; $output = '';
$return_all_group = false; \ui_require_css_file('events', 'include/styles/', true);
\ui_require_css_file('tables', 'include/styles/', true);
if (users_can_manage_group_all('RM')) {
$return_all_group = true;
}
$user_groups = \users_get_groups(false, 'AR', $return_all_group);
ui_require_css_file('events', 'include/styles/', true);
ui_require_css_file('tables', 'include/styles/', true);
$this->values['groupId'] = explode(',', $this->values['groupId'][0]); $this->values['groupId'] = explode(',', $this->values['groupId'][0]);
$this->values['tagsId'] = explode(',', $this->values['tagsId'][0]); $this->values['tagsId'] = explode(',', $this->values['tagsId'][0]);
if (empty($this->values['groupId']) === true) { if (empty($this->values['groupId']) === true) {
$output .= __('You must select some group'); $output .= \__('You must select some group');
return $output; return $output;
} }
$useTags = \tags_has_user_acl_tags($config['id_user']); $useTags = (bool) \tags_has_user_acl_tags($config['id_user']);
if ($useTags) { if ($useTags === true) {
if (empty($this->values['tagsId']) === true) { if (empty($this->values['tagsId']) === true) {
$output .= __('You don\'t have access'); $output .= \__('You don\'t have access');
return; return;
} }
} }
$hours = ($this->values['maxHours'] * SECONDS_1HOUR); $hours = ($this->values['maxHours'] * SECONDS_1HOUR);
$unixtime = (get_system_time() - $hours);
// Put hours in seconds. // Put hours in seconds.
$filter = []; $filter = [];
// Group all. $order = [];
if (in_array(0, $this->values['groupId'])) {
$filter['id_grupo'] = array_keys($user_groups);
} else {
$filter['id_grupo'] = array_intersect($this->values['groupId'], array_keys($user_groups));
}
if (empty($filter['id_grupo'])) { $customFilter = \events_get_event_filter($this->values['customFilter']);
$output .= '<div class="container-center">'; if ($customFilter !== false) {
$output .= \ui_print_error_message( $filter = $customFilter;
__('You have no access'), $filter['tag_with'] = base64_encode(
'', json_encode($filter['tag_with'])
true
); );
$output .= '</div>';
return $output;
}
$filter['utimestamp'] = '>'.$unixtime; $filter['tag_without'] = base64_encode(
json_encode($filter['tag_without'])
);
} else {
// Filtering.
$filter['event_view_hr'] = $hours;
if (empty($this->values['eventType']) === false) { // Group.
$filter['event_type'] = $this->values['eventType']; $filter['id_group_filter'] = $this->values['groupId'];
if (empty($filter['id_group_filter']) === true
if ($filter['event_type'] === 'warning' || $filter['id_group_filter'][0] === ''
|| $filter['event_type'] === 'critical' || $filter['id_group_filter'][0] === '0'
|| $filter['event_type'] === 'normal'
) { ) {
$filter['event_type'] = '%'.$filter['event_type'].'%'; // No filter specified. Don't filter at all...
} else if ($filter['event_type'] === 'not_normal') { $filter['id_group_filter'] = null;
unset($filter['event_type']); }
$filter[] = '(event_type REGEXP "warning|critical|unknown")';
// Tags.
if (empty($this->values['tagsId']) === false) {
$filter['tag_with'] = base64_encode(
json_encode($this->values['tagsId'])
);
}
// Severity.
if (isset($this->values['severity']) === true) {
$filter['severity'] = $this->values['severity'];
}
// Event types.
if (empty($this->values['eventType']) === false) {
$filter['event_type'] = $this->values['eventType'];
}
// Event status.
if ((int) $this->values['eventStatus'] !== -1) {
$filter['status'] = $this->values['eventStatus'];
} }
} }
if ((int) $this->values['eventStatus'] !== -1) { // Order.
$filter['estado'] = $this->values['eventStatus']; $order['field'] = 'timestamp';
$order['direction'] = 'DESC';
$fields = [
'te.id_evento',
'te.id_agente',
'te.id_usuario',
'te.id_grupo',
'te.estado',
'te.timestamp',
'te.evento',
'te.utimestamp',
'te.event_type',
'te.id_alert_am',
'te.criticity',
'te.user_comment',
'te.tags',
'te.source',
'te.id_extra',
'te.critical_instructions',
'te.warning_instructions',
'te.unknown_instructions',
'te.owner_user',
'if(te.ack_utimestamp > 0, from_unixtime(te.ack_utimestamp),"") as ack_utimestamp',
'te.custom_data',
'te.data',
'te.module_status',
'ta.alias as agent_name',
'tg.nombre as group_name',
];
if ((bool) \is_metaconsole() === false) {
$fields[] = 'am.nombre as module_name';
$fields[] = 'am.id_agente_modulo as id_agentmodule';
$fields[] = 'am.custom_id as module_custom_id';
$fields[] = 'ta.server_name as server_name';
} else {
$fields[] = 'ts.server_name as server_name';
$fields[] = 'te.id_agentmodule';
$fields[] = 'te.server_id';
} }
$filter['limit'] = $this->values['limit']; $events = \events_get_all(
$filter['order'] = '`utimestamp` DESC'; // Fields.
$fields,
if (isset($this->values['severity']) === true) { // Filter.
if ((int) $this->values['severity'] === 20) { $filter,
$filter['criticity'] = [ // Offset.
EVENT_CRIT_WARNING, null,
EVENT_CRIT_CRITICAL, // Limit.
]; $this->values['limit'],
} else if ((int) $this->values['severity'] !== -1) { // Order.
$filter['criticity'] = $this->values['severity']; $order['direction'],
} // Sort field.
} $order['field'],
// History.
if (empty($this->values['tagsId']) === false) { false,
foreach ($this->values['tagsId'] as $tag) { // SQL.
$tag_name[$tag] = \tags_get_name($tag); false,
} // Having.
'',
$filter['tags'] = $tag_name; // ValidatedEvents.
} false,
// Recursive Groups.
$events = \events_get_events($filter); (bool) $this->values['groupRecursion']
);
if ($events === false) { if ($events === false) {
$events = []; $events = [];
@ -542,9 +648,9 @@ class EventsListWidget extends Widget
&& is_array($events) === true && is_array($events) === true
&& empty($events) === false && empty($events) === false
) { ) {
$output .= html_print_input_hidden( $output .= \html_print_input_hidden(
'ajax_file', 'ajax_file',
ui_get_full_url('ajax.php', false, false, false), \ui_get_full_url('ajax.php', false, false, false),
true true
); );
@ -558,15 +664,10 @@ class EventsListWidget extends Widget
foreach ($events as $event) { foreach ($events as $event) {
$data = []; $data = [];
$event['evento'] = io_safe_output($event['evento']); $event['evento'] = \io_safe_output($event['evento']);
if ($event['estado'] === 0) {
$img = 'images/pixel_red.png';
} else {
$img = 'images/pixel_green.png';
}
$data[0] = events_print_type_img($event['event_type'], true); $data[0] = \events_print_type_img($event['event_type'], true);
$agent_alias = agents_get_alias($event['id_agente']); $agent_alias = \agents_get_alias($event['id_agente']);
if ($agent_alias !== '') { if ($agent_alias !== '') {
$data[1] = '<a href="'.$config['homeurl']; $data[1] = '<a href="'.$config['homeurl'];
@ -577,15 +678,27 @@ class EventsListWidget extends Widget
$data[1] .= $agent_alias; $data[1] .= $agent_alias;
$data[1] .= '</a>'; $data[1] .= '</a>';
} else { } else {
$data[1] = '<em>'.__('Unknown').'</em>'; $data[1] = '&nbsp;';
} }
if (isset($event['event_rep']) === true
&& $event['event_rep'] > 1
) {
$data[1] .= ' ('.$event['event_rep'].')';
}
// Group.
$data[2] = $event['group_name'];
// Tags.
$data[3] = $event['tags'];
$settings = json_encode( $settings = json_encode(
[ [
'event' => $event, 'event' => $event,
'page' => 'include/ajax/events', 'page' => 'include/ajax/events',
'cellId' => $id_cell, 'cellId' => $this->cellId,
'ajaxUrl' => ui_get_full_url( 'ajaxUrl' => \ui_get_full_url(
'ajax.php', 'ajax.php',
false, false,
false, false,
@ -596,35 +709,40 @@ class EventsListWidget extends Widget
); );
if ($this->publicLink === false) { if ($this->publicLink === false) {
$data[2] = '<a href="javascript:"onclick="dashboardShowEventDialog(\''.base64_encode($settings).'\');">'; $data[4] = '<a href="javascript:"onclick="';
$data[4] .= 'dashboardShowEventDialog(\'';
$data[4] .= base64_encode($settings).'\');">';
} }
$data[2] .= substr(io_safe_output($event['evento']), 0, 150); $data[4] .= substr(\io_safe_output($event['evento']), 0, 150);
if (strlen($event['evento']) > 150) { if (strlen($event['evento']) > 150) {
$data[2] .= '...'; $data[4] .= '...';
} }
if ($this->publicLink === false) { if ($this->publicLink === false) {
$data[2] .= '<a>'; $data[4] .= '<a>';
} }
$data[3] = ui_print_timestamp($event['timestamp'], true); $data[5] = \ui_print_timestamp($event['timestamp'], true);
$table->data[$i] = $data; $table->data[$i] = $data;
$table->cellstyle[$i][0] = 'background: #E8E8E8;'; $table->cellstyle[$i][0] = 'background: #E8E8E8;';
$rowclass = get_priority_class($event['criticity']); $rowclass = \events_get_criticity_class($event['criticity']);
$table->cellclass[$i][1] = $rowclass; $table->cellclass[$i][1] = $rowclass;
$table->cellclass[$i][2] = $rowclass; $table->cellclass[$i][2] = $rowclass;
$table->cellclass[$i][3] = $rowclass; $table->cellclass[$i][3] = $rowclass;
$table->cellclass[$i][4] = $rowclass;
$table->cellclass[$i][5] = $rowclass;
$i++; $i++;
} }
$output .= html_print_table($table, true); $output .= \html_print_table($table, true);
$output .= "<div id='event_details_window'></div>"; $output .= "<div id='event_details_window'></div>";
$output .= "<div id='event_response_window'></div>"; $output .= "<div id='event_response_window'></div>";
$output .= "<div id='event_response_command_window' title='".__('Parameters')."'></div>"; $output .= "<div id='event_response_command_window' title='";
$output .= ui_require_javascript_file( $output .= \__('Parameters')."'></div>";
$output .= \ui_require_javascript_file(
'pandora_events', 'pandora_events',
'include/javascript/', 'include/javascript/',
true true
@ -632,7 +750,7 @@ class EventsListWidget extends Widget
} else { } else {
$output .= '<div class="container-center">'; $output .= '<div class="container-center">';
$output .= \ui_print_info_message( $output .= \ui_print_info_message(
__('There are no events matching selected search filters'), \__('There are no events matching selected search filters'),
'', '',
true true
); );
@ -650,7 +768,7 @@ class EventsListWidget extends Widget
*/ */
public static function getDescription() public static function getDescription()
{ {
return __('List of latest events'); return \__('List of latest events');
} }

View File

@ -283,7 +283,6 @@ class ModuleTableValueWidget extends Widget
'label' => __('Module'), 'label' => __('Module'),
'arguments' => [ 'arguments' => [
'type' => 'autocomplete_module', 'type' => 'autocomplete_module',
'fields' => $fields,
'name' => 'moduleId', 'name' => 'moduleId',
'selected' => $values['moduleId'], 'selected' => $values['moduleId'],
'return' => true, 'return' => true,
@ -291,7 +290,9 @@ class ModuleTableValueWidget extends Widget
'agent_id' => $values['agentId'], 'agent_id' => $values['agentId'],
'metaconsole_id' => $values['metaconsoleId'], 'metaconsole_id' => $values['metaconsoleId'],
'style' => 'width: inherit;', 'style' => 'width: inherit;',
'filter_modules' => users_access_to_agent($values['agentId']) === false ? [$values['moduleId']] : [], 'filter_modules' => users_access_to_agent(
($values['agentId']) === false
) ? [$values['moduleId']] : [],
], ],
]; ];
@ -308,12 +309,12 @@ class ModuleTableValueWidget extends Widget
]; ];
$fields = [ $fields = [
'&lt;br&gt;' => __('Carriage Return'), '&#x0a;' => __('Carriage Return'),
'|' => __('Vertical Bar'), '|' => __('Vertical Bar'),
';' => __('Semicolon'), ';' => __('Semicolon'),
':' => __('Colon'), ':' => __('Colon'),
',' => __('Commas'), ',' => __('Commas'),
'&nbsp;' => __('Blank'), '&#x20;' => __('Blank'),
]; ];
$inputs[] = [ $inputs[] = [
@ -358,11 +359,7 @@ class ModuleTableValueWidget extends Widget
*/ */
public function load() public function load()
{ {
global $config;
$output = ''; $output = '';
$id_agent = $this->values['agentId'];
$id_group = \agents_get_agent_group($id_agent);
$id_module = $this->values['moduleId']; $id_module = $this->values['moduleId'];
$size_text = $this->values['sizeLabel']; $size_text = $this->values['sizeLabel'];
@ -370,33 +367,11 @@ class ModuleTableValueWidget extends Widget
$data_module = modules_get_last_value($id_module); $data_module = modules_get_last_value($id_module);
$value = (string) $data_module; $value = (string) $data_module;
$array_values = explode('&#x0a;', io_safe_input($value)); $value = str_replace(
io_safe_output($this->values['separator']),
if (isset($array_values) === true && is_array($array_values) === true) { '<br/>',
io_safe_output_array($array_values); $value
);
$value = implode(
io_safe_output(
$this->values['separator']
),
$array_values
);
$value = preg_replace(
'/'.$this->values['separator'].'/i',
'<br>',
$value
);
} else {
$value = preg_replace(
'/\n/i',
io_safe_output(
$this->values['separator']
),
io_safe_output($value)
);
$value = preg_replace('/\s/i', '&nbsp;', $value);
}
$output .= '<div class="container-center">'; $output .= '<div class="container-center">';
$output .= '<div class="container-icon">'; $output .= '<div class="container-icon">';

View File

@ -274,12 +274,16 @@ class SystemGroupStatusWidget extends Widget
if ($values['groupId']) { if ($values['groupId']) {
$selected_groups = explode(',', $values['groupId'][0]); $selected_groups = explode(',', $values['groupId'][0]);
if (users_can_manage_group_all('RM') || ($selected_groups[0] !== '' && in_array(0, $selected_groups) === true)) { if (users_can_manage_group_all('RM') === true
// Return all group if user has permissions or it is a currently selected group. || ($selected_groups[0] !== ''
&& in_array(0, $selected_groups) === true)
) {
// Return all group if user has permissions
// or it is a currently selected group.
$return_all_group = true; $return_all_group = true;
} }
} else { } else {
if (users_can_manage_group_all('RM')) { if (users_can_manage_group_all('RM') === true) {
$return_all_group = true; $return_all_group = true;
} }
} }
@ -365,7 +369,7 @@ class SystemGroupStatusWidget extends Widget
$return_all_group = false; $return_all_group = false;
if (users_can_manage_group_all('AR')) { if (users_can_manage_group_all('AR') === true) {
$return_all_group = true; $return_all_group = true;
} }
@ -374,16 +378,18 @@ class SystemGroupStatusWidget extends Widget
$selected_groups = explode(',', $this->values['groupId'][0]); $selected_groups = explode(',', $this->values['groupId'][0]);
if ($selected_groups[0] === '') { if ($selected_groups[0] === '') {
return; return false;
} }
$all_counters = []; $all_counters = [];
if (in_array(0, $selected_groups)) { if (in_array(0, $selected_groups) === true) {
$all_groups = db_get_all_rows_sql('select id_grupo from tgrupo'); $all_groups = db_get_all_rows_sql('select id_grupo from tgrupo');
$all_groups_id = array_column($all_groups, 'id_grupo'); $all_groups_id = array_column($all_groups, 'id_grupo');
$all_groups_counters = groupview_get_modules_counters($all_groups_id); $all_groups_counters = groupview_get_modules_counters(
$all_groups_id
);
$all_counters['g'] = 0; $all_counters['g'] = 0;
$all_counters['name'] = __('All'); $all_counters['name'] = __('All');
@ -512,7 +518,7 @@ class SystemGroupStatusWidget extends Widget
$outputLine .= '<a title="'.__('Modules in normal status'); $outputLine .= '<a title="'.__('Modules in normal status');
$outputLine .= '" class="group_view_data"'; $outputLine .= '" class="group_view_data"';
$outputLine .= ' style="'.$style.'"'; $outputLine .= ' style="'.$style.'"';
$outputLine .= $show_link === true ? '" href="'.$url : ''; $outputLine .= ($show_link === true) ? '" href="'.$url : '';
$outputLine .= '&status='.AGENT_STATUS_NORMAL.'">'; $outputLine .= '&status='.AGENT_STATUS_NORMAL.'">';
$outputLine .= $group['total_module_normal']; $outputLine .= $group['total_module_normal'];
$outputLine .= '</a>'; $outputLine .= '</a>';
@ -528,7 +534,7 @@ class SystemGroupStatusWidget extends Widget
$outputLine .= '<a title="'.__('Modules in warning status'); $outputLine .= '<a title="'.__('Modules in warning status');
$outputLine .= '" class="group_view_data"'; $outputLine .= '" class="group_view_data"';
$outputLine .= ' style="'.$style.'"'; $outputLine .= ' style="'.$style.'"';
$outputLine .= $show_link === true ? '" href="'.$url : ''; $outputLine .= ($show_link === true) ? '" href="'.$url : '';
$outputLine .= '&status='.AGENT_STATUS_WARNING.'">'; $outputLine .= '&status='.AGENT_STATUS_WARNING.'">';
$outputLine .= $group['total_module_warning']; $outputLine .= $group['total_module_warning'];
$outputLine .= '</a>'; $outputLine .= '</a>';
@ -545,7 +551,7 @@ class SystemGroupStatusWidget extends Widget
$outputLine .= __('Modules in critical status'); $outputLine .= __('Modules in critical status');
$outputLine .= '" class="group_view_data"'; $outputLine .= '" class="group_view_data"';
$outputLine .= ' style="'.$style.'"'; $outputLine .= ' style="'.$style.'"';
$outputLine .= $show_link === true ? '" href="'.$url : ''; $outputLine .= ($show_link === true) ? '" href="'.$url : '';
$outputLine .= '&status='.AGENT_STATUS_CRITICAL.'">'; $outputLine .= '&status='.AGENT_STATUS_CRITICAL.'">';
$outputLine .= $group['total_module_critical']; $outputLine .= $group['total_module_critical'];
$outputLine .= '</a>'; $outputLine .= '</a>';
@ -556,12 +562,17 @@ class SystemGroupStatusWidget extends Widget
} }
if ($show_alert_fired === true) { if ($show_alert_fired === true) {
$url_alert = $config['homeurl'];
$url_alert .= 'index.php?sec=view&';
$url_alert .= 'sec2=operation/agentes/alerts_status';
$url_alert .= '&ag_group='.$group['g'];
$outputLine = '<div class="bg_ff9">'; $outputLine = '<div class="bg_ff9">';
$outputLine .= '<span>'; $outputLine .= '<span>';
$outputLine .= '<a title="'.__('Alerts fired'); $outputLine .= '<a title="'.__('Alerts fired');
$outputLine .= '" class="group_view_data"'; $outputLine .= '" class="group_view_data"';
$outputLine .= ' style="'.$style.'"'; $outputLine .= ' style="'.$style.'"';
$outputLine .= $show_link === true ? '" href="'.$url : ''; $outputLine .= ($show_link === true) ? '" href="'.$url_alert : '';
$outputLine .= '&filter=fired">'; $outputLine .= '&filter=fired">';
$outputLine .= $group['total_module_alerts']; $outputLine .= $group['total_module_alerts'];
$outputLine .= '</a>'; $outputLine .= '</a>';

View File

@ -284,12 +284,15 @@ class TopNEventByGroupWidget extends Widget
if ($values['groupId']) { if ($values['groupId']) {
$selected_groups = explode(',', $values['groupId'][0]); $selected_groups = explode(',', $values['groupId'][0]);
if (users_can_manage_group_all('RM') || in_array(0, $selected_groups) === true) { if (users_can_manage_group_all('RM') === true
// Return all group if user has permissions or it is a currently selected group. || in_array(0, $selected_groups) === true
) {
// Return all group if user has permissions
// or it is a currently selected group.
$return_all_group = true; $return_all_group = true;
} }
} else { } else {
if (users_can_manage_group_all('RM')) { if (users_can_manage_group_all('RM') === true) {
$return_all_group = true; $return_all_group = true;
} }
} }
@ -301,10 +304,11 @@ class TopNEventByGroupWidget extends Widget
'name' => 'groupId[]', 'name' => 'groupId[]',
'returnAllGroup' => true, 'returnAllGroup' => true,
'privilege' => 'AR', 'privilege' => 'AR',
'selected' => $selected_groups, 'selected' => (empty($selected_groups) === true) ? [0] : $selected_groups,
'return' => true, 'return' => true,
'multiple' => true, 'multiple' => true,
'returnAllGroup' => $return_all_group, 'returnAllGroup' => $return_all_group,
'required' => true,
], ],
]; ];

View File

@ -283,12 +283,15 @@ class TopNEventByModuleWidget extends Widget
if ($values['groupId']) { if ($values['groupId']) {
$selected_groups = explode(',', $values['groupId'][0]); $selected_groups = explode(',', $values['groupId'][0]);
if (users_can_manage_group_all('RM') || in_array(0, $selected_groups) === true) { if (users_can_manage_group_all('RM') === true
// Return all group if user has permissions or it is a currently selected group. || in_array(0, $selected_groups) === true
) {
// Return all group if user has permissions
// or it is a currently selected group.
$return_all_group = true; $return_all_group = true;
} }
} else { } else {
if (users_can_manage_group_all('RM')) { if (users_can_manage_group_all('RM') === true) {
$return_all_group = true; $return_all_group = true;
} }
} }
@ -301,10 +304,11 @@ class TopNEventByModuleWidget extends Widget
'name' => 'groupId[]', 'name' => 'groupId[]',
'returnAllGroup' => true, 'returnAllGroup' => true,
'privilege' => 'AR', 'privilege' => 'AR',
'selected' => $selected_groups, 'selected' => (empty($selected_groups) === true) ? [0] : $selected_groups,
'return' => true, 'return' => true,
'multiple' => true, 'multiple' => true,
'returnAllGroup' => $return_all_group, 'returnAllGroup' => $return_all_group,
'required' => true,
], ],
]; ];
@ -362,7 +366,7 @@ class TopNEventByModuleWidget extends Widget
$this->values['groupId'] = explode(',', $this->values['groupId'][0]); $this->values['groupId'] = explode(',', $this->values['groupId'][0]);
if (empty($this->values['groupId']) === true) { if (empty($this->values['groupId']) === true) {
$output .= '<div class="container-center">'; $output = '<div class="container-center">';
$output .= \ui_print_info_message( $output .= \ui_print_info_message(
__('Please select one or more groups.'), __('Please select one or more groups.'),
'', '',
@ -414,7 +418,7 @@ class TopNEventByModuleWidget extends Widget
$result = db_get_all_rows_sql($sql); $result = db_get_all_rows_sql($sql);
if (empty($result) === true) { if (empty($result) === true) {
$output .= '<div class="container-center">'; $output = '<div class="container-center">';
$output .= \ui_print_error_message( $output .= \ui_print_error_message(
__('There is not data to show.'), __('There is not data to show.'),
'', '',
@ -503,7 +507,7 @@ class TopNEventByModuleWidget extends Widget
break; break;
} }
$output .= pie_graph( $output = pie_graph(
$data_pie, $data_pie,
$width, $width,
$height, $height,

View File

@ -587,6 +587,33 @@ class TreeViewWidget extends Widget
true true
); );
switch ($tab) {
case 'policies':
$foundMessage = __('Policies found');
break;
case 'os':
$foundMessage = __('Operating systems found');
break;
case 'tag':
$foundMessage = __('Tags found');
break;
case 'module_group':
$foundMessage = __('Module Groups found');
break;
case 'module':
$foundMessage = __('Modules found');
break;
case 'group':
default:
$foundMessage = __('Groups found');
break;
}
$settings = [ $settings = [
'page' => 'include/ajax/tree.ajax', 'page' => 'include/ajax/tree.ajax',
'id_user' => $config['id_user'], 'id_user' => $config['id_user'],
@ -607,7 +634,7 @@ class TreeViewWidget extends Widget
'userLanguage' => get_user_language(), 'userLanguage' => get_user_language(),
'translate' => [ 'translate' => [
'emptyMessage' => __('No data found'), 'emptyMessage' => __('No data found'),
'foundMessage' => 'not', 'foundMessage' => $foundMessage,
'total' => [ 'total' => [
'agents' => __('Total agents'), 'agents' => __('Total agents'),
'modules' => __('Total modules'), 'modules' => __('Total modules'),

View File

@ -105,6 +105,23 @@ class Group extends Entity
} }
/**
* Alias of 'nombre'.
*
* @param string|null $name Name of group.
*
* @return string|void Name assigned or void if set operation.
*/
public function name(?string $name=null)
{
if ($name === null) {
return $this->nombre();
}
return $this->nombre($name);
}
/** /**
* Retrieves a list of groups fitered. * Retrieves a list of groups fitered.
* *
@ -119,7 +136,7 @@ class Group extends Entity
if (empty($filter['id_user']) === true) { if (empty($filter['id_user']) === true) {
// By default query current user groups. // By default query current user groups.
$filter['id_user'] = false; $filter['id_user'] = false;
} else if (!\users_is_admin()) { } else if ((bool) \users_is_admin() === false) {
// Override user queried if user is not an admin. // Override user queried if user is not an admin.
$filter['id_user'] = false; $filter['id_user'] = false;
} }
@ -226,8 +243,9 @@ class Group extends Entity
if (isset($config['centralized_management']) === true if (isset($config['centralized_management']) === true
&& $config['centralized_management'] > 0 && $config['centralized_management'] > 0
) { ) {
$msg = 'cannot be modified in a centralized management environment';
throw new \Exception( throw new \Exception(
get_class($this).' error, cannot be modified while centralized management environment.' get_class($this).' error, '.$msg
); );
} }

View File

@ -242,6 +242,13 @@ class Item extends CachedModel
); );
} }
$decodedData['agentDisabled'] = static::parseBool(
$data['agentDisabled']
);
$decodedData['moduleDisabled'] = static::parseBool(
$data['moduleDisabled']
);
return $decodedData; return $decodedData;
} }
@ -749,6 +756,7 @@ class Item extends CachedModel
* Fetch a vc item data structure from the database using a filter. * Fetch a vc item data structure from the database using a filter.
* *
* @param array $filter Filter of the Visual Console Item. * @param array $filter Filter of the Visual Console Item.
* @param float $ratio Ratio resize view.
* *
* @return array The Visual Console Item data structure stored into the DB. * @return array The Visual Console Item data structure stored into the DB.
* @throws \Exception When the data cannot be retrieved from the DB. * @throws \Exception When the data cannot be retrieved from the DB.
@ -906,7 +914,6 @@ class Item extends CachedModel
* @return array The agent data structure stored into the DB. * @return array The agent data structure stored into the DB.
* *
* @throws \InvalidArgumentException When the input agent Id is invalid. * @throws \InvalidArgumentException When the input agent Id is invalid.
* @throws \Exception When the data cannot be retrieved from the DB.
*/ */
protected static function fetchAgentDataFromDB(array $itemData): array protected static function fetchAgentDataFromDB(array $itemData): array
{ {
@ -923,7 +930,6 @@ class Item extends CachedModel
$agentId = static::extractAgentId($itemData); $agentId = static::extractAgentId($itemData);
if ($agentId === null) { if ($agentId === null) {
$agentId = 0; $agentId = 0;
// throw new \InvalidArgumentException('invalid agent Id');
} }
// Staticgraph don't need to have an agent. // Staticgraph don't need to have an agent.
@ -931,15 +937,15 @@ class Item extends CachedModel
return $agentData; return $agentData;
} }
if (\is_metaconsole() && $metaconsoleId === null) { if (\is_metaconsole() === true && $metaconsoleId === null) {
throw new \InvalidArgumentException('missing metaconsole node Id'); throw new \InvalidArgumentException('missing metaconsole node Id');
} }
$agent = false; $agent = false;
if (\is_metaconsole()) { if (\is_metaconsole() === true) {
$sql = sprintf( $sql = sprintf(
'SELECT nombre, alias, direccion, comentarios 'SELECT nombre, alias, direccion, comentarios, `disabled`
FROM tmetaconsole_agent FROM tmetaconsole_agent
WHERE id_tagente = %s and id_tmetaconsole_setup = %s', WHERE id_tagente = %s and id_tmetaconsole_setup = %s',
$agentId, $agentId,
@ -947,7 +953,7 @@ class Item extends CachedModel
); );
} else { } else {
$sql = sprintf( $sql = sprintf(
'SELECT nombre, alias, direccion, comentarios 'SELECT nombre, alias, direccion, comentarios, `disabled`
FROM tagente FROM tagente
WHERE id_agente = %s', WHERE id_agente = %s',
$agentId $agentId
@ -957,8 +963,8 @@ class Item extends CachedModel
$agent = \db_get_row_sql($sql); $agent = \db_get_row_sql($sql);
if ($agent === false) { if ($agent === false) {
$agentData['agentDisabled'] = true;
return $agentData; return $agentData;
// throw new \Exception('error fetching the data from the DB');
} }
// The agent name should be a valid string or a null value. // The agent name should be a valid string or a null value.
@ -966,6 +972,7 @@ class Item extends CachedModel
$agentData['agentAlias'] = $agent['alias']; $agentData['agentAlias'] = $agent['alias'];
$agentData['agentDescription'] = $agent['comentarios']; $agentData['agentDescription'] = $agent['comentarios'];
$agentData['agentAddress'] = $agent['direccion']; $agentData['agentAddress'] = $agent['direccion'];
$agentData['agentDisabled'] = $agent['disabled'];
return \io_safe_output($agentData); return \io_safe_output($agentData);
} }
@ -979,7 +986,6 @@ class Item extends CachedModel
* *
* @return array The module data structure stored into the DB. * @return array The module data structure stored into the DB.
* @throws \InvalidArgumentException When the input module Id is invalid. * @throws \InvalidArgumentException When the input module Id is invalid.
* @throws \Exception When the data cannot be retrieved from the DB.
*/ */
protected static function fetchModuleDataFromDB(array $itemData): array protected static function fetchModuleDataFromDB(array $itemData): array
{ {
@ -988,7 +994,7 @@ class Item extends CachedModel
include_once $config['homedir'].'/include/functions_io.php'; include_once $config['homedir'].'/include/functions_io.php';
// Load side libraries. // Load side libraries.
if (\is_metaconsole()) { if (\is_metaconsole() === true) {
\enterprise_include_once('include/functions_metaconsole.php'); \enterprise_include_once('include/functions_metaconsole.php');
} }
@ -999,7 +1005,6 @@ class Item extends CachedModel
$moduleId = static::extractModuleId($itemData); $moduleId = static::extractModuleId($itemData);
if ($moduleId === null) { if ($moduleId === null) {
$moduleId = 0; $moduleId = 0;
// throw new \InvalidArgumentException('invalid module Id');
} }
// Staticgraph don't need to have a module. // Staticgraph don't need to have a module.
@ -1010,14 +1015,14 @@ class Item extends CachedModel
// We should add the metaconsole Id if we can. // We should add the metaconsole Id if we can.
$metaconsoleId = static::extractMetaconsoleId($itemData); $metaconsoleId = static::extractMetaconsoleId($itemData);
if (\is_metaconsole() && $metaconsoleId === null) { if (\is_metaconsole() === true && $metaconsoleId === null) {
throw new \InvalidArgumentException('missing metaconsole node Id'); throw new \InvalidArgumentException('missing metaconsole node Id');
} }
$moduleName = false; $moduleName = false;
// Connect to node. // Connect to node.
if (\is_metaconsole() if (\is_metaconsole() === true
&& \metaconsole_connect(null, $metaconsoleId) !== NOERR && \metaconsole_connect(null, $metaconsoleId) !== NOERR
) { ) {
throw new \InvalidArgumentException( throw new \InvalidArgumentException(
@ -1026,7 +1031,7 @@ class Item extends CachedModel
} }
$sql = sprintf( $sql = sprintf(
'SELECT nombre, descripcion 'SELECT nombre, descripcion, `disabled`
FROM tagente_modulo FROM tagente_modulo
WHERE id_agente_modulo = %s', WHERE id_agente_modulo = %s',
$moduleId $moduleId
@ -1035,17 +1040,18 @@ class Item extends CachedModel
$moduleName = \db_get_row_sql($sql); $moduleName = \db_get_row_sql($sql);
// Restore connection. // Restore connection.
if (\is_metaconsole()) { if (\is_metaconsole() === true) {
\metaconsole_restore_db(); \metaconsole_restore_db();
} }
if ($moduleName === false) { if ($moduleName === false) {
$agentData['moduleDisabled'] = true;
return $moduleData; return $moduleData;
// throw new \Exception('error fetching the data from the DB');
} }
$moduleData['moduleName'] = $moduleName['nombre']; $moduleData['moduleName'] = $moduleName['nombre'];
$moduleData['moduleDescription'] = $moduleName['descripcion']; $moduleData['moduleDescription'] = $moduleName['descripcion'];
$moduleData['moduleDisabled'] = $moduleName['disabled'];
return \io_safe_output($moduleData); return \io_safe_output($moduleData);
} }
@ -1065,7 +1071,7 @@ class Item extends CachedModel
// Load side libraries. // Load side libraries.
include_once $config['homedir'].'/include/functions_ui.php'; include_once $config['homedir'].'/include/functions_ui.php';
if (\is_metaconsole()) { if (\is_metaconsole() === true) {
\enterprise_include_once('include/functions_metaconsole.php'); \enterprise_include_once('include/functions_metaconsole.php');
\enterprise_include_once('meta/include/functions_ui_meta.php'); \enterprise_include_once('meta/include/functions_ui_meta.php');
} }
@ -1076,7 +1082,12 @@ class Item extends CachedModel
$baseUrl = \ui_get_full_url('index.php'); $baseUrl = \ui_get_full_url('index.php');
// TODO: There's a feature to get the link from the label. if ((bool) $data['agentDisabled'] === true
|| (bool) $data['moduleDisabled'] === true
) {
return null;
}
if (static::$useLinkedVisualConsole === true if (static::$useLinkedVisualConsole === true
&& $linkedVisualConsole['linkedLayoutId'] !== null && $linkedVisualConsole['linkedLayoutId'] !== null
&& $linkedVisualConsole['linkedLayoutId'] > 0 && $linkedVisualConsole['linkedLayoutId'] > 0
@ -1099,7 +1110,9 @@ class Item extends CachedModel
return null; return null;
} }
if (empty($linkedLayoutNodeId) === true && \is_metaconsole()) { if (empty($linkedLayoutNodeId) === true
&& \is_metaconsole() === true
) {
/* /*
* A Visual Console from this console. * A Visual Console from this console.
* We are in a metaconsole. * We are in a metaconsole.
@ -1115,7 +1128,7 @@ class Item extends CachedModel
] ]
); );
} else if (empty($linkedLayoutNodeId) === true } else if (empty($linkedLayoutNodeId) === true
&& !\is_metaconsole() && \is_metaconsole() === false
) { ) {
/* /*
* A Visual Console from this console. * A Visual Console from this console.
@ -1130,7 +1143,9 @@ class Item extends CachedModel
'pure' => (int) $config['pure'], 'pure' => (int) $config['pure'],
] ]
); );
} else if (\is_metaconsole() && \can_user_access_node()) { } else if (\is_metaconsole() === true
&& (bool) \can_user_access_node() === true
) {
/* /*
* A Visual Console from a meta node. * A Visual Console from a meta node.
* We are in a metaconsole. * We are in a metaconsole.
@ -1141,7 +1156,6 @@ class Item extends CachedModel
$linkedLayoutNodeId $linkedLayoutNodeId
); );
// TODO: Link to a public view.
return \ui_meta_get_node_url( return \ui_meta_get_node_url(
$node, $node,
'network', 'network',
@ -1164,7 +1178,9 @@ class Item extends CachedModel
// The module can be from another node. // The module can be from another node.
$metaconsoleId = $linkedModule['metaconsoleId']; $metaconsoleId = $linkedModule['metaconsoleId'];
if (empty($metaconsoleId) === true) { if (is_metaconsole() === false
|| empty($metaconsoleId) === true
) {
/* /*
* A module from this console. * A module from this console.
*/ */
@ -1196,7 +1212,9 @@ class Item extends CachedModel
} }
return $baseUrl.'?'.http_build_query($queryParams); return $baseUrl.'?'.http_build_query($queryParams);
} else if (\is_metaconsole() && \can_user_access_node()) { } else if (\is_metaconsole() === true
&& (bool) \can_user_access_node() === true
) {
/* /*
* A module from a meta node. * A module from a meta node.
* We are in a metaconsole. * We are in a metaconsole.
@ -1264,7 +1282,9 @@ class Item extends CachedModel
// The agent can be from another node. // The agent can be from another node.
$metaconsoleId = $linkedAgent['metaconsoleId']; $metaconsoleId = $linkedAgent['metaconsoleId'];
if (empty($metaconsoleId) === true) { if (is_metaconsole() === false
|| empty($metaconsoleId) === true
) {
/* /*
* An agent from this console. * An agent from this console.
* We are in a regular console. * We are in a regular console.
@ -1277,7 +1297,9 @@ class Item extends CachedModel
'id_agente' => $agentId, 'id_agente' => $agentId,
] ]
); );
} else if (\is_metaconsole() && \can_user_access_node()) { } else if (\is_metaconsole() === true
&& (bool) \can_user_access_node() === true
) {
/* /*
* An agent from a meta node. * An agent from a meta node.
* We are in a metaconsole. * We are in a metaconsole.
@ -1291,7 +1313,7 @@ class Item extends CachedModel
$node, $node,
'estado', 'estado',
'operation/agentes/ver_agente', 'operation/agentes/ver_agente',
['id_agente' => $moduleId], ['id_agente' => $agentId],
// No autologin from the public view. // No autologin from the public view.
!$config['public_view'] !$config['public_view']
); );
@ -1424,6 +1446,7 @@ class Item extends CachedModel
'enableLink', 'enableLink',
] ]
); );
if ($enable_link !== null) { if ($enable_link !== null) {
$result['enable_link'] = static::parseBool($enable_link); $result['enable_link'] = static::parseBool($enable_link);
} }
@ -1466,11 +1489,6 @@ class Item extends CachedModel
$result['linked_layout_node_id'] = $linked_layout_node_id; $result['linked_layout_node_id'] = $linked_layout_node_id;
} }
if ($id_layout_linked > 0) {
// If VC linked, force link status to enabled.
$result['enable_link'] = 1;
}
$linked_layout_status_type = static::notEmptyStringOr( $linked_layout_status_type = static::notEmptyStringOr(
static::issetInArray( static::issetInArray(
$data, $data,
@ -1769,7 +1787,7 @@ class Item extends CachedModel
$item = static::fromDB(['id' => $save['id']]); $item = static::fromDB(['id' => $save['id']]);
// Update the model. // Update the model.
if (!empty($item)) { if (empty($item) === false) {
$this->setData($item->toArray()); $this->setData($item->toArray());
} }
} }

View File

@ -133,7 +133,8 @@ final class StaticGraph extends Item
/** /**
* Fetch a vc item data structure from the database using a filter. * Fetch a vc item data structure from the database using a filter.
* *
* @param array $filter Filter of the Visual Console Item. * @param array $filter Filter of the Visual Console Item.
* @param float|null $ratio Ratio.
* *
* @return array The Visual Console Item data structure stored into the DB. * @return array The Visual Console Item data structure stored into the DB.
* @throws \InvalidArgumentException When an agent Id cannot be found. * @throws \InvalidArgumentException When an agent Id cannot be found.
@ -171,44 +172,57 @@ final class StaticGraph extends Item
throw new \InvalidArgumentException('missing module Id'); throw new \InvalidArgumentException('missing module Id');
} }
// Get the img src. if ((bool) $data['agentDisabled'] === false
// There's no need to connect to the metaconsole before searching for && (bool) $data['moduleDisabled'] === false
// the image status cause the function itself does that for us. ) {
$imagePath = \visual_map_get_image_status_element($data); // Get the img src.
$data['statusImageSrc'] = \ui_get_full_url( // There's no need to connect to the metaconsole before searching
$imagePath, // for the image status cause the function itself does that for us.
false, $imagePath = \visual_map_get_image_status_element($data);
false, $data['statusImageSrc'] = \ui_get_full_url(
false $imagePath,
); false,
false,
false
);
$status = \visual_map_get_status_element($data); $status = \visual_map_get_status_element($data);
// Magic numbers from the hell. // Magic numbers from the hell.
switch ($status) { switch ($status) {
case 1: case 1:
case 4: case 4:
// Critical or critical alert (BAD). // Critical or critical alert (BAD).
$data['colorStatus'] = COL_CRITICAL; $data['colorStatus'] = COL_CRITICAL;
break; break;
case 0: case 0:
// Normal (OK). // Normal (OK).
$data['colorStatus'] = COL_NORMAL; $data['colorStatus'] = COL_NORMAL;
break; break;
case 2: case 2:
case 10: case 10:
// Warning or warning alert. // Warning or warning alert.
$data['colorStatus'] = COL_WARNING; $data['colorStatus'] = COL_WARNING;
break; break;
case 3: case 3:
// Unknown. // Unknown.
default: default:
// Default is Grey (Other). // Default is Grey (Other).
$data['colorStatus'] = COL_UNKNOWN; $data['colorStatus'] = COL_UNKNOWN;
break; break;
}
} else {
$data['colorStatus'] = COL_UNKNOWN;
$imagePath = 'images/console/icons/'.$data['image'].'.png';
$data['statusImageSrc'] = \ui_get_full_url(
$imagePath,
false,
false,
false
);
} }
// If the width or the height are equal to 0 we will extract them // If the width or the height are equal to 0 we will extract them
@ -359,7 +373,6 @@ final class StaticGraph extends Item
'label' => __('Module'), 'label' => __('Module'),
'arguments' => [ 'arguments' => [
'type' => 'autocomplete_module', 'type' => 'autocomplete_module',
'fields' => $fields,
'name' => 'moduleId', 'name' => 'moduleId',
'selected' => $values['moduleId'], 'selected' => $values['moduleId'],
'return' => true, 'return' => true,

View File

@ -390,7 +390,6 @@ table.group_modules_status_box tr td > span {
} }
table.group_modules_status_box tr td div { table.group_modules_status_box tr td div {
background-color: #82b92e;
width: 90%; width: 90%;
padding: 3px; padding: 3px;
text-align: center; text-align: center;
@ -534,3 +533,13 @@ div#main_pure {
#select_multiple_modules_filtered > div > div > * { #select_multiple_modules_filtered > div > div > * {
flex: auto; flex: auto;
} }
.visual-console-container-dashboard div.label strong {
color: inherit;
font-family: inherit;
}
.visual-console-container-dashboard div.label strong span {
color: inherit;
font-family: inherit;
}

View File

@ -2718,6 +2718,10 @@ span#plugin_description {
background-color: #ededed; background-color: #ededed;
} }
.tinyMCEBody span strong {
font-family: inherit;
}
.visual_font_size_4pt, .visual_font_size_4pt,
.visual_font_size_4pt > em, .visual_font_size_4pt > em,
.visual_font_size_4pt > strong, .visual_font_size_4pt > strong,
@ -2729,6 +2733,7 @@ span#plugin_description {
.visual_font_size_4pt span em { .visual_font_size_4pt span em {
font-size: 4pt; font-size: 4pt;
line-height: 4pt; line-height: 4pt;
font-family: inherit;
} }
.visual_font_size_6pt, .visual_font_size_6pt,
.visual_font_size_6pt > em, .visual_font_size_6pt > em,
@ -2741,6 +2746,7 @@ span#plugin_description {
.visual_font_size_6pt span em { .visual_font_size_6pt span em {
font-size: 6pt; font-size: 6pt;
line-height: 6pt; line-height: 6pt;
font-family: inherit;
} }
.visual_font_size_8pt, .visual_font_size_8pt,
.visual_font_size_8pt > em, .visual_font_size_8pt > em,
@ -2753,6 +2759,7 @@ span#plugin_description {
.visual_font_size_8pt span em { .visual_font_size_8pt span em {
font-size: 8pt; font-size: 8pt;
line-height: 8pt; line-height: 8pt;
font-family: inherit;
} }
.visual_font_size_10pt, .visual_font_size_10pt,
.visual_font_size_10pt > em, .visual_font_size_10pt > em,
@ -2765,6 +2772,7 @@ span#plugin_description {
.visual_font_size_10pt span em { .visual_font_size_10pt span em {
font-size: 10pt; font-size: 10pt;
line-height: 10pt; line-height: 10pt;
font-family: inherit;
} }
.visual_font_size_12pt, .visual_font_size_12pt,
.visual_font_size_12pt > em, .visual_font_size_12pt > em,
@ -2777,6 +2785,7 @@ span#plugin_description {
.visual_font_size_12pt span em { .visual_font_size_12pt span em {
font-size: 12pt; font-size: 12pt;
line-height: 12pt; line-height: 12pt;
font-family: inherit;
} }
.visual_font_size_14pt, .visual_font_size_14pt,
.visual_font_size_14pt > em, .visual_font_size_14pt > em,
@ -2789,6 +2798,7 @@ span#plugin_description {
.visual_font_size_14pt span em { .visual_font_size_14pt span em {
font-size: 14pt; font-size: 14pt;
line-height: 14pt; line-height: 14pt;
font-family: inherit;
} }
.visual_font_size_18pt, .visual_font_size_18pt,
.visual_font_size_18pt > em, .visual_font_size_18pt > em,
@ -2801,6 +2811,7 @@ span#plugin_description {
.visual_font_size_18pt span em { .visual_font_size_18pt span em {
font-size: 18pt; font-size: 18pt;
line-height: 18pt; line-height: 18pt;
font-family: inherit;
} }
.visual_font_size_24pt, .visual_font_size_24pt,
@ -2814,6 +2825,7 @@ span#plugin_description {
.visual_font_size_24pt span em { .visual_font_size_24pt span em {
font-size: 24pt; font-size: 24pt;
line-height: 24pt; line-height: 24pt;
font-family: inherit;
} }
.visual_font_size_28pt, .visual_font_size_28pt,
.visual_font_size_28pt > em, .visual_font_size_28pt > em,
@ -2826,6 +2838,7 @@ span#plugin_description {
.visual_font_size_28pt span em { .visual_font_size_28pt span em {
font-size: 28pt; font-size: 28pt;
line-height: 28pt; line-height: 28pt;
font-family: inherit;
} }
.visual_font_size_36pt, .visual_font_size_36pt,
.visual_font_size_36pt > em, .visual_font_size_36pt > em,
@ -2838,6 +2851,7 @@ span#plugin_description {
.visual_font_size_36pt span em { .visual_font_size_36pt span em {
font-size: 36pt; font-size: 36pt;
line-height: 36pt; line-height: 36pt;
font-family: inherit;
} }
.visual_font_size_48pt, .visual_font_size_48pt,
.visual_font_size_48pt > em, .visual_font_size_48pt > em,
@ -2850,6 +2864,7 @@ span#plugin_description {
.visual_font_size_48pt span em { .visual_font_size_48pt span em {
font-size: 48pt; font-size: 48pt;
line-height: 48pt; line-height: 48pt;
font-family: inherit;
} }
.visual_font_size_60pt, .visual_font_size_60pt,
.visual_font_size_60pt > em, .visual_font_size_60pt > em,
@ -2862,6 +2877,7 @@ span#plugin_description {
.visual_font_size_60pt span em { .visual_font_size_60pt span em {
font-size: 60pt; font-size: 60pt;
line-height: 60pt; line-height: 60pt;
font-family: inherit;
} }
.visual_font_size_72pt, .visual_font_size_72pt,
.visual_font_size_72pt > em, .visual_font_size_72pt > em,
@ -2874,6 +2890,7 @@ span#plugin_description {
.visual_font_size_72pt span em { .visual_font_size_72pt span em {
font-size: 72pt; font-size: 72pt;
line-height: 72pt; line-height: 72pt;
font-family: inherit;
} }
.visual_font_size_84pt, .visual_font_size_84pt,
@ -2887,6 +2904,7 @@ span#plugin_description {
.visual_font_size_84pt span em { .visual_font_size_84pt span em {
font-size: 84pt; font-size: 84pt;
line-height: 84pt; line-height: 84pt;
font-family: inherit;
} }
.visual_font_size_96pt, .visual_font_size_96pt,
@ -2900,6 +2918,7 @@ span#plugin_description {
.visual_font_size_96pt span em { .visual_font_size_96pt span em {
font-size: 96pt; font-size: 96pt;
line-height: 96pt; line-height: 96pt;
font-family: inherit;
} }
.visual_font_size_116pt, .visual_font_size_116pt,
@ -2913,6 +2932,7 @@ span#plugin_description {
.visual_font_size_116pt span em { .visual_font_size_116pt span em {
font-size: 116pt; font-size: 116pt;
line-height: 116pt; line-height: 116pt;
font-family: inherit;
} }
.visual_font_size_128pt, .visual_font_size_128pt,
@ -2926,6 +2946,7 @@ span#plugin_description {
.visual_font_size_128pt span em { .visual_font_size_128pt span em {
font-size: 128pt; font-size: 128pt;
line-height: 128pt; line-height: 128pt;
font-family: inherit;
} }
.visual_font_size_140pt, .visual_font_size_140pt,
@ -2939,6 +2960,7 @@ span#plugin_description {
.visual_font_size_140pt span em { .visual_font_size_140pt span em {
font-size: 140pt; font-size: 140pt;
line-height: 140pt; line-height: 140pt;
font-family: inherit;
} }
.visual_font_size_154pt, .visual_font_size_154pt,
@ -2952,6 +2974,7 @@ span#plugin_description {
.visual_font_size_154pt span em { .visual_font_size_154pt span em {
font-size: 154pt; font-size: 154pt;
line-height: 154pt; line-height: 154pt;
font-family: inherit;
} }
.visual_font_size_196pt, .visual_font_size_196pt,
@ -2965,6 +2988,7 @@ span#plugin_description {
.visual_font_size_196pt span em { .visual_font_size_196pt span em {
font-size: 196pt; font-size: 196pt;
line-height: 196pt; line-height: 196pt;
font-family: inherit;
} }
.resize_visual_font_size_8pt, .resize_visual_font_size_8pt,
@ -5973,7 +5997,7 @@ div#status_pie {
.table_services_item { .table_services_item {
display: grid; display: grid;
align-items: center; align-items: center;
grid-template-columns: 50px auto; grid-template-columns: auto auto auto;
} }
/* /*
@ -6319,7 +6343,6 @@ div.graph div.legend table {
position: absolute; position: absolute;
top: 0; top: 0;
left: 0px; left: 0px;
display: none;
padding: 5px; padding: 5px;
} }
/* /*

View File

@ -4,6 +4,11 @@
* --------------------------------------------------------------------- * ---------------------------------------------------------------------
*/ */
div.external-visual-console-container {
width: 100%;
overflow-x: auto;
}
div#vc-controls { div#vc-controls {
position: fixed; position: fixed;
top: 30px; top: 30px;
@ -125,12 +130,26 @@ input.delete_min {
input.delete_min[disabled] { input.delete_min[disabled] {
background: url(../../images/cross.disabled.png) no-repeat center; background: url(../../images/cross.disabled.png) no-repeat center;
} }
input.delete_min_white {
background: url(../../images/cross.disabled.png) no-repeat center;
}
input.delete_min_white[disabled] {
background: url(../../images/cross.png) no-repeat center;
}
input.graph_min { input.graph_min {
background: url(../../images/chart_curve.png) no-repeat center; background: url(../../images/chart_curve.png) no-repeat center;
} }
input.graph_min[disabled] { input.graph_min[disabled] {
background: url(../../images/chart_curve.disabled.png) no-repeat center; background: url(../../images/chart_curve.disabled.png) no-repeat center;
} }
input.graph_min_white {
background: url(../../images/chart_curve.disabled.png) no-repeat center;
}
input.graph_min_white[disabled] {
background: url(../../images/chart_curve.png) no-repeat center;
}
input.bars_graph_min { input.bars_graph_min {
background: url(../../images/icono-barras-arriba.png) no-repeat center; background: url(../../images/icono-barras-arriba.png) no-repeat center;
} }
@ -138,120 +157,260 @@ input.bars_graph_min[disabled] {
background: url(../../images/icono-barras-arriba.disabled.png) no-repeat background: url(../../images/icono-barras-arriba.disabled.png) no-repeat
center; center;
} }
input.bars_graph_min_white {
background: url(../../images/icono-barras-arriba.disabled.png) no-repeat
center;
}
input.bars_graph_min_white[disabled] {
background: url(../../images/icono-barras-arriba.png) no-repeat center;
}
input.percentile_min { input.percentile_min {
background: url(../../images/chart_bar.png) no-repeat center; background: url(../../images/chart_bar.png) no-repeat center;
} }
input.percentile_min[disabled] { input.percentile_min[disabled] {
background: url(../../images/chart_bar.disabled.png) no-repeat center; background: url(../../images/chart_bar.disabled.png) no-repeat center;
} }
input.percentile_min_white {
background: url(../../images/chart_bar.disabled.png) no-repeat center;
}
input.percentile_min_white[disabled] {
background: url(../../images/chart_bar.png) no-repeat center;
}
input.percentile_item_min { input.percentile_item_min {
background: url(../../images/percentile_item.png) no-repeat center; background: url(../../images/percentile_item.png) no-repeat center;
} }
input.percentile_item_min[disabled] { input.percentile_item_min[disabled] {
background: url(../../images/percentile_item.disabled.png) no-repeat center; background: url(../../images/percentile_item.disabled.png) no-repeat center;
} }
input.percentile_item_min_white {
background: url(../../images/percentile_item.disabled.png) no-repeat center;
}
input.percentile_item_min_white[disabled] {
background: url(../../images/percentile_item.png) no-repeat center;
}
input.auto_sla_graph_min { input.auto_sla_graph_min {
background: url(../../images/auto_sla_graph.png) no-repeat center; background: url(../../images/auto_sla_graph.png) no-repeat center;
} }
input.auto_sla_graph_min[disabled] { input.auto_sla_graph_min[disabled] {
background: url(../../images/auto_sla_graph.disabled.png) no-repeat center; background: url(../../images/auto_sla_graph.disabled.png) no-repeat center;
} }
input.auto_sla_graph_min_white {
background: url(../../images/auto_sla_graph.disabled.png) no-repeat center;
}
input.auto_sla_graph_min_white[disabled] {
background: url(../../images/auto_sla_graph.png) no-repeat center;
}
input.donut_graph_min { input.donut_graph_min {
background: url(../../images/icono-quesito.png) no-repeat center; background: url(../../images/icono-quesito.png) no-repeat center;
} }
input.donut_graph_min[disabled] { input.donut_graph_min[disabled] {
background: url(../../images/icono-quesito.disabled.png) no-repeat center; background: url(../../images/icono-quesito.disabled.png) no-repeat center;
} }
input.donut_graph_min_white {
background: url(../../images/icono-quesito.disabled.png) no-repeat center;
}
input.donut_graph_min_white[disabled] {
background: url(../../images/icono-quesito.png) no-repeat center;
}
input.binary_min { input.binary_min {
background: url(../../images/binary.png) no-repeat center; background: url(../../images/binary.png) no-repeat center;
} }
input.binary_min[disabled] { input.binary_min[disabled] {
background: url(../../images/binary.disabled.png) no-repeat center; background: url(../../images/binary.disabled.png) no-repeat center;
} }
input.binary_min_white {
background: url(../../images/binary.disabled.png) no-repeat center;
}
input.binary_min_white[disabled] {
background: url(../../images/binary.png) no-repeat center;
}
input.camera_min { input.camera_min {
background: url(../../images/camera.png) no-repeat center; background: url(../../images/camera.png) no-repeat center;
} }
input.camera_min[disabled] { input.camera_min[disabled] {
background: url(../../images/camera.disabled.png) no-repeat center; background: url(../../images/camera.disabled.png) no-repeat center;
} }
input.camera_min_white {
background: url(../../images/camera.disabled.png) no-repeat center;
}
input.camera_min_white[disabled] {
background: url(../../images/camera.png) no-repeat center;
}
input.config_min { input.config_min {
background: url(../../images/config.png) no-repeat center; background: url(../../images/config.png) no-repeat center;
} }
input.config_min[disabled] { input.config_min[disabled] {
background: url(../../images/config.disabled.png) no-repeat center; background: url(../../images/config.disabled.png) no-repeat center;
} }
input.config_min_white {
background: url(../../images/config.disabled.png) no-repeat center;
}
input.config_min_white[disabled] {
background: url(../../images/config.png) no-repeat center;
}
input.label_min { input.label_min {
background: url(../../images/tag_red.png) no-repeat center; background: url(../../images/tag_red.png) no-repeat center;
} }
input.label_min[disabled] { input.label_min[disabled] {
background: url(../../images/tag_red.disabled.png) no-repeat center; background: url(../../images/tag_red.disabled.png) no-repeat center;
} }
input.label_min_white {
background: url(../../images/tag_red.disabled.png) no-repeat center;
}
input.label_min_white[disabled] {
background: url(../../images/tag_red.png) no-repeat center;
}
input.icon_min { input.icon_min {
background: url(../../images/photo.png) no-repeat center; background: url(../../images/photo.png) no-repeat center;
} }
input.icon_min[disabled] { input.icon_min[disabled] {
background: url(../../images/photo.disabled.png) no-repeat center; background: url(../../images/photo.disabled.png) no-repeat center;
} }
input.icon_min_white {
background: url(../../images/photo.disabled.png) no-repeat center;
}
input.icon_min_white[disabled] {
background: url(../../images/photo.png) no-repeat center;
}
input.clock_min { input.clock_min {
background: url(../../images/clock-tab.png) no-repeat center; background: url(../../images/clock-tab.png) no-repeat center;
} }
input.clock_min[disabled] { input.clock_min[disabled] {
background: url(../../images/clock-tab.disabled.png) no-repeat center; background: url(../../images/clock-tab.disabled.png) no-repeat center;
} }
input.clock_min_white {
background: url(../../images/clock-tab.disabled.png) no-repeat center;
}
input.clock_min_white[disabled] {
background: url(../../images/clock-tab.png) no-repeat center;
}
input.box_item { input.box_item {
background: url(../../images/box_item.png) no-repeat center; background: url(../../images/box_item.png) no-repeat center;
} }
input.box_item[disabled] { input.box_item[disabled] {
background: url(../../images/box_item.disabled.png) no-repeat center; background: url(../../images/box_item.disabled.png) no-repeat center;
} }
input.box_item_white {
background: url(../../images/box_item.disabled.png) no-repeat center;
}
input.box_item_white[disabled] {
background: url(../../images/box_item.png) no-repeat center;
}
input.line_item { input.line_item {
background: url(../../images/line_item.png) no-repeat center; background: url(../../images/line_item.png) no-repeat center;
} }
input.line_item[disabled] { input.line_item[disabled] {
background: url(../../images/line_item.disabled.png) no-repeat center; background: url(../../images/line_item.disabled.png) no-repeat center;
} }
input.line_item_white {
background: url(../../images/line_item.disabled.png) no-repeat center;
}
input.line_item_white[disabled] {
background: url(../../images/line_item.png) no-repeat center;
}
input.copy_item { input.copy_item {
background: url(../../images/copy_visualmap.png) no-repeat center; background: url(../../images/copy_visualmap.png) no-repeat center;
} }
input.copy_item[disabled] { input.copy_item[disabled] {
background: url(../../images/copy_visualmap.disabled.png) no-repeat center; background: url(../../images/copy_visualmap.disabled.png) no-repeat center;
} }
input.copy_item_white {
background: url(../../images/copy_visualmap.disabled.png) no-repeat center;
}
input.copy_item_white[disabled] {
background: url(../../images/copy_visualmap.png) no-repeat center;
}
input.grid_min { input.grid_min {
background: url(../../images/grid.png) no-repeat center; background: url(../../images/grid.png) no-repeat center;
} }
input.grid_min[disabled] { input.grid_min[disabled] {
background: url(../../images/grid.disabled.png) no-repeat center; background: url(../../images/grid.disabled.png) no-repeat center;
} }
input.grid_min_white {
background: url(../../images/grid.disabled.png) no-repeat center;
}
input.grid_min_white[disabled] {
background: url(../../images/grid.png) no-repeat center;
}
input.save_min { input.save_min {
background: url(../../images/file.png) no-repeat center; background: url(../../images/file.png) no-repeat center;
} }
input.save_min[disabled] { input.save_min[disabled] {
background: url(../../images/file.disabled.png) no-repeat center; background: url(../../images/file.disabled.png) no-repeat center;
} }
input.save_min_white {
background: url(../../images/file.disabled.png) no-repeat center;
}
input.save_min_white[disabled] {
background: url(../../images/file.png) no-repeat center;
}
input.service_min { input.service_min {
background: url(../../images/box.png) no-repeat center; background: url(../../images/box.png) no-repeat center;
} }
input.service_min[disabled] { input.service_min[disabled] {
background: url(../../images/box.disabled.png) no-repeat center; background: url(../../images/box.disabled.png) no-repeat center;
} }
input.service_min_white {
background: url(../../images/box.disabled.png) no-repeat center;
}
input.service_min_white[disabled] {
background: url(../../images/box.png) no-repeat center;
}
input.network_link_min { input.network_link_min {
background: url(../../images/network_link_item.png) no-repeat center; background: url(../../images/network_link_item.png) no-repeat center;
} }
input.network_link_min[disabled] { input.network_link_min[disabled] {
background: url(../../images/network_link_item.disabled.png) no-repeat center; background: url(../../images/network_link_item.disabled.png) no-repeat center;
} }
input.network_link_min_white {
background: url(../../images/network_link_item.disabled.png) no-repeat center;
}
input.network_link_min_white[disabled] {
background: url(../../images/network_link_item.png) no-repeat center;
}
input.group_item_min { input.group_item_min {
background: url(../../images/group_green.png) no-repeat center; background: url(../../images/group_green.png) no-repeat center;
} }
input.group_item_min[disabled] { input.group_item_min[disabled] {
background: url(../../images/group_green.disabled.png) no-repeat center; background: url(../../images/group_green.disabled.png) no-repeat center;
} }
input.group_item_min_white {
background: url(../../images/group_green.disabled.png) no-repeat center;
}
input.group_item_min_white[disabled] {
background: url(../../images/group_green.png) no-repeat center;
}
input.color_cloud_min { input.color_cloud_min {
background: url(../../images/color_cloud_item.png) no-repeat center; background: url(../../images/color_cloud_item.png) no-repeat center;
} }
input.color_cloud_min[disabled] { input.color_cloud_min[disabled] {
background: url(../../images/color_cloud_item.disabled.png) no-repeat center; background: url(../../images/color_cloud_item.disabled.png) no-repeat center;
} }
input.color_cloud_min_white {
background: url(../../images/color_cloud_item.disabled.png) no-repeat center;
}
input.color_cloud_min_white[disabled] {
background: url(../../images/color_cloud_item.png) no-repeat center;
}
div#cont { div#cont {
position: fixed; position: fixed;
@ -260,6 +419,16 @@ div#cont {
overflow-x: hidden; overflow-x: hidden;
} }
div.label strong {
color: inherit;
font-family: inherit;
}
div.label strong span {
color: inherit;
font-family: inherit;
}
/*.termframe{ /*.termframe{
background-color: #82b92e; background-color: #82b92e;
}*/ }*/

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -129,7 +129,7 @@
<div style='height: 10px'> <div style='height: 10px'>
<?php <?php
$version = '7.0NG.752'; $version = '7.0NG.752';
$build = '210322'; $build = '210324';
$banner = "v$version Build $build"; $banner = "v$version Build $build";
error_reporting(0); error_reporting(0);

View File

@ -30,7 +30,7 @@
global $config; global $config;
// Don't display other errors, messes up XML. // Don't display other errors, messes up XML.
ini_set('display_errors', E_ALL); ini_set('display_errors', 0);
require_once '../../include/config.php'; require_once '../../include/config.php';
require_once '../../include/functions.php'; require_once '../../include/functions.php';

View File

@ -28,7 +28,6 @@ if (file_exists(ENTERPRISE_DIR.'/include/functions_login.php')) {
require_once $config['homedir'].'/vendor/autoload.php'; require_once $config['homedir'].'/vendor/autoload.php';
ui_require_css_file('visual_maps');
ui_require_css_file('register', 'include/styles/', true); ui_require_css_file('register', 'include/styles/', true);
// Connection lost alert. // Connection lost alert.

View File

@ -235,80 +235,117 @@ if ($pure === false) {
echo '<div id ="edit-vc">'; echo '<div id ="edit-vc">';
echo '<div id ="edit-controls" class="visual-console-edit-controls" style="visibility:hidden">'; echo '<div id ="edit-controls" class="visual-console-edit-controls" style="visibility:hidden">';
echo '<div>'; echo '<div>';
$class_camera = 'camera_min link-create-item';
$class_percentile = 'percentile_item_min link-create-item';
$class_module_graph = 'graph_min link-create-item';
$class_donut = 'donut_graph_min link-create-item';
$class_bars = 'bars_graph_min link-create-item';
$class_value = 'binary_min link-create-item';
$class_sla = 'auto_sla_graph_min link-create-item';
$class_label = 'label_min link-create-item';
$class_icon = 'icon_min link-create-item';
$class_clock = 'clock_min link-create-item';
$class_group = 'group_item_min link-create-item';
$class_box = 'box_item link-create-item';
$class_line = 'line_item link-create-item';
$class_cloud = 'color_cloud_min link-create-item';
$class_nlink = 'network_link_min link-create-item';
$class_delete = 'delete_item delete_min';
$class_copy = 'copy_item';
if ($config['style'] === 'pandora_black') {
$class_camera = 'camera_min_white link-create-item';
$class_percentile = 'percentile_item_min_white link-create-item';
$class_module_graph = 'graph_min_white link-create-item';
$class_donut = 'donut_graph_min_white link-create-item';
$class_bars = 'bars_graph_min_white link-create-item';
$class_value = 'binary_min_white link-create-item';
$class_sla = 'auto_sla_graph_min_white link-create-item';
$class_label = 'label_min_white link-create-item';
$class_icon = 'icon_min_white link-create-item';
$class_clock = 'clock_min_white link-create-item';
$class_group = 'group_item_min_white link-create-item';
$class_box = 'box_item_white link-create-item';
$class_line = 'line_item_white link-create-item';
$class_cloud = 'color_cloud_min_white link-create-item';
$class_nlink = 'network_link_min_white link-create-item';
$class_delete = 'delete_item_white delete_min_white';
$class_copy = 'copy_item_white';
}
visual_map_print_button_editor_refactor( visual_map_print_button_editor_refactor(
'STATIC_GRAPH', 'STATIC_GRAPH',
__('Static Image'), __('Static Image'),
'camera_min link-create-item' $class_camera
); );
visual_map_print_button_editor_refactor( visual_map_print_button_editor_refactor(
'PERCENTILE_BAR', 'PERCENTILE_BAR',
__('Percentile Item'), __('Percentile Item'),
'percentile_item_min link-create-item' $class_percentile
); );
visual_map_print_button_editor_refactor( visual_map_print_button_editor_refactor(
'MODULE_GRAPH', 'MODULE_GRAPH',
__('Module Graph'), __('Module Graph'),
'graph_min link-create-item' $class_module_graph
); );
visual_map_print_button_editor_refactor( visual_map_print_button_editor_refactor(
'DONUT_GRAPH', 'DONUT_GRAPH',
__('Serialized pie graph'), __('Serialized pie graph'),
'donut_graph_min link-create-item' $class_donut
); );
visual_map_print_button_editor_refactor( visual_map_print_button_editor_refactor(
'BARS_GRAPH', 'BARS_GRAPH',
__('Bars Graph'), __('Bars Graph'),
'bars_graph_min link-create-item' $class_bars
); );
visual_map_print_button_editor_refactor( visual_map_print_button_editor_refactor(
'AUTO_SLA_GRAPH', 'AUTO_SLA_GRAPH',
__('Event history graph'), __('Event history graph'),
'auto_sla_graph_min link-create-item' $class_sla
); );
visual_map_print_button_editor_refactor( visual_map_print_button_editor_refactor(
'SIMPLE_VALUE', 'SIMPLE_VALUE',
__('Simple Value'), __('Simple Value'),
'binary_min link-create-item' $class_value
); );
visual_map_print_button_editor_refactor( visual_map_print_button_editor_refactor(
'LABEL', 'LABEL',
__('Label'), __('Label'),
'label_min link-create-item' $class_label
); );
visual_map_print_button_editor_refactor( visual_map_print_button_editor_refactor(
'ICON', 'ICON',
__('Icon'), __('Icon'),
'icon_min link-create-item' $class_icon
); );
visual_map_print_button_editor_refactor( visual_map_print_button_editor_refactor(
'CLOCK', 'CLOCK',
__('Clock'), __('Clock'),
'clock_min link-create-item' $class_clock
); );
visual_map_print_button_editor_refactor( visual_map_print_button_editor_refactor(
'GROUP_ITEM', 'GROUP_ITEM',
__('Group'), __('Group'),
'group_item_min link-create-item' $class_group
); );
visual_map_print_button_editor_refactor( visual_map_print_button_editor_refactor(
'BOX_ITEM', 'BOX_ITEM',
__('Box'), __('Box'),
'box_item link-create-item' $class_box
); );
visual_map_print_button_editor_refactor( visual_map_print_button_editor_refactor(
'LINE_ITEM', 'LINE_ITEM',
__('Line'), __('Line'),
'line_item link-create-item' $class_line
); );
visual_map_print_button_editor_refactor( visual_map_print_button_editor_refactor(
'COLOR_CLOUD', 'COLOR_CLOUD',
__('Color cloud'), __('Color cloud'),
'color_cloud_min link-create-item' $class_cloud
); );
visual_map_print_button_editor_refactor( visual_map_print_button_editor_refactor(
'NETWORK_LINK', 'NETWORK_LINK',
__('Network link'), __('Network link'),
'network_link_min link-create-item' $class_nlink
); );
enterprise_include_once('include/functions_visual_map_editor.php'); enterprise_include_once('include/functions_visual_map_editor.php');
enterprise_hook( enterprise_hook(
@ -319,13 +356,13 @@ if ($pure === false) {
visual_map_print_button_editor_refactor( visual_map_print_button_editor_refactor(
'button_delete', 'button_delete',
__('Delete Item'), __('Delete Item'),
'delete_item delete_min', $class_delete,
true true
); );
visual_map_print_button_editor_refactor( visual_map_print_button_editor_refactor(
'button_copy', 'button_copy',
__('Copy Item'), __('Copy Item'),
'copy_item', $class_copy,
true true
); );
echo '</div>'; echo '</div>';
@ -339,7 +376,9 @@ if ($pure === false) {
} }
} }
echo '<div class="external-visual-console-container">';
echo '<div id="visual-console-container"></div>'; echo '<div id="visual-console-container"></div>';
echo '</div>';
if ($pure === true) { if ($pure === true) {
// Floating menu - Start. // Floating menu - Start.
@ -447,6 +486,8 @@ ui_require_css_file('form');
var props = <?php echo (string) $visualConsole; ?>; var props = <?php echo (string) $visualConsole; ?>;
var items = <?php echo '['.implode($visualConsoleItems, ',').']'; ?>; var items = <?php echo '['.implode($visualConsoleItems, ',').']'; ?>;
var baseUrl = "<?php echo ui_get_full_url('/', false, false, false); ?>"; var baseUrl = "<?php echo ui_get_full_url('/', false, false, false); ?>";
var controls = document.getElementById('vc-controls');
autoHideElement(controls, 1000);
var handleUpdate = function (prevProps, newProps) { var handleUpdate = function (prevProps, newProps) {
if (!newProps) return; if (!newProps) return;
@ -462,7 +503,7 @@ ui_require_css_file('form');
if (div !== null) { if (div !== null) {
var parent = div.parentElement; var parent = div.parentElement;
if (parent !== null) { if (parent !== null) {
parent.removeChild(div); parent.removeChild(div);
} }
} }

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_console %define name pandorafms_console
%define version 7.0NG.752 %define version 7.0NG.752
%define release 210322 %define release 210324
# User and Group under which Apache is running # User and Group under which Apache is running
%define httpd_name httpd %define httpd_name httpd

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_console %define name pandorafms_console
%define version 7.0NG.752 %define version 7.0NG.752
%define release 210322 %define release 210324
# User and Group under which Apache is running # User and Group under which Apache is running
%define httpd_name httpd %define httpd_name httpd

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_console %define name pandorafms_console
%define version 7.0NG.752 %define version 7.0NG.752
%define release 210322 %define release 210324
%define httpd_name httpd %define httpd_name httpd
# User and Group under which Apache is running # User and Group under which Apache is running
%define httpd_name apache2 %define httpd_name apache2

View File

@ -51,6 +51,7 @@ HTML::printForm(
[ [
'form' => $form, 'form' => $form,
'inputs' => $htmlInputs, 'inputs' => $htmlInputs,
'js' => $js,
] ]
); );

View File

@ -142,7 +142,9 @@ $publiclink['text'] .= html_print_image(
$publiclink['text'] .= '</a>'; $publiclink['text'] .= '</a>';
// Refresh selector time dashboards. // Refresh selector time dashboards.
if ($config['public_dashboard'] === true) { if (isset($config['public_dashboard']) === true
&& (bool) $config['public_dashboard'] === true
) {
$urlRefresh = $publicUrl; $urlRefresh = $publicUrl;
} else { } else {
$queryRefresh = [ $queryRefresh = [
@ -213,7 +215,9 @@ $newWidget['text'] .= html_print_image(
); );
$newWidget['text'] .= '</a>'; $newWidget['text'] .= '</a>';
if ($config['public_dashboard'] === true) { if (isset($config['public_dashboard']) === true
&& (bool) $config['public_dashboard'] === true
) {
$buttons = [ $buttons = [
'combo_refresh_one_dashboard' => $comboRefresh, 'combo_refresh_one_dashboard' => $comboRefresh,
'combo_refresh_countdown' => $comboRefreshCountdown, 'combo_refresh_countdown' => $comboRefreshCountdown,

View File

@ -210,9 +210,6 @@ if (empty($dashboards) === true) {
if ($writeDashboards === 1) { if ($writeDashboards === 1) {
$text = __('Create a new dashboard'); $text = __('Create a new dashboard');
if ($dashboard !== null) {
$text = __('Update Dashboard');
}
// Button for display modal options dashboard. // Button for display modal options dashboard.
$output = '<a href="#" class="float-right" onclick=\''; $output = '<a href="#" class="float-right" onclick=\'';

View File

@ -91,10 +91,6 @@ if (isset($config['gotty']) === false) {
config_update_value('gotty', '/usr/bin/gotty'); config_update_value('gotty', '/usr/bin/gotty');
} }
ini_set('display_errors', 1);
error_reporting(E_ALL);
$os = strtolower(PHP_OS); $os = strtolower(PHP_OS);
if (substr($os, 0, 3) !== 'win') { if (substr($os, 0, 3) !== 'win') {
if (empty($config['gotty']) === false) { if (empty($config['gotty']) === false) {

View File

@ -1,5 +1,5 @@
package: pandorafms-server package: pandorafms-server
Version: 7.0NG.752-210322 Version: 7.0NG.752-210324
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
pandora_version="7.0NG.752-210322" pandora_version="7.0NG.752-210324"
package_cpan=0 package_cpan=0
package_pandora=1 package_pandora=1

View File

@ -671,10 +671,6 @@ syslog_max 65535
# Address # Address
# sync_address # sync_address
# Target LogStash server, to allow Dataserver and SyslogServer store log information in ElasticSearch
#logstash_host ip
#logstash_port 10514
# Pandora FMS Database HA Tool execution interval in seconds (PANDORA FMS ENTERPRISE ONLY). # Pandora FMS Database HA Tool execution interval in seconds (PANDORA FMS ENTERPRISE ONLY).
ha_interval 30 ha_interval 30

View File

@ -45,7 +45,7 @@ our @EXPORT = qw(
# version: Defines actual version of Pandora Server for this module only # version: Defines actual version of Pandora Server for this module only
my $pandora_version = "7.0NG.752"; my $pandora_version = "7.0NG.752";
my $pandora_build = "210322"; my $pandora_build = "210324";
our $VERSION = $pandora_version." ".$pandora_build; our $VERSION = $pandora_version." ".$pandora_build;
# Setup hash # Setup hash
@ -511,10 +511,6 @@ sub pandora_load_config {
$pa_config->{"warmup_unknown_interval"} = 300; # 6.1 $pa_config->{"warmup_unknown_interval"} = 300; # 6.1
$pa_config->{"warmup_unknown_on"} = 1; # 6.1 $pa_config->{"warmup_unknown_on"} = 1; # 6.1
# Logstash
$pa_config->{"logstash_host"} = '';
$pa_config->{"logstash_port"} = 0;
$pa_config->{"wuxserver"} = 1; # 7.0 $pa_config->{"wuxserver"} = 1; # 7.0
$pa_config->{"wux_host"} = undef; # 7.0 $pa_config->{"wux_host"} = undef; # 7.0
$pa_config->{"wux_port"} = 4444; # 7.0 $pa_config->{"wux_port"} = 4444; # 7.0
@ -1190,13 +1186,6 @@ sub pandora_load_config {
elsif ($parametro =~ m/^mssql_driver\s+(.*)/i) { elsif ($parametro =~ m/^mssql_driver\s+(.*)/i) {
$pa_config->{'mssql_driver'}= clean_blank($1); $pa_config->{'mssql_driver'}= clean_blank($1);
} }
elsif ($parametro =~ m/^logstash_host\s+(.*)/i) {
$pa_config->{'logstash_host'}= clean_blank($1);
}
elsif ($parametro =~ m/^logstash_port\s+([0-9]*)/i) {
$pa_config->{'logstash_port'}= clean_blank($1);
}
elsif ($parametro =~ m/^wuxserver\s+([0-1]*)/i) { elsif ($parametro =~ m/^wuxserver\s+([0-1]*)/i) {
$pa_config->{"wuxserver"} = clean_blank($1); $pa_config->{"wuxserver"} = clean_blank($1);
} }

View File

@ -34,7 +34,7 @@ our @ISA = qw(Exporter);
# version: Defines actual version of Pandora Server for this module only # version: Defines actual version of Pandora Server for this module only
my $pandora_version = "7.0NG.752"; my $pandora_version = "7.0NG.752";
my $pandora_build = "210322"; my $pandora_build = "210324";
our $VERSION = $pandora_version." ".$pandora_build; our $VERSION = $pandora_version." ".$pandora_build;
our %EXPORT_TAGS = ( 'all' => [ qw() ] ); our %EXPORT_TAGS = ( 'all' => [ qw() ] );
@ -504,10 +504,20 @@ sub print_agent {
# print header # print header
$xml .= "<agent_data "; $xml .= "<agent_data ";
my $group_password_specified = 0;
foreach my $kad (keys %{$agent_data}){ foreach my $kad (keys %{$agent_data}){
no warnings "uninitialized"; no warnings "uninitialized";
$xml .= $kad . "='"; $xml .= $kad . "='";
$xml .= $agent_data->{$kad} . "' "; $xml .= $agent_data->{$kad} . "' ";
if ($kad eq 'group_password') {
$group_password_specified = 1;
}
}
if ($group_password_specified == 0 && !empty($config->{'group_password'})) {
$xml .= " group_password='".$config->{'group_password'}."' ";
} }
$xml .= ">"; $xml .= ">";

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_server %define name pandorafms_server
%define version 7.0NG.752 %define version 7.0NG.752
%define release 210322 %define release 210324
Summary: Pandora FMS Server Summary: Pandora FMS Server
Name: %{name} Name: %{name}

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_server %define name pandorafms_server
%define version 7.0NG.752 %define version 7.0NG.752
%define release 210322 %define release 210324
Summary: Pandora FMS Server Summary: Pandora FMS Server
Name: %{name} Name: %{name}

View File

@ -9,7 +9,7 @@
# ********************************************************************** # **********************************************************************
PI_VERSION="7.0NG.752" PI_VERSION="7.0NG.752"
PI_BUILD="210322" PI_BUILD="210324"
MODE=$1 MODE=$1
if [ $# -gt 1 ]; then if [ $# -gt 1 ]; then

View File

@ -35,7 +35,7 @@ use PandoraFMS::Config;
use PandoraFMS::DB; use PandoraFMS::DB;
# version: define current version # version: define current version
my $version = "7.0NG.752 PS210322"; my $version = "7.0NG.752 PS210324";
# Pandora server configuration # Pandora server configuration
my %conf; my %conf;

View File

@ -36,7 +36,7 @@ use Encode::Locale;
Encode::Locale::decode_argv; Encode::Locale::decode_argv;
# version: define current version # version: define current version
my $version = "7.0NG.752 PS210322"; my $version = "7.0NG.752 PS210324";
# save program name for logging # save program name for logging
my $progname = basename($0); my $progname = basename($0);

View File

@ -797,11 +797,10 @@ export default class VisualConsole {
public render(prevProps: VisualConsoleProps | null = null): void { public render(prevProps: VisualConsoleProps | null = null): void {
if (prevProps) { if (prevProps) {
if (prevProps.backgroundURL !== this.props.backgroundURL) { if (prevProps.backgroundURL !== this.props.backgroundURL) {
if (this.props.backgroundURL) this.containerRef.style.backgroundImage =
this.containerRef.style.backgroundImage = this.props.backgroundURL !== null
this.props.backgroundURL !== null ? `url(${this.props.backgroundURL})`
? `url(${this.props.backgroundURL})` : "";
: "";
} }
if (this.props.backgroundColor != null) if (this.props.backgroundColor != null)
if (prevProps.backgroundColor !== this.props.backgroundColor) { if (prevProps.backgroundColor !== this.props.backgroundColor) {

View File

@ -75,9 +75,14 @@ export default class BarsGraph extends Item<BarsGraphProps> {
element.className = "bars-graph"; element.className = "bars-graph";
element.style.backgroundImage = `url(${this.props.html})`; element.style.backgroundImage = `url(${this.props.html})`;
element.style.backgroundRepeat = "no-repeat"; element.style.backgroundRepeat = "no-repeat";
element.style.backgroundSize = `${this.props.width}px ${ element.style.backgroundSize = `${this.props.width}px ${this.props.height}px`;
this.props.height
}px`; if (
this.props.agentDisabled === true ||
this.props.moduleDisabled === true
) {
element.style.opacity = "0.2";
}
return element; return element;
} }
@ -85,8 +90,13 @@ export default class BarsGraph extends Item<BarsGraphProps> {
protected updateDomElement(element: HTMLElement): void { protected updateDomElement(element: HTMLElement): void {
element.style.backgroundImage = `url(${this.props.html})`; element.style.backgroundImage = `url(${this.props.html})`;
element.style.backgroundRepeat = "no-repeat"; element.style.backgroundRepeat = "no-repeat";
element.style.backgroundSize = `${this.props.width}px ${ element.style.backgroundSize = `${this.props.width}px ${this.props.height}px`;
this.props.height
}px`; if (
this.props.agentDisabled === true ||
this.props.moduleDisabled === true
) {
element.style.opacity = "0.2";
}
} }
} }

View File

@ -231,7 +231,6 @@ class RangesInputGroup extends InputGroup<Partial<ColorCloudProps>> {
const handleCreate = () => { const handleCreate = () => {
if (isValid(state)) onCreate(state); if (isValid(state)) onCreate(state);
state = initialState; state = initialState;
console.log(state);
rangesInputFromValue.value = `${state.fromValue || ""}`; rangesInputFromValue.value = `${state.fromValue || ""}`;
rangesInputToValue.value = `${state.toValue || ""}`; rangesInputToValue.value = `${state.toValue || ""}`;
rangesInputColor.value = `${state.color}`; rangesInputColor.value = `${state.color}`;
@ -410,6 +409,13 @@ export default class ColorCloud extends Item<ColorCloudProps> {
defs.append(radialGradient); defs.append(radialGradient);
svg.append(defs, circle); svg.append(defs, circle);
if (
this.props.agentDisabled === true ||
this.props.moduleDisabled === true
) {
svg.setAttribute("opacity", "0.2");
}
return svg; return svg;
} }

View File

@ -56,6 +56,13 @@ export default class DonutGraph extends Item<DonutGraphProps> {
element.className = "donut-graph"; element.className = "donut-graph";
element.innerHTML = this.props.html; element.innerHTML = this.props.html;
if (
this.props.agentDisabled === true ||
this.props.moduleDisabled === true
) {
element.style.opacity = "0.2";
}
// Hack to execute the JS after the HTML is added to the DOM. // Hack to execute the JS after the HTML is added to the DOM.
const scripts = element.getElementsByTagName("script"); const scripts = element.getElementsByTagName("script");
for (let i = 0; i < scripts.length; i++) { for (let i = 0; i < scripts.length; i++) {

View File

@ -48,6 +48,13 @@ export default class EventsHistory extends Item<EventsHistoryProps> {
element.className = "events-history"; element.className = "events-history";
element.innerHTML = this.props.html; element.innerHTML = this.props.html;
if (
this.props.agentDisabled === true ||
this.props.moduleDisabled === true
) {
element.style.opacity = "0.2";
}
// Hack to execute the JS after the HTML is added to the DOM. // Hack to execute the JS after the HTML is added to the DOM.
const scripts = element.getElementsByTagName("script"); const scripts = element.getElementsByTagName("script");
for (let i = 0; i < scripts.length; i++) { for (let i = 0; i < scripts.length; i++) {

View File

@ -97,6 +97,12 @@ export default class ModuleGraph extends Item<ModuleGraphProps> {
element.innerHTML = this.props.html; element.innerHTML = this.props.html;
element.className = "module-graph"; element.className = "module-graph";
if (
this.props.agentDisabled === true ||
this.props.moduleDisabled === true
) {
element.style.opacity = "0.2";
}
// Remove the overview graph. // Remove the overview graph.
const legendP = element.getElementsByTagName("p"); const legendP = element.getElementsByTagName("p");

View File

@ -261,6 +261,13 @@ export default class Percentile extends Item<PercentileProps> {
break; break;
} }
if (
this.props.agentDisabled === true ||
this.props.moduleDisabled === true
) {
svg.setAttribute("opacity", "0.2");
}
if (svg !== null) element.append(svg); if (svg !== null) element.append(svg);
return element; return element;

View File

@ -22,7 +22,8 @@ export type SimpleValueProps = {
| { | {
processValue: "avg" | "max" | "min"; processValue: "avg" | "max" | "min";
period: number; period: number;
}) & }
) &
ItemProps & ItemProps &
WithModuleProps & WithModuleProps &
LinkedVisualConsoleProps; LinkedVisualConsoleProps;
@ -95,6 +96,13 @@ export default class SimpleValue extends Item<SimpleValueProps> {
const element = document.createElement("div"); const element = document.createElement("div");
element.className = "simple-value"; element.className = "simple-value";
if (
this.props.agentDisabled === true ||
this.props.moduleDisabled === true
) {
element.style.opacity = "0.2";
}
if (this.props.valueType === "image") { if (this.props.valueType === "image") {
const img = document.createElement("img"); const img = document.createElement("img");
img.src = this.props.value; img.src = this.props.value;

View File

@ -78,6 +78,13 @@ export default class StaticGraph extends Item<StaticGraphProps> {
element.style.backgroundSize = "contain"; element.style.backgroundSize = "contain";
element.style.backgroundPosition = "center"; element.style.backgroundPosition = "center";
if (
this.props.agentDisabled === true ||
this.props.moduleDisabled === true
) {
element.style.opacity = "0.2";
}
// Show last value in a tooltip. // Show last value in a tooltip.
if ( if (
this.props.lastValue !== null && this.props.lastValue !== null &&

View File

@ -177,7 +177,8 @@ export function agentPropsDecoder(data: AnyObject): WithAgentProps {
agentName: notEmptyStringOr(data.agentName, null), agentName: notEmptyStringOr(data.agentName, null),
agentAlias: notEmptyStringOr(data.agentAlias, null), agentAlias: notEmptyStringOr(data.agentAlias, null),
agentDescription: notEmptyStringOr(data.agentDescription, null), agentDescription: notEmptyStringOr(data.agentDescription, null),
agentAddress: notEmptyStringOr(data.agentAddress, null) agentAddress: notEmptyStringOr(data.agentAddress, null),
agentDisabled: parseBoolean(data.agentDisabled)
}; };
return data.metaconsoleId != null return data.metaconsoleId != null
@ -198,6 +199,7 @@ export function modulePropsDecoder(data: AnyObject): WithModuleProps {
moduleId: parseIntOr(data.moduleId, null), moduleId: parseIntOr(data.moduleId, null),
moduleName: notEmptyStringOr(data.moduleName, null), moduleName: notEmptyStringOr(data.moduleName, null),
moduleDescription: notEmptyStringOr(data.moduleDescription, null), moduleDescription: notEmptyStringOr(data.moduleDescription, null),
moduleDisabled: parseBoolean(data.moduleDisabled),
...agentPropsDecoder(data) // Object spread: http://es6-features.org/#SpreadOperator ...agentPropsDecoder(data) // Object spread: http://es6-features.org/#SpreadOperator
}; };
} }

View File

@ -23,12 +23,14 @@ export interface WithAgentProps {
agentAlias: string | null; agentAlias: string | null;
agentDescription: string | null; agentDescription: string | null;
agentAddress: string | null; agentAddress: string | null;
agentDisabled: boolean;
} }
export interface WithModuleProps extends WithAgentProps { export interface WithModuleProps extends WithAgentProps {
moduleId: number | null; moduleId: number | null;
moduleName: string | null; moduleName: string | null;
moduleDescription: string | null; moduleDescription: string | null;
moduleDisabled: boolean;
} }
export type LinkedVisualConsolePropsStatus = export type LinkedVisualConsolePropsStatus =