From 620bff28af70cbf60e5729c9e082d597c6e3fcd9 Mon Sep 17 00:00:00 2001 From: Pablo Aragon Date: Tue, 14 Mar 2023 15:59:20 +0100 Subject: [PATCH 1/3] Dashboards widgets --- .../include/lib/Dashboard/Widgets/single_graph.php | 2 +- pandora_console/include/styles/dashboards.css | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/pandora_console/include/lib/Dashboard/Widgets/single_graph.php b/pandora_console/include/lib/Dashboard/Widgets/single_graph.php index e6372c49f4..09f1c15a16 100644 --- a/pandora_console/include/lib/Dashboard/Widgets/single_graph.php +++ b/pandora_console/include/lib/Dashboard/Widgets/single_graph.php @@ -418,7 +418,7 @@ class SingleGraphWidget extends Widget 'dashboard' => true, ]; - $output = '
'; + $output = '
'; $output .= \grafico_modulo_sparse($params); $output .= '
'; return $output; diff --git a/pandora_console/include/styles/dashboards.css b/pandora_console/include/styles/dashboards.css index 63b4f79b9f..501cfe40da 100644 --- a/pandora_console/include/styles/dashboards.css +++ b/pandora_console/include/styles/dashboards.css @@ -835,3 +835,11 @@ form.modal-dashboard border: 0px; width: 90%; } + +div.widget-mrgn-0px > div.parent_graph { + margin: 0px; +} + +div.widget-mrgn-0px > div.parent_graph > div[id^="graph_"] { + width: calc(100% + 14px) !important; +} From c4f4d371cc615a8ce83dff0ce0f9f362d3a1dcdd Mon Sep 17 00:00:00 2001 From: daniel Date: Tue, 14 Mar 2023 17:25:58 +0100 Subject: [PATCH 2/3] fixed styles --- .../agentes/module_manager_editor_common.php | 215 +++++++----------- 1 file changed, 88 insertions(+), 127 deletions(-) diff --git a/pandora_console/godmode/agentes/module_manager_editor_common.php b/pandora_console/godmode/agentes/module_manager_editor_common.php index 2cceb5fa34..b87d508546 100644 --- a/pandora_console/godmode/agentes/module_manager_editor_common.php +++ b/pandora_console/godmode/agentes/module_manager_editor_common.php @@ -444,7 +444,8 @@ $tableBasicThresholds->data = []; $tableBasicThresholds->rowclass['caption_warning_threshold'] = 'field_half_width pdd_t_10px'; $tableBasicThresholds->rowclass['warning_threshold'] = 'field_half_width'; $tableBasicThresholds->data['caption_warning_threshold'][0] .= __('Warning threshold').' '; -if ($edit_module === false && (isset($stringTypeModule) === false || $stringTypeModule === false)) { + +if ((isset($stringTypeModule) === false || $stringTypeModule === false)) { $tableBasicThresholds->data['caption_warning_threshold'][0] .= '('.__('Min / Max').')'; $tableBasicThresholds->data['warning_threshold'][0] .= html_print_input_text( 'min_warning', @@ -482,7 +483,7 @@ if ($edit_module === false && (isset($stringTypeModule) === false || $stringType ); } -if ($edit_module === false && isset($stringTypeModule) === true && $stringTypeModule === true) { +if (isset($stringTypeModule) === true && $stringTypeModule === true) { $basicThresholdsIntervalWarning = []; $basicThresholdsIntervalWarning[] = ''.__('Inverse interval').''; $basicThresholdsIntervalWarning[] = html_print_checkbox_switch( @@ -531,7 +532,7 @@ $tableBasicThresholds->data['switch_warning_threshold'][0] .= html_print_div( $tableBasicThresholds->rowclass['caption_critical_threshold'] = 'field_half_width pdd_t_10px'; $tableBasicThresholds->rowclass['critical_threshold'] = 'field_half_width'; $tableBasicThresholds->data['caption_critical_threshold'][0] .= __('Critical threshold').' '; -if ($edit_module === false && (isset($stringTypeModule) === false || $stringTypeModule === false)) { +if ((isset($stringTypeModule) === false || $stringTypeModule === false)) { $tableBasicThresholds->data['caption_critical_threshold'][0] .= '('.__('Min / Max').')'; $tableBasicThresholds->data['critical_threshold'][0] .= html_print_input_text( 'min_critical', @@ -569,7 +570,7 @@ if ($edit_module === false && (isset($stringTypeModule) === false || $stringType ); } -if ($edit_module === false && isset($stringTypeModule) === true && $stringTypeModule === true) { +if (isset($stringTypeModule) === true && $stringTypeModule === true) { $basicThresholdsIntervalCritical = []; $basicThresholdsIntervalCritical[] = ''.__('Inverse interval').''; $basicThresholdsIntervalCritical[] = html_print_checkbox_switch( @@ -1905,78 +1906,63 @@ $(document).ready (function () { }); $('.switch_radio_button label').on('click', function(){ + console.log('primero'); var thisLabel = $(this).attr('for'); - $('#'+thisLabel).attr('checked', 'checked'); - $('#'+thisLabel).siblings().attr('checked', false); - - if ($('#radius-warning_inverse').prop('checked') === true) { - //$('#percentage_warning').hide(); - $("#svg_dinamic").show(); - } + console.log(thisLabel); + $('#'+thisLabel).prop('checked', true); + $('#'+thisLabel).siblings().prop('checked', false); - if ($('#radius-critical_inverse').prop('checked') === true) { - //$('#percentage_critical').hide(); + console.log('++++++++++Los warning++++++++++++++'); + console.log('normal_warning: '+$('#radius-normal_warning').prop('checked')); + console.log('warning_inverse: '+$('#radius-warning_inverse').prop('checked')); + console.log('percentage_warning: '+$('#radius-percentage_warning').prop('checked')); + + console.log('++++++++++Los critical++++++++++++++'); + console.log('normal_critical: '+$('#radius-normal_critical').prop('checked')); + console.log('critical_inverse: '+$('#radius-critical_inverse').prop('checked')); + console.log('percentage_critical: '+$('#radius-percentage_critical').prop('checked')); + + if ($('#radius-percentage_warning').prop('checked') === true || $('#radius-percentage_critical').prop('checked') === true) { + $("#svg_dinamic").hide(); + } else { + paint_graph_values(); $("#svg_dinamic").show(); } if ($('#radius-percentage_warning').prop('checked') === true) { - //$('#warning_inverse').hide(); - $("#svg_dinamic").hide(); + $('#radius-warning_inverse').hide(); + $('#label-radius-warning_inverse').hide(); } + if ($('#radius-warning_inverse').prop('checked') === true) { + $('#radius-percentage_warning').hide(); + $('#label-radius-percentage_warning').hide(); + } + + if ($('#radius-normal_warning').prop('checked') === true) { + $('#radius-warning_inverse').show(); + $('#label-radius-warning_inverse').show(); + $('#radius-percentage_warning').show(); + $('#label-radius-percentage_warning').show(); + } + + if ($('#radius-percentage_critical').prop('checked') === true) { - //$('#critical_inverse').hide(); - $("#svg_dinamic").hide(); + $('#radius-critical_inverse').hide(); + $('#label-radius-critical_inverse').hide(); } - $('#radius-warning_inverse').change (function() { - paint_graph_values(); - if ($('#radius-warning_inverse').prop('checked') === true){ - $('#radius-percentage_warning').prop('checked', false); - $('#percentage_warning').attr('onClick', 'return false;'); - $('#percentage_warning>em').addClass('color_666'); - } else { - $('#percentage_warning').removeAttr('onClick'); - $('#percentage_warning>em').removeClass('color_666'); - } - }); + if ($('#radius-critical_inverse').prop('checked') === true) { + $('#radius-percentage_critical').hide(); + $('#label-radius-percentage_critical').hide(); + } - $('#radius-critical_inverse').change (function() { - paint_graph_values(); - - if ($('#radius-critical_inverse').prop('checked') === true){ - $('#radius-percentage_critical').prop('checked', false); - $('#percentage_critical').attr('onClick', 'return false;'); - $('#percentage_critical>em').addClass('color_666'); - } else { - $('#percentage_critical').removeAttr('onClick'); - $('#percentage_critical>em').removeClass('color_666'); - } - }); - - $('#radius-percentage_warning').change (function() { - paint_graph_values(); - if ($('#radius-percentage_warning').prop('checked') === true){ - $('#radius-warning_inverse').prop('checked', false); - $('#warning_inverse').attr('onClick', 'return false;'); - $('#warning_inverse>em').addClass('color_666'); - } else { - $('#warning_inverse').removeAttr('onClick'); - $('#warning_inverse>em').removeClass('color_666'); - } - }); - - $('#radius-percentage_critical').change (function() { - paint_graph_values(); - if ($('#radius-percentage_critical').prop('checked') === true){ - $('#radius-critical_inverse').prop('checked', false); - $('#critical_inverse').attr('onClick', 'return false;'); - $('#critical_inverse>em').addClass('color_666'); - } else { - $('#critical_inverse').removeAttr('onClick'); - $('#critical_inverse>em').removeClass('color_666'); - } - }); + if ($('#radius-normal_critical').prop('checked') === true) { + $('#radius-critical_inverse').show(); + $('#label-radius-critical_inverse').show(); + $('#radius-percentage_critical').show(); + $('#label-radius-percentage_critical').show(); + } }); @@ -2235,91 +2221,66 @@ function validate_post_process() { } } -//function paint graph +//function paint graph. function paint_graph_values(){ - //Parse integrer var min_w = parseFloat($('#text-min_warning').val()); - if(min_w == '0.00'){ min_w = 0; } - var max_w = parseFloat($('#text-max_warning').val()); - if(max_w == '0.00'){ max_w = 0; } - var min_c = parseFloat($('#text-min_critical').val()); - if(min_c =='0.00'){ min_c = 0; } - var max_c = parseFloat($('#text-max_critical').val()); - if(max_c =='0.00'){ max_c = 0; } - var inverse_w = $('input:radio[name=warning_inverse]:checked').val(); - if(!inverse_w){ inverse_w = 0; } - var inverse_c = $('input:radio[name=critical_inverse]:checked').val(); - if(!inverse_c){ inverse_c = 0; } + if(min_w == '0.00' || isNaN(min_w)){ min_w = 0; } - //inicialiced error + var max_w = parseFloat($('#text-max_warning').val()); + if(max_w == '0.00' || isNaN(max_w)){ max_w = 0; } + + var min_c = parseFloat($('#text-min_critical').val()); + if(min_c =='0.00' || isNaN(min_c)){ min_c = 0; } + + var max_c = parseFloat($('#text-max_critical').val()); + if(max_c =='0.00' || isNaN(max_c)){ max_c = 0; } + + var inverse_w = $('input:radio[value=warning_inverse]:checked').val(); + if(!inverse_w){ inverse_w = 0; } + + var inverse_c = $('input:radio[value=critical_inverse]:checked').val(); + if(!inverse_c){ inverse_c = 0; } + + //inicialiced error. var error_w = 0; var error_c = 0; - //messages legend + + //messages legend. var legend_normal = ''; var legend_warning = ''; var legend_critical = ''; - //messages error + + //messages error. var message_error_warning = ''; var message_error_critical = ''; var message_error_percentage = ''; - - - //Percentage selector - var percentage_w = $('#checkbox-percentage_warning').prop('checked'); - var percentage_c = $('#checkbox-percentage_critical').prop('checked'); - - if(percentage_w == true || percentage_c == true) { - d3.select("#svg_dinamic rect").remove(); - //create svg - var svg = d3.select("#svg_dinamic"); - svg.selectAll("g").remove(); - if (percentage_w === true) { - if(max_w < 0 || min_w < 0) { - paint_graph_status(0,0,0,0,0,0,1,0,legend_normal,legend_warning,legend_critical,message_error_percentage,message_error_percentage); - } else { - $("#text-max_warning").removeClass("input_error"); - $("#text-min_warning").removeClass("input_error"); - } - - } - - if(percentage_c === true) { - if(max_c < 0 || min_c < 0) { - paint_graph_status(0,0,0,0,0,0,0,1,legend_normal,legend_warning,legend_critical,message_error_percentage,message_error_percentage); - } else { - $("#text-min-critical").removeClass("input_error"); - $("#text-max_critical").removeClass("input_error"); - - } - } - - return; - - } else { - $('#svg_dinamic').show(); - } //if haven't error if(max_w == 0 || max_w > min_w){ if(max_c == 0 || max_c > min_c){ - paint_graph_status(min_w, max_w, min_c, max_c, inverse_w, - inverse_c, error_w, error_c, - legend_normal, legend_warning, legend_critical, - message_error_warning, message_error_critical); + paint_graph_status( + min_w, max_w, min_c, max_c, inverse_w, + inverse_c, error_w, error_c, + legend_normal, legend_warning, legend_critical, + message_error_warning, message_error_critical + ); } else { error_c = 1; - paint_graph_status(0,0,0,0,0,0, error_w, error_c, - legend_normal, legend_warning, legend_critical, - message_error_warning, message_error_critical); + paint_graph_status( + 0,0,0,0,0,0, error_w, error_c, + legend_normal, legend_warning, legend_critical, + message_error_warning, message_error_critical + ); } } else { error_w = 1; - paint_graph_status(0,0,0,0,0,0, error_w, error_c, - legend_normal, legend_warning, legend_critical, - message_error_warning, message_error_critical); + paint_graph_status( + 0,0,0,0,0,0, error_w, error_c, + legend_normal, legend_warning, legend_critical, + message_error_warning, message_error_critical + ); } } -/* End of relationship javascript */ /* ]]> */ From 423767a32a1c82e3193eb1b8c7ddc8dca597770f Mon Sep 17 00:00:00 2001 From: daniel Date: Tue, 14 Mar 2023 17:27:01 +0100 Subject: [PATCH 3/3] fixed styles --- .../godmode/agentes/module_manager_editor_common.php | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/pandora_console/godmode/agentes/module_manager_editor_common.php b/pandora_console/godmode/agentes/module_manager_editor_common.php index b87d508546..0231245274 100644 --- a/pandora_console/godmode/agentes/module_manager_editor_common.php +++ b/pandora_console/godmode/agentes/module_manager_editor_common.php @@ -1906,21 +1906,9 @@ $(document).ready (function () { }); $('.switch_radio_button label').on('click', function(){ - console.log('primero'); var thisLabel = $(this).attr('for'); - console.log(thisLabel); $('#'+thisLabel).prop('checked', true); $('#'+thisLabel).siblings().prop('checked', false); - - console.log('++++++++++Los warning++++++++++++++'); - console.log('normal_warning: '+$('#radius-normal_warning').prop('checked')); - console.log('warning_inverse: '+$('#radius-warning_inverse').prop('checked')); - console.log('percentage_warning: '+$('#radius-percentage_warning').prop('checked')); - - console.log('++++++++++Los critical++++++++++++++'); - console.log('normal_critical: '+$('#radius-normal_critical').prop('checked')); - console.log('critical_inverse: '+$('#radius-critical_inverse').prop('checked')); - console.log('percentage_critical: '+$('#radius-percentage_critical').prop('checked')); if ($('#radius-percentage_warning').prop('checked') === true || $('#radius-percentage_critical').prop('checked') === true) { $("#svg_dinamic").hide();