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,6 +340,15 @@ final class BarsGraph extends Item
$height = (int) $data['height']; $height = (int) $data['height'];
} }
if (empty($moduleData) === true) {
$image = ui_get_full_url(
'images/image_problem_area.png',
false,
false,
false
);
$graph = base64_encode(file_get_contents($image));
} else {
if ($typeGraph === 'horizontal') { if ($typeGraph === 'horizontal') {
$graph = \hbar_graph( $graph = \hbar_graph(
$moduleData, $moduleData,
@ -392,6 +401,7 @@ final class BarsGraph extends Item
true true
); );
} }
}
// Restore connection. // Restore connection.
if ($nodeConnected === true) { if ($nodeConnected === true) {
@ -493,6 +503,7 @@ final class BarsGraph extends Item
'module_input' => true, 'module_input' => true,
'module_name' => 'moduleId', 'module_name' => 'moduleId',
'module_none' => false, 'module_none' => false,
'get_only_string_modules' => true,
], ],
]; ];
@ -508,6 +519,7 @@ final class BarsGraph extends Item
'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

@ -220,6 +220,7 @@ final class DonutGraph extends Item
'module_input' => true, 'module_input' => true,
'module_name' => 'moduleId', 'module_name' => 'moduleId',
'module_none' => false, 'module_none' => false,
'get_only_string_modules' => true,
], ],
]; ];
@ -235,6 +236,7 @@ final class DonutGraph extends Item
'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.