#13059 fix bugs dashboard agent module view

This commit is contained in:
Jonathan 2024-04-04 18:21:10 +02:00
parent 7cdca7e622
commit 1a58501af9
5 changed files with 69 additions and 39 deletions

View File

@ -1926,7 +1926,7 @@ function html_print_select_multiple_modules_filtered_formated(array $data):strin
]
);
$output .= '</div>';
$output .= '<div class="recursive-modules">';
$output .= '<div class="recursive-modules mrgn_lft_20px_important">';
// Recursion.
$output .= html_print_input(
@ -2037,33 +2037,35 @@ function html_print_select_multiple_modules_filtered_formated(array $data):strin
if (is_metaconsole() === true) {
$output .= html_print_input(
[
'label' => __('Agents'),
'label_class' => 'font-title-font',
'type' => 'select',
'fields' => $agents,
'name' => 'filtered-module-agents-'.$uniqId,
'selected' => explode(',', $data['mAgents']),
'return' => true,
'multiple' => true,
'style' => 'min-width: 200px;max-width:200px;',
'script' => 'fmModuleChange(\''.$uniqId.'\', '.(int) is_metaconsole().')',
'placeholder' => (isset($data['placeholderAgents']) === true) ? $data['placeholderAgents'] : '',
'label' => __('Agents'),
'label_class' => 'font-title-font',
'type' => 'select',
'fields' => $agents,
'name' => 'filtered-module-agents-'.$uniqId,
'selected' => explode(',', $data['mAgents']),
'return' => true,
'multiple' => true,
'style' => 'min-width: 200px;max-width:200px;',
'script' => 'fmModuleChange(\''.$uniqId.'\', '.(int) is_metaconsole().')',
'placeholder' => (isset($data['placeholderAgents']) === true) ? $data['placeholderAgents'] : '',
'truncate_size' => 300,
]
);
} else {
$output .= html_print_input(
[
'label' => __('Agents'),
'label_class' => 'font-title-font',
'type' => 'select_from_sql',
'sql' => 'SELECT `id_agente`,`alias` FROM tagente',
'name' => 'filtered-module-agents-'.$uniqId,
'selected' => explode(',', $data['mAgents']),
'return' => true,
'multiple' => true,
'style' => 'min-width: 200px;max-width:200px;',
'script' => 'fmModuleChange(\''.$uniqId.'\', '.(int) is_metaconsole().')',
'placeholder' => (isset($data['placeholderAgents']) === true) ? $data['placeholderAgents'] : '',
'label' => __('Agents'),
'label_class' => 'font-title-font',
'type' => 'select_from_sql',
'sql' => 'SELECT `id_agente`,`alias` FROM tagente',
'name' => 'filtered-module-agents-'.$uniqId,
'selected' => explode(',', $data['mAgents']),
'return' => true,
'multiple' => true,
'style' => 'min-width: 200px;max-width:200px;',
'script' => 'fmModuleChange(\''.$uniqId.'\', '.(int) is_metaconsole().')',
'placeholder' => (isset($data['placeholderAgents']) === true) ? $data['placeholderAgents'] : '',
'truncate_size' => 300,
]
);
}
@ -2075,8 +2077,9 @@ function html_print_select_multiple_modules_filtered_formated(array $data):strin
$data['mModuleGroup'],
explode(',', $data['mAgents']),
!$commonModules,
false,
true
true,
(bool) $commonModules,
false
);
} else {
$all_modules = [];
@ -2098,16 +2101,17 @@ function html_print_select_multiple_modules_filtered_formated(array $data):strin
$output .= html_print_input(
[
'label' => __('Modules'),
'label_class' => 'font-title-font',
'type' => 'select',
'fields' => $all_modules,
'name' => 'filtered-module-modules-'.$uniqId,
'selected' => $result,
'return' => true,
'multiple' => true,
'style' => 'max-width:98%;',
'input_class' => 'flex-colum-center-important',
'label' => __('Modules'),
'label_class' => 'font-title-font',
'type' => 'select',
'fields' => $all_modules,
'name' => 'filtered-module-modules-'.$uniqId,
'selected' => $result,
'return' => true,
'multiple' => true,
'style' => 'max-width:98%;',
'input_class' => 'flex-colum-center-important',
'truncate_size' => 300,
]
);
@ -2162,6 +2166,7 @@ function html_print_select_from_sql(
$class='',
$required=false,
$placeholder='',
$title=false,
) {
global $config;
@ -2209,7 +2214,8 @@ function html_print_select_from_sql(
'',
false,
null,
$placeholder
$placeholder,
$title
);
}
@ -5989,6 +5995,7 @@ function html_print_input($data, $wrapper='div', $input_only=false)
((isset($data['class']) === true) ? $data['class'] : ''),
((isset($data['required']) === true) ? $data['required'] : false),
((isset($data['placeholder']) === true) ? $data['placeholder'] : null),
((isset($data['title']) === true) ? $data['title'] : false),
);
break;

View File

@ -218,6 +218,7 @@ function fmModuleChange(uniqId, isMeta) {
"#filtered-module-show-common-modules-" + uniqId
).attr("type");
var select_mode = isMeta === 1 ? 0 : 1;
var showCommonModules = +(
$("#filtered-module-show-common-modules-" + uniqId).prop("checked") == false
);
@ -229,7 +230,8 @@ function fmModuleChange(uniqId, isMeta) {
get_modules_group_json: 1,
id_module_group: idModuleGroup,
id_agents: idAgents,
selection: showCommonModules
selection: showCommonModules,
select_mode: select_mode
},
function(data) {
$("#filtered-module-modules-" + uniqId).html("");

View File

@ -330,7 +330,20 @@ function initialiceLayout(data) {
},
dataType: "json",
success: function(data) {
addCell(data.cellId, 0, 0, 4, 4, true, 0, 2000, 0, 2000, 0, true);
addCell(
data.cellId,
0,
0,
4,
4,
true,
0,
2000,
0,
2000,
original_widgetId,
true
);
},
error: function(xhr, textStatus, errorMessage) {
console.log("ERROR" + errorMessage + textStatus + xhr);

View File

@ -297,7 +297,7 @@ class AgentModuleWidget extends Widget
}
$inputs[] = [
'class' => 'flex flex-column',
'class' => 'flex-colum-center-important',
'id' => 'select_multiple_modules_filtered_formated',
'arguments' => [
'type' => 'select_multiple_modules_filtered_formated',
@ -514,6 +514,10 @@ class AgentModuleWidget extends Widget
$array_names = [];
foreach ($allModules as $module_name) {
if (is_numeric($module_name)) {
$module_name = modules_get_agentmodule_name($module_name);
}
$file_name = ui_print_truncate_text(
\io_safe_output($module_name),
'module_small',

View File

@ -7187,6 +7187,10 @@ div.graph div.legend table {
margin-left: 20px;
}
.mrgn_lft_20px_important {
margin-left: 20px !important;
}
.mrgn_lft_23px {
margin-left: 23px;
}