Visual changes on dashboard agent/modules configuration menu

This commit is contained in:
Calvo 2022-02-15 17:36:00 +01:00
parent 4fc73cd7b7
commit e2b3cd2dab
5 changed files with 52 additions and 16 deletions

View File

@ -1574,17 +1574,30 @@ function html_print_select_multiple_modules_filtered(array $data):string
0 => __('Show common modules'),
1 => __('Show all modules'),
];
$output .= html_print_input(
[
'label' => __('Show common modules'),
'type' => 'select',
'fields' => $selection,
'name' => 'filtered-module-show-common-modules-'.$uniqId,
'selected' => $data['mShowCommonModules'],
'return' => true,
'script' => 'fmModuleChange(\''.$uniqId.'\', '.(int) is_metaconsole().')',
]
);
if (empty($data['commonModulesSwitch']) === false && $data['commonModulesSwitch'] === true) {
$output .= html_print_input(
[
'label' => __('Common/all modules'),
'type' => 'switch',
'id' => 'filtered-module-show-common-modules-'.$uniqId,
'return' => true,
'onchange' => 'fmModuleChange(\''.$uniqId.'\', '.(int) is_metaconsole().')',
]
);
} else {
$output .= html_print_input(
[
'label' => __('Show common modules'),
'type' => 'select',
'fields' => $selection,
'name' => 'filtered-module-show-common-modules-'.$uniqId,
'return' => true,
'script' => 'fmModuleChange(\''.$uniqId.'\', '.(int) is_metaconsole().')',
]
);
}
if ($data['mAgents'] !== null) {
$all_modules = get_modules_agents(

View File

@ -214,9 +214,22 @@ function fmAgentChange(uniqId) {
function fmModuleChange(uniqId, isMeta) {
var idModuleGroup = $("#filtered-module-module-group-" + uniqId).val();
var idAgents = $("#filtered-module-agents-" + uniqId).val();
var showCommonModules = $(
var commonSelectorType = $(
"#filtered-module-show-common-modules-" + uniqId
).val();
).attr("type");
var showCommonModules = 0;
if (commonSelectorType != "checkbox") {
showCommonModules = $(
"#filtered-module-show-common-modules-" + uniqId
).val();
} else {
showCommonModules = +$(
"#filtered-module-show-common-modules-" + uniqId
).prop("checked");
}
jQuery.post(
"ajax.php",
{

View File

@ -388,9 +388,12 @@ function initialiceLayout(data) {
dashboardId: data.dashboardId,
widgetId: widgetId
},
width: widgetId == 14 || widgetId == 2 || widgetId == 23 ? 750 : 450,
width:
widgetId == 14 || widgetId == 2 || widgetId == 23 || widgetId == 16
? 750
: 450,
maxHeight: 610,
minHeight: 400
minHeight: widgetId == 16 ? 450 : 400
},
onsubmit: {
page: data.page,

View File

@ -267,6 +267,7 @@ class AgentModuleWidget extends Widget
'mShowSelectedOtherGroups' => true,
'mReturnAllGroup' => $return_all_group,
'mMetaFields' => ((bool) is_metaconsole()),
'commonModulesSwitch' => true,
],
];

View File

@ -516,6 +516,12 @@ div#main_pure {
padding-right: 30px;
}
#select_multiple_modules_filtered {
border: 1px solid #c1c1c1;
border-radius: 10px;
width: auto;
}
#select_multiple_modules_filtered > div {
display: flex;
flex-direction: row;
@ -523,7 +529,7 @@ div#main_pure {
align-items: center;
margin: 5px;
flex-wrap: wrap;
flex: 1 1 320px;
flex: 1 2 750px;
}
#select_multiple_modules_filtered > div > div {