Fix selector modules only string in VC barsgraph and donutgraph

This commit is contained in:
Daniel Barbero Martin 2020-02-13 09:55:49 +01:00
parent 10972a2364
commit c96dd8e930
4 changed files with 113 additions and 87 deletions

View File

@ -3714,6 +3714,12 @@ function html_print_input($data, $wrapper='div', $input_only=false)
$params['value'] = $agent_name; $params['value'] = $agent_name;
$params['javascript_is_function_select'] = true; $params['javascript_is_function_select'] = true;
if (isset($data['get_only_string_modules']) === true
&& $data['get_only_string_modules'] === true
) {
$params['get_only_string_modules'] = $data['get_only_string_modules'];
}
if (isset($data['module_input']) === true if (isset($data['module_input']) === true
&& $data['module_input'] === true && $data['module_input'] === true
) { ) {
@ -3755,12 +3761,18 @@ function html_print_input($data, $wrapper='div', $input_only=false)
0 => __('Select an Agent first'), 0 => __('Select an Agent first'),
]; ];
} else { } else {
$string_filter .= '';
if ($data['get_only_string_modules'] === true) {
$string_filter = 'AND id_tipo_modulo IN (17,23,3,10,33,36)';
}
$sql = sprintf( $sql = sprintf(
'SELECT id_agente_modulo, nombre 'SELECT id_agente_modulo, nombre
FROM tagente_modulo FROM tagente_modulo
WHERE id_agente = %d WHERE id_agente = %d
AND delete_pending = 0', AND delete_pending = 0 %s',
$data['agent_id'] $data['agent_id'],
$string_filter
); );
if (is_metaconsole() === true) { if (is_metaconsole() === true) {

View File

@ -340,57 +340,67 @@ final class BarsGraph extends Item
$height = (int) $data['height']; $height = (int) $data['height'];
} }
if ($typeGraph === 'horizontal') { if (empty($moduleData) === true) {
$graph = \hbar_graph( $image = ui_get_full_url(
$moduleData,
$width,
$height,
$color,
[],
[],
'images/image_problem_area.png', 'images/image_problem_area.png',
'',
'',
$waterMark,
$config['fontpath'],
$config['fontsize'],
'',
2,
$config['homeurl'],
$backGroundColor,
$gridColor,
null,
null,
true
);
} else {
$graph = \vbar_graph(
$moduleData,
$width,
$height,
$color,
[],
[],
\ui_get_full_url(
'images/image_problem_area.png',
false,
false,
false
),
'',
'',
$waterMark,
$config['fontpath'],
$config['fontsize'],
'',
2,
$config['homeurl'],
$backGroundColor,
true,
false, false,
$gridColor, false,
true false
); );
$graph = base64_encode(file_get_contents($image));
} else {
if ($typeGraph === 'horizontal') {
$graph = \hbar_graph(
$moduleData,
$width,
$height,
$color,
[],
[],
'images/image_problem_area.png',
'',
'',
$waterMark,
$config['fontpath'],
$config['fontsize'],
'',
2,
$config['homeurl'],
$backGroundColor,
$gridColor,
null,
null,
true
);
} else {
$graph = \vbar_graph(
$moduleData,
$width,
$height,
$color,
[],
[],
\ui_get_full_url(
'images/image_problem_area.png',
false,
false,
false
),
'',
'',
$waterMark,
$config['fontpath'],
$config['fontsize'],
'',
2,
$config['homeurl'],
$backGroundColor,
true,
false,
$gridColor,
true
);
}
} }
// Restore connection. // Restore connection.
@ -483,16 +493,17 @@ final class BarsGraph extends Item
$inputs[] = [ $inputs[] = [
'label' => __('Agent'), 'label' => __('Agent'),
'arguments' => [ 'arguments' => [
'type' => 'autocomplete_agent', 'type' => 'autocomplete_agent',
'name' => 'agentAlias', 'name' => 'agentAlias',
'id_agent_hidden' => $values['agentId'], 'id_agent_hidden' => $values['agentId'],
'name_agent_hidden' => 'agentId', 'name_agent_hidden' => 'agentId',
'server_id_hidden' => $values['metaconsoleId'], 'server_id_hidden' => $values['metaconsoleId'],
'name_server_hidden' => 'metaconsoleId', 'name_server_hidden' => 'metaconsoleId',
'return' => true, 'return' => true,
'module_input' => true, 'module_input' => true,
'module_name' => 'moduleId', 'module_name' => 'moduleId',
'module_none' => false, 'module_none' => false,
'get_only_string_modules' => true,
], ],
]; ];
@ -500,14 +511,15 @@ final class BarsGraph extends Item
$inputs[] = [ $inputs[] = [
'label' => __('Module'), 'label' => __('Module'),
'arguments' => [ 'arguments' => [
'type' => 'autocomplete_module', 'type' => 'autocomplete_module',
'fields' => $fields, 'fields' => $fields,
'name' => 'moduleId', 'name' => 'moduleId',
'selected' => $values['moduleId'], 'selected' => $values['moduleId'],
'return' => true, 'return' => true,
'sort' => false, 'sort' => false,
'agent_id' => $values['agentId'], 'agent_id' => $values['agentId'],
'metaconsole_id' => $values['metaconsoleId'], 'metaconsole_id' => $values['metaconsoleId'],
'get_only_string_modules' => true,
], ],
]; ];
} }

View File

@ -210,16 +210,17 @@ final class DonutGraph extends Item
$inputs[] = [ $inputs[] = [
'label' => __('Agent'), 'label' => __('Agent'),
'arguments' => [ 'arguments' => [
'type' => 'autocomplete_agent', 'type' => 'autocomplete_agent',
'name' => 'agentAlias', 'name' => 'agentAlias',
'id_agent_hidden' => $values['agentId'], 'id_agent_hidden' => $values['agentId'],
'name_agent_hidden' => 'agentId', 'name_agent_hidden' => 'agentId',
'server_id_hidden' => $values['metaconsoleId'], 'server_id_hidden' => $values['metaconsoleId'],
'name_server_hidden' => 'metaconsoleId', 'name_server_hidden' => 'metaconsoleId',
'return' => true, 'return' => true,
'module_input' => true, 'module_input' => true,
'module_name' => 'moduleId', 'module_name' => 'moduleId',
'module_none' => false, 'module_none' => false,
'get_only_string_modules' => true,
], ],
]; ];
@ -227,14 +228,15 @@ final class DonutGraph extends Item
$inputs[] = [ $inputs[] = [
'label' => __('Module'), 'label' => __('Module'),
'arguments' => [ 'arguments' => [
'type' => 'autocomplete_module', 'type' => 'autocomplete_module',
'fields' => $fields, 'fields' => $fields,
'name' => 'moduleId', 'name' => 'moduleId',
'selected' => $values['moduleId'], 'selected' => $values['moduleId'],
'return' => true, 'return' => true,
'sort' => false, 'sort' => false,
'agent_id' => $values['agentId'], 'agent_id' => $values['agentId'],
'metaconsole_id' => $values['metaconsoleId'], 'metaconsole_id' => $values['metaconsoleId'],
'get_only_string_modules' => true,
], ],
]; ];

View File

@ -685,7 +685,7 @@ if (is_ajax()) {
); );
if ($get_only_string_modules) { if ($get_only_string_modules) {
$filter['tagente_modulo.id_tipo_modulo IN'] = '(17,23,3,10,33)'; $filter['tagente_modulo.id_tipo_modulo IN'] = '(17,23,3,10,33,36)';
} }
// Status selector. // Status selector.