Dashboards widgets

This commit is contained in:
Pablo Aragon 2023-03-15 15:58:28 +01:00
parent 00a5e8e84b
commit bed1e34fd2
5 changed files with 152 additions and 117 deletions

View File

@ -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] .= '<span id="group_preview">';
$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] .= '</span>';
$tableAgent->data['caption_interval'][0] = __('Interval');
// $tableAgent->rowstyle['interval'] = 'width: 260px';

View File

@ -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 = '<div class="white_box max_floating_element_size no_border">';
try {
// If caption is not added, don't show anything.
@ -736,7 +762,7 @@ class ExternalTools extends HTML
$output .= __('Command not response');
}
$output .= '</pre>';
$output .= '</pre></div>';
if ($resultCode !== 0) {
throw new Exception(
@ -774,6 +800,8 @@ class ExternalTools extends HTML
{
$output = '';
echo '<div class="white_box max_floating_element_size no_border pdd_15px">';
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 '</div>';
return $output;
}

View File

@ -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 = $("<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"
);
});
});
};

View File

@ -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;
}

View File

@ -146,35 +146,35 @@ function print_filters($sec)
$filters .= '</form>';
} else {
$table->style[0] = 'font-weight: bold;';
$table->data[0][0] = '<b>'.__('Interfaces').'</b>';
$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 = '<form method="post" action="'.ui_get_url_refresh().'">';
$filters .= html_print_table($table, true);
$filters .= "<div class='height_100p right'>".html_print_submit_button(
$filters .= html_print_submit_button(
__('Show'),
'uptbutton',
false,
'class="sub search mgn_tp_0"',
['class' => 'float-right mini'],
true
).'</div>';
);
$filters .= '</form>';
}