13188-Fix custom graph modules selector

This commit is contained in:
Pablo Aragon 2024-04-18 16:55:58 +02:00
parent 75acd03568
commit 9677cf49e0
5 changed files with 83 additions and 48 deletions

View File

@ -154,14 +154,16 @@ $table->data[0][1] = html_print_label_input_block(
echo '<span id ="none_text" class="invisible">'.__('None').'</span>';
echo "<form id='agentmodules' method='post' action='index.php?sec=reporting&sec2=godmode/reporting/graph_builder&tab=graph_editor&add_module=1&edit_graph=1&id=".$id_graph."'>";
echo "<table width='100%' cellpadding='4' cellpadding='4' class='databox filters max_floating_element_size'>";
echo "<table width='100%' cellpadding='4' cellpadding='4' class='databox filters max_floating_element_size custom-graph-editor'>";
echo '<tr>';
echo '<td class="w50p pdd_50px" id="select_multiple_modules_filtered">'.html_print_input(
[
'type' => 'select_multiple_modules_filtered',
'uniqId' => 'modules',
'class' => 'flex flex-row',
'searchBar' => false,
'searchBar' => true,
'searchBarAgents' => false,
'searchBarModules' => true,
'placeholderAgents' => __('Search agent name'),
]
).'</td>';

View File

@ -1686,38 +1686,6 @@ function html_print_select_multiple_modules_filtered(array $data):string
);
$output .= '</div>';
if (empty($data['searchBar']) === false && $data['searchBar'] === true) {
$output .= '<div>';
$output .= '<div>';
$output .= html_print_input(
[
'type' => 'text',
'name' => 'agent-searchBar-'.$uniqId,
'onKeyUp' => 'searchAgent(\''.$uniqId.'\')',
'placeholder' => __('Type to search agents'),
'return' => true,
]
);
$output .= '</div>';
$output .= '<div>';
$output .= html_print_input(
[
'type' => 'text',
'name' => 'module-searchBar-'.$uniqId,
'onKeyUp' => 'searchModule(\''.$uniqId.'\')',
'return' => true,
'placeholder' => __('Type to search modules'),
]
);
$output .= '</div>';
$output .= '</div>';
}
$output .= '<div>';
// Agent.
$agents = agents_get_group_agents(
@ -1853,6 +1821,54 @@ function html_print_select_multiple_modules_filtered(array $data):string
$output .= '</div>';
if (empty($data['searchBar']) === false && $data['searchBar'] === true) {
$output .= '<div class="agents-modules-multiple-search-bar">';
if (isset($data['searchBarAgents']) === false) {
$data['searchBarAgents'] = true;
}
if (isset($data['searchBarModules']) === false) {
$data['searchBarModules'] = true;
}
if ($data['searchBarAgents'] === true) {
$output .= '<div>';
$output .= html_print_input(
[
'type' => 'text',
'name' => 'agent-searchBar-'.$uniqId,
'onKeyUp' => 'searchAgent(\''.$uniqId.'\')',
'placeholder' => __('Type to search agents'),
'return' => true,
]
);
$output .= '</div>';
} else {
$output .= '<div></div>';
}
if ($data['searchBarModules'] === true) {
$output .= '<div>';
$output .= html_print_input(
[
'type' => 'text',
'name' => 'module-searchBar-'.$uniqId,
'onKeyUp' => 'searchModule(\''.$uniqId.'\')',
'return' => true,
'placeholder' => __('Type to search modules'),
]
);
$output .= '</div>';
} else {
$output .= '<div></div>';
}
$output .= '</div>';
}
if ($data['return'] === false) {
echo $output;
}
@ -1929,7 +1945,7 @@ function html_print_select_multiple_modules_filtered_formated(array $data):strin
'return' => true,
'nothing' => __('All'),
'nothing_value' => 0,
'script' => 'fmModuleChange(\''.$uniqId.'\', '.(int) is_metaconsole().')',
'script' => 'fmModuleChange(\''.$uniqId.'\', '.(int) is_metaconsole().', true)',
]
);
$output .= '</div>';
@ -1965,7 +1981,7 @@ function html_print_select_multiple_modules_filtered_formated(array $data):strin
'name' => 'filtered-module-show-common-modules-'.$uniqId,
'id' => 'filtered-module-show-common-modules-'.$uniqId,
'return' => true,
'onchange' => 'fmModuleChange(\''.$uniqId.'\', '.(int) is_metaconsole().')',
'onchange' => 'fmModuleChange(\''.$uniqId.'\', '.(int) is_metaconsole().', true)',
]
);
@ -2053,7 +2069,7 @@ function html_print_select_multiple_modules_filtered_formated(array $data):strin
'return' => true,
'multiple' => true,
'style' => 'min-width: 200px;max-width:200px;',
'script' => 'fmModuleChange(\''.$uniqId.'\', '.(int) is_metaconsole().')',
'script' => 'fmModuleChange(\''.$uniqId.'\', '.(int) is_metaconsole().', true)',
'placeholder' => (isset($data['placeholderAgents']) === true) ? $data['placeholderAgents'] : '',
'truncate_size' => 300,
]
@ -2070,7 +2086,7 @@ function html_print_select_multiple_modules_filtered_formated(array $data):strin
'return' => true,
'multiple' => true,
'style' => 'min-width: 200px;max-width:200px;',
'script' => 'fmModuleChange(\''.$uniqId.'\', '.(int) is_metaconsole().')',
'script' => 'fmModuleChange(\''.$uniqId.'\', '.(int) is_metaconsole().', true)',
'placeholder' => (isset($data['placeholderAgents']) === true) ? $data['placeholderAgents'] : '',
'truncate_size' => 300,
]

View File

@ -211,7 +211,7 @@ function fmAgentChange(uniqId) {
}
// eslint-disable-next-line no-unused-vars
function fmModuleChange(uniqId, isMeta) {
function fmModuleChange(uniqId, isMeta, valueID = false) {
var idModuleGroup = $("#filtered-module-module-group-" + uniqId).val();
var idAgents = $("#filtered-module-agents-" + uniqId).val();
var commonSelectorType = $(
@ -253,7 +253,7 @@ function fmModuleChange(uniqId, isMeta) {
.html(value["nombre"]);
} else {
option
.attr("value", id)
.attr("value", valueID === false ? value : id)
.attr("title", value)
.html(value);
}

View File

@ -14218,14 +14218,6 @@ button.ui-button-text-only.ui-widget.sub:hover,
box-shadow: none;
}
.black-and-white {
filter: saturate(0);
}
.invert_filter.black-and-white {
filter: invert(1) saturate(0) !important;
}
div.tox .tox-editor-header {
z-index: 1;
}
@ -14268,3 +14260,20 @@ table.filter-table-adv td > div.row-flex label.custom_checkbox {
table.filter-table-adv td > div.row-flex input {
width: 100%;
}
.custom-graph-editor
#select_multiple_modules_filtered
> div.agents-modules-multiple-search-bar
> div {
width: 37%;
}
.custom-graph-editor
#select_multiple_modules_filtered
> div.agents-modules-multiple-search-bar
> div
> input {
width: 100%;
max-width: 100%;
height: 30px;
}

View File

@ -2094,3 +2094,11 @@ select option:checked {
#horizontalBar > .labels > .label > div[style^="background"] {
filter: invert(1);
}
.black-and-white {
filter: saturate(0);
}
.invert_filter.black-and-white {
filter: invert(1) saturate(0) !important;
}