From bed1e34fd216f9f5d28e73d3ac77635ed616bfc7 Mon Sep 17 00:00:00 2001 From: Pablo Aragon Date: Wed, 15 Mar 2023 15:58:28 +0100 Subject: [PATCH] Dashboards widgets --- .../godmode/agentes/agent_manager.php | 25 ++- .../include/class/ExternalTools.class.php | 159 +++++++++++------- .../javascript/jquery.pandora.controls.js | 39 ++--- pandora_console/include/styles/dashboards.css | 8 + .../agentes/interface_view.functions.php | 38 ++--- 5 files changed, 152 insertions(+), 117 deletions(-) diff --git a/pandora_console/godmode/agentes/agent_manager.php b/pandora_console/godmode/agentes/agent_manager.php index f524fb7d9e..9281c04e44 100644 --- a/pandora_console/godmode/agentes/agent_manager.php +++ b/pandora_console/godmode/agentes/agent_manager.php @@ -487,21 +487,18 @@ if (isset($groups[$grupo]) === true || $new_agent === true) { $tableAgent->data['primary_group'][0] .= html_print_input_hidden('grupo', $grupo, true); } -$tableAgent->data['primary_group'][0] .= html_print_div( - [ - 'content' => ui_print_group_icon( - $grupo, - true, - '', - ($id_agente === 0) ? 'display: none;' : '', - true, - false, - false, - 'after_input_icon' - ), - ], - true +$tableAgent->data['primary_group'][0] .= ''; +$tableAgent->data['primary_group'][0] .= ui_print_group_icon( + $grupo, + true, + '', + ($id_agente === 0) ? 'display: none;' : '', + true, + false, + false, + 'after_input_icon' ); +$tableAgent->data['primary_group'][0] .= ''; $tableAgent->data['caption_interval'][0] = __('Interval'); // $tableAgent->rowstyle['interval'] = 'width: 260px'; diff --git a/pandora_console/include/class/ExternalTools.class.php b/pandora_console/include/class/ExternalTools.class.php index 67345a61f8..3bcdce51ab 100644 --- a/pandora_console/include/class/ExternalTools.class.php +++ b/pandora_console/include/class/ExternalTools.class.php @@ -528,77 +528,103 @@ class ExternalTools extends HTML // Form table. $table = new StdClass(); - $table->class = 'fixed_filter_bar'; + $table->class = 'fixed_filter_bar filter-table-adv pdd_15px'; $table->id = 'externalToolTable'; - $table->cellstyle['captions'][0] = 'width: 0'; - $table->cellstyle['captions'][1] = 'width: 0'; - $table->cellstyle['captions'][2] = 'width: 0'; + $table->size[0] = '25%'; + $table->size[1] = '25%'; + $table->size[2] = '25%'; + $table->size[3] = '25%'; + $table->colspan = []; + $table->colspan[1][0] = 4; + // $table->cellclass[0][2] = 'snmpcolumn'; + // $table->cellclass[0][2] = 'snmpcolumn'; + // $table->cellclass[0][3] = 'snmpcolumn'; + // $table->cellclass[0][3] = 'snmpcolumn'; $table->data = []; - $table->data['captions'][0] = __('Operation'); - - $table->data['inputs'][0] = html_print_select( - $commandList, - 'operation', - $this->operation, - 'mostrarColumns(this.value)', - __('Please select'), - 0, - true + $table->data[0][0] = html_print_label_input_block( + __('Operation'), + html_print_select( + $commandList, + 'operation', + $this->operation, + 'mostrarColumns(this.value)', + __('Please select'), + 0, + true, + false, + true, + 'w100p', + false, + 'width: 100%;' + ) ); - $table->data['captions'][1] = __('IP Adress'); - $table->data['inputs'][1] = html_print_select( - $ipsSelect, - 'select_ips', - $principal_ip, - '', - '', - 0, - true + $table->data[0][1] = html_print_label_input_block( + __('IP Adress'), + html_print_select( + $ipsSelect, + 'select_ips', + $principal_ip, + '', + '', + 0, + true, + false, + true, + 'w100p', + false, + 'width: 100%;' + ) ); - $table->cellclass['captions'][2] = 'snmpcolumn'; - $table->cellclass['inputs'][2] = 'snmpcolumn'; - $table->data['captions'][2] = __('SNMP Version'); - $table->data['inputs'][2] = html_print_select( + $table->data[0][2] = html_print_label_input_block( + __('SNMP Version'), + html_print_select( + [ + '1' => 'v1', + '2c' => 'v2c', + ], + 'select_version', + $this->snmp_version, + '', + '', + 0, + true, + false, + true, + 'w100p', + false, + 'width: 100%;' + ), + ['div_class' => 'snmpcolumn'] + ); + + $table->data[0][3] = html_print_label_input_block( + __('SNMP Community'), + html_print_input_text( + 'community', + $this->community, + '', + 50, + 255, + true, + false, + false, + '', + 'w100p' + ), + ['div_class' => 'snmpcolumn'] + ); + + $table->data[1][0] = html_print_submit_button( + __('Execute'), + 'submit', + false, [ - '1' => 'v1', - '2c' => 'v2c', - ], - 'select_version', - $this->snmp_version, - '', - '', - 0, - true - ); - - $table->cellclass['captions'][3] = 'snmpcolumn'; - $table->cellclass['inputs'][3] = 'snmpcolumn'; - $table->data['captions'][3] = __('SNMP Community'); - $table->data['inputs'][3] = html_print_input_text( - 'community', - $this->community, - '', - 50, - 255, - true - ); - - $table->data['inputs'][4] = html_print_div( - [ - 'class' => 'action-buttons', - 'content' => html_print_submit_button( - __('Execute'), - 'submit', - false, - [ - 'icon' => 'cog', - 'mode' => 'mini', - ], - true - ), + 'icon' => 'cog', + 'mode' => 'mini', + 'class' => 'float-right mrgn_right_10px', ], true ); @@ -716,7 +742,7 @@ class ExternalTools extends HTML */ private function performExecution(string $command='', string $caption='') { - $output = ''; + $output = '
'; try { // If caption is not added, don't show anything. @@ -736,7 +762,7 @@ class ExternalTools extends HTML $output .= __('Command not response'); } - $output .= ''; + $output .= '
'; if ($resultCode !== 0) { throw new Exception( @@ -774,6 +800,8 @@ class ExternalTools extends HTML { $output = ''; + echo '
'; + if (validate_address($ip) === false) { $output .= ui_print_error_message( __('The ip or dns name entered cannot be resolved'), @@ -938,6 +966,7 @@ class ExternalTools extends HTML } } + echo '
'; return $output; } diff --git a/pandora_console/include/javascript/jquery.pandora.controls.js b/pandora_console/include/javascript/jquery.pandora.controls.js index bbb33af07d..92cd39c3ff 100644 --- a/pandora_console/include/javascript/jquery.pandora.controls.js +++ b/pandora_console/include/javascript/jquery.pandora.controls.js @@ -296,7 +296,7 @@ $.extend({ pandoraSelectGroupIcon: new (function() { this.defaults = { - alertSelect: "select#id_group", + alertSelect: "select#grupo", spanPreview: "#group_preview", debug: false }; @@ -315,25 +315,26 @@ $(this).change(function() { var id_group = this.value; + let href = $("a", config.spanPreview).attr("href"); + let hrefPosition = href.search("group_id="); + let hrefNew = href.slice(0, hrefPosition) + "group_id=" + id_group; - $(config.spanPreview).fadeOut("fast", function() { - $("img", config.spanPreview).remove(); - jQuery.post( - "ajax.php", - { - page: "godmode/groups/group_list", - get_group_json: 1, - id_group: id_group - }, - function(data) { - var img = $("").attr("src", "images/" + data["icon"]); - $(config.spanPreview) - .append(img) - .fadeIn("fast"); - }, - "json" - ); - }); + jQuery.post( + "ajax.php", + { + page: "godmode/groups/group_list", + get_group_json: 1, + id_group: id_group + }, + function(data) { + $("img", config.spanPreview).attr( + "src", + "images/" + data["icon"] + ); + $("a", config.spanPreview).attr("href", hrefNew); + }, + "json" + ); }); }); }; diff --git a/pandora_console/include/styles/dashboards.css b/pandora_console/include/styles/dashboards.css index 501cfe40da..3ac49172d4 100644 --- a/pandora_console/include/styles/dashboards.css +++ b/pandora_console/include/styles/dashboards.css @@ -843,3 +843,11 @@ div.widget-mrgn-0px > div.parent_graph { div.widget-mrgn-0px > div.parent_graph > div[id^="graph_"] { width: calc(100% + 14px) !important; } + +div.content-widget + > div.container-center + > div.centered.w90p + > div#container_show_stats + > canvas { + height: 310px; +} diff --git a/pandora_console/operation/agentes/interface_view.functions.php b/pandora_console/operation/agentes/interface_view.functions.php index 591346c526..27e4e0a3e9 100644 --- a/pandora_console/operation/agentes/interface_view.functions.php +++ b/pandora_console/operation/agentes/interface_view.functions.php @@ -146,35 +146,35 @@ function print_filters($sec) $filters .= ''; } else { - $table->style[0] = 'font-weight: bold;'; - - $table->data[0][0] = ''.__('Interfaces').''; - $table->data[0][1] = html_print_select( - [], - 'selected_interfaces[]', - '', - '', - '', - 0, - true, - true, - true, - '', - false, - 'min-width: 180px; max-width: 200px;' + $table->data[0][0] = html_print_label_input_block( + __('Interfaces'), + html_print_select( + [], + 'selected_interfaces[]', + '', + '', + '', + 0, + true, + true, + true, + '', + false, + 'min-width: 200px; max-width: 250px; min-height: 70px;' + ) ); $filters = '
'; $filters .= html_print_table($table, true); - $filters .= "
".html_print_submit_button( + $filters .= html_print_submit_button( __('Show'), 'uptbutton', false, - 'class="sub search mgn_tp_0"', + ['class' => 'float-right mini'], true - ).'
'; + ); $filters .= '
'; }