#8365 Added csv report for device lists.

Fixed overlay for modals
This commit is contained in:
Jorge Rincon 2023-11-03 14:25:44 +01:00
parent 1b9d7779d6
commit 513a0bc296
7 changed files with 96 additions and 44 deletions

View File

@ -1036,7 +1036,8 @@ switch ($action) {
break;
case 'ncm':
$idAgent = $item['id_agent'];
$id_agent_ncm = $item['id_agent'];
$ncm_group = $item['id_group'];
break;
case 'ncm_backups':
@ -7835,7 +7836,8 @@ function chooseType() {
break;
case 'ncm':
$("#row_agent").show();
$("#row_ncm_group").show();
$("#row_ncm_agent").show();
break;
case 'ncm_backups':

View File

@ -2051,6 +2051,12 @@ switch ($action) {
$good_format = true;
break;
case 'ncm':
$values['id_agent'] = get_parameter('agent_ncm');
$values['id_group'] = get_parameter('ncm_group');
$good_format = true;
break;
default:
$values['period'] = get_parameter('period');
$values['top_n'] = get_parameter(
@ -2995,6 +3001,12 @@ switch ($action) {
$good_format = true;
break;
case 'ncm':
$values['id_agent'] = get_parameter('agent_ncm');
$values['id_group'] = get_parameter('ncm_group');
$good_format = true;
break;
default:
$values['period'] = get_parameter('period');
$values['top_n'] = get_parameter(

View File

@ -965,7 +965,7 @@ function reporting_make_reporting_data(
break;
case 'ncm':
$report['contents'][] = reporting_ncm_config(
$report['contents'][] = reporting_ncm_list(
$report,
$content,
$pdf

View File

@ -477,7 +477,7 @@ function reporting_html_print_report($report, $mini=false, $report_info=1, $cust
break;
case 'ncm':
reporting_html_ncm_config($table, $item);
reporting_html_ncm_list($table, $item);
break;
case 'ncm_backups':
@ -7347,41 +7347,76 @@ function reporting_html_permissions($table, $item, $pdf=0)
/**
* HTML content for ncm configuration diff report.
* HTML content for ncm devices list.
*
* @param array $item Content generated by reporting_ncm_config.
* @param array $item Content generated by reporting_ncm_list.
*
* @return string HTML code.
*/
function reporting_html_ncm_config($table, $item, $pdf=0)
function reporting_html_ncm_list($table, $item, $pdf=0)
{
$key = uniqid();
// Create table diff.
$table_ncm = new stdClass();
$table_ncm->width = '100%';
$table_ncm->class = 'info_table';
$table_ncm->styleTable = 'table-layout: fixed;';
$table_ncm->titleclass = 'title_table_pdf';
$table_ncm->align = [];
$table_ncm->align['name'] = 'left';
$table_ncm->align['ip'] = 'left';
$table_ncm->align['vendor'] = 'left';
$table_ncm->align['model'] = 'left';
$table_ncm->align['firmware'] = 'left';
$table_ncm->align['last_backup_date'] = 'left';
$table_ncm->headstyle['name'] = 'text-align: left';
$table_ncm->headstyle['ip'] = 'text-align: left';
$table_ncm->headstyle['vendor'] = 'text-align: left';
$table_ncm->headstyle['model'] = 'text-align: left';
$table_ncm->headstyle['firmware'] = 'text-align: left';
$table_ncm->headstyle['last_backup_date'] = 'text-align: left';
$table_ncm->head = [];
$table_ncm->head['name'] = __('Name');
$table_ncm->head['ip'] = __('Ip');
$table_ncm->head['vendor'] = __('Vendor');
$table_ncm->head['model'] = __('Model');
$table_ncm->head['firmware'] = __('Firmware');
$table_ncm->head['last_backup_date'] = __('Last backup date');
$table_ncm->data = [];
foreach ($item['data'] as $key => $row) {
$title = $row['last_error'];
if (empty($title) === true) {
$title = null;
}
$table_ncm->data[] = [
$row['alias'],
$row['direccion'],
$row['vendor'],
$row['model'],
$row['firmware'],
$row['last_backup_date'],
];
}
if ($pdf === 0) {
ui_require_javascript_file('diff2html-ui.min');
ui_require_css_file('diff2html.min');
$script = "$(document).ready(function() {
const configuration = {
drawFileList: false,
collapsed: true,
matching: 'lines',
outputFormat: 'side-by-side',
};
const diff2htmlUi = new Diff2HtmlUI(
document.getElementById('".$key."'),
atob('".base64_encode($item['data'])."'),
configuration
);
diff2htmlUi.draw();
});";
$content = '<div class="w100p" id="'.$key.'"></div class="w100p">';
$content .= '<script>'.$script.'</script>';
$table->data[1] = $content;
$table->colspan[1][0] = 2;
$table->colspan['data']['cell'] = 3;
$table->cellstyle['data']['cell'] = 'text-align: left;';
$table->data['data']['cell'] = html_print_table(
$table_ncm,
true
);
} else {
$content = '<div style="text-align:left;margin-left: 14px;">';
$content .= str_replace("\n", '<br>', $item['data']);
$content .= '</div>';
return $content;
$table_ncm->titleclass = 'title_table_pdf';
$table_ncm->titlestyle = 'text-align:left;';
return html_print_table(
$table_ncm,
true
);
}
}

View File

@ -963,14 +963,14 @@ function reports_get_report_types($template=false, $not_editor=false)
];
}
$types['ncm'] = [
'optgroup' => __('NCM'),
'name' => __('Network configuration changes'),
];
$types['ncm_backups'] = [
'optgroup' => __('NCM'),
'name' => __('Network backups'),
'name' => __('NCM configuration changes'),
];
$types['ncm'] = [
'optgroup' => __('NCM'),
'name' => __('NCM devices list'),
];
if (enterprise_installed() === true) {

View File

@ -104,11 +104,8 @@ function load_modal(settings) {
width = settings.onshow.width;
}
if (settings.modal.overlay == undefined) {
settings.modal.overlay = {
opacity: 0.5,
background: "black"
};
if (settings.modal.overlay === true) {
$("body").append("<div id='modal_overlay'class='ui-widget-overlay'></div>");
}
if (settings.beforeClose == undefined) {
@ -496,7 +493,6 @@ function load_modal(settings) {
settings.onshow.maxHeight != undefined
? settings.onshow.maxHeight
: "auto",
overlay: settings.modal.overlay,
position: {
my: "top+20%",
at: "top",
@ -518,6 +514,7 @@ function load_modal(settings) {
if (settings.cleanup != undefined) {
settings.cleanup();
}
$("#modal_overlay").removeClass("ui-widget-overlay");
},
beforeClose: settings.beforeClose()
});

View File

@ -371,3 +371,9 @@ input[type="submit"].ui-button-dialog {
.ui_tpicker_time {
margin-left: 10px !important;
}
.ui-widget-overlay {
background: #aaa !important;
opacity: 0.3 !important;
z-index: 1114;
}