From 4fc73cd7b70d279e7b51a1a357297c6c0b94d161 Mon Sep 17 00:00:00 2001 From: Calvo Date: Fri, 11 Feb 2022 12:01:41 +0100 Subject: [PATCH 1/4] Fix agentmodules widget conf style --- pandora_console/include/styles/dashboards.css | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/pandora_console/include/styles/dashboards.css b/pandora_console/include/styles/dashboards.css index d1ec1241f8..fbefcf891a 100644 --- a/pandora_console/include/styles/dashboards.css +++ b/pandora_console/include/styles/dashboards.css @@ -493,7 +493,7 @@ div#main_pure { #form-config-widget .info_box, .content-widget .info_box { border-radius: 5px; - width: 90%; + width: 100%; } #form-config-widget .info_box { @@ -516,15 +516,10 @@ div#main_pure { padding-right: 30px; } -#select_multiple_modules_filtered { - border: 1px solid #c1c1c1; - border-radius: 10px; -} - #select_multiple_modules_filtered > div { display: flex; flex-direction: row; - justify-content: space-around; + justify-content: space-between; align-items: center; margin: 5px; flex-wrap: wrap; @@ -537,12 +532,21 @@ div#main_pure { justify-content: center; align-items: center; flex-wrap: wrap; + width: 250px; } #select_multiple_modules_filtered > div > div > * { flex: auto; } +#select_multiple_modules_filtered > div > div > select { + min-width: 250px !important; +} + +#select_multiple_modules_filtered > div > div > .select2 { + min-width: 250px !important; +} + .visual-console-container-dashboard div.label strong { color: inherit; } From e2b3cd2dabacdf162227608035f05f984a68b914 Mon Sep 17 00:00:00 2001 From: Calvo Date: Tue, 15 Feb 2022 17:36:00 +0100 Subject: [PATCH 2/4] Visual changes on dashboard agent/modules configuration menu --- pandora_console/include/functions_html.php | 35 +++++++++++++------ .../javascript/multiselect_filtered.js | 17 +++++++-- .../include/javascript/pandora_dashboards.js | 7 ++-- .../lib/Dashboard/Widgets/agent_module.php | 1 + pandora_console/include/styles/dashboards.css | 8 ++++- 5 files changed, 52 insertions(+), 16 deletions(-) diff --git a/pandora_console/include/functions_html.php b/pandora_console/include/functions_html.php index c1c43098da..917b0951a5 100644 --- a/pandora_console/include/functions_html.php +++ b/pandora_console/include/functions_html.php @@ -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( diff --git a/pandora_console/include/javascript/multiselect_filtered.js b/pandora_console/include/javascript/multiselect_filtered.js index 88a0ad8dde..d90ed96699 100644 --- a/pandora_console/include/javascript/multiselect_filtered.js +++ b/pandora_console/include/javascript/multiselect_filtered.js @@ -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", { diff --git a/pandora_console/include/javascript/pandora_dashboards.js b/pandora_console/include/javascript/pandora_dashboards.js index e223e485d2..467c27e05c 100644 --- a/pandora_console/include/javascript/pandora_dashboards.js +++ b/pandora_console/include/javascript/pandora_dashboards.js @@ -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, diff --git a/pandora_console/include/lib/Dashboard/Widgets/agent_module.php b/pandora_console/include/lib/Dashboard/Widgets/agent_module.php index c17b61092f..6a0a71ca1f 100644 --- a/pandora_console/include/lib/Dashboard/Widgets/agent_module.php +++ b/pandora_console/include/lib/Dashboard/Widgets/agent_module.php @@ -267,6 +267,7 @@ class AgentModuleWidget extends Widget 'mShowSelectedOtherGroups' => true, 'mReturnAllGroup' => $return_all_group, 'mMetaFields' => ((bool) is_metaconsole()), + 'commonModulesSwitch' => true, ], ]; diff --git a/pandora_console/include/styles/dashboards.css b/pandora_console/include/styles/dashboards.css index fbefcf891a..8f5234aa87 100644 --- a/pandora_console/include/styles/dashboards.css +++ b/pandora_console/include/styles/dashboards.css @@ -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 { From a642f883647e65f3f6e7bded92209c026a09b3ce Mon Sep 17 00:00:00 2001 From: Calvo Date: Wed, 16 Feb 2022 12:26:22 +0100 Subject: [PATCH 3/4] Multiselect filtered revomed all/common modules select and added switch --- pandora_console/include/functions_html.php | 5 +++-- .../include/javascript/multiselect_filtered.js | 14 +++----------- .../include/javascript/pandora_dashboards.js | 2 +- 3 files changed, 7 insertions(+), 14 deletions(-) diff --git a/pandora_console/include/functions_html.php b/pandora_console/include/functions_html.php index 917b0951a5..ed2d327aed 100644 --- a/pandora_console/include/functions_html.php +++ b/pandora_console/include/functions_html.php @@ -1575,12 +1575,13 @@ function html_print_select_multiple_modules_filtered(array $data):string 1 => __('Show all modules'), ]; - if (empty($data['commonModulesSwitch']) === false && $data['commonModulesSwitch'] === true) { + if (true) { $output .= html_print_input( [ - 'label' => __('Common/all modules'), + 'label' => __('Only common modules'), 'type' => 'switch', + 'value' => 'checked', 'id' => 'filtered-module-show-common-modules-'.$uniqId, 'return' => true, 'onchange' => 'fmModuleChange(\''.$uniqId.'\', '.(int) is_metaconsole().')', diff --git a/pandora_console/include/javascript/multiselect_filtered.js b/pandora_console/include/javascript/multiselect_filtered.js index d90ed96699..3348a6ac48 100644 --- a/pandora_console/include/javascript/multiselect_filtered.js +++ b/pandora_console/include/javascript/multiselect_filtered.js @@ -218,17 +218,9 @@ function fmModuleChange(uniqId, isMeta) { "#filtered-module-show-common-modules-" + uniqId ).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"); - } + var showCommonModules = +( + $("#filtered-module-show-common-modules-" + uniqId).prop("checked") == false + ); jQuery.post( "ajax.php", diff --git a/pandora_console/include/javascript/pandora_dashboards.js b/pandora_console/include/javascript/pandora_dashboards.js index 467c27e05c..aacf542cbb 100644 --- a/pandora_console/include/javascript/pandora_dashboards.js +++ b/pandora_console/include/javascript/pandora_dashboards.js @@ -392,7 +392,7 @@ function initialiceLayout(data) { widgetId == 14 || widgetId == 2 || widgetId == 23 || widgetId == 16 ? 750 : 450, - maxHeight: 610, + maxHeight: 650, minHeight: widgetId == 16 ? 450 : 400 }, onsubmit: { From b67683adff5ca3d73c49771ee4c55e0a8fcb236c Mon Sep 17 00:00:00 2001 From: Calvo Date: Mon, 21 Feb 2022 16:38:09 +0100 Subject: [PATCH 4/4] Fix agent modules selector on meta for dashboards --- pandora_console/include/javascript/multiselect_filtered.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pandora_console/include/javascript/multiselect_filtered.js b/pandora_console/include/javascript/multiselect_filtered.js index 3348a6ac48..74f24f5a0a 100644 --- a/pandora_console/include/javascript/multiselect_filtered.js +++ b/pandora_console/include/javascript/multiselect_filtered.js @@ -232,11 +232,15 @@ function fmModuleChange(uniqId, isMeta) { selection: showCommonModules }, function(data) { + debugger; $("#filtered-module-modules-" + uniqId).html(""); if (data) { jQuery.each(data, function(id, value) { var option = $(""); if (isMeta === 1) { + if (value["id_node"] == null || value["id_node"] == "") { + option.attr("value", id).html(value); + } option .attr( "value",