minor fixes

This commit is contained in:
fbsanchez 2019-06-18 15:03:49 +02:00
parent 22272225b8
commit a1f004fdec
3 changed files with 43 additions and 15 deletions

View File

@ -523,7 +523,10 @@ function events_get_all(
throw new Exception('[events_get_all] Fields must be an array or "count".'); throw new Exception('[events_get_all] Fields must be an array or "count".');
} }
if (isset($filter['date_from']) && $filter['date_from'] != '0000-00-00') { if (isset($filter['date_from'])
&& !empty($filter['date_from'])
&& $filter['date_from'] != '0000-00-00'
) {
$date_from = $filter['date_from']; $date_from = $filter['date_from'];
} }
@ -543,7 +546,10 @@ function events_get_all(
); );
} }
if (isset($filter['date_to']) && $filter['date_to'] != '0000-00-00') { if (isset($filter['date_to'])
&& !empty($filter['date_to'])
&& $filter['date_to'] != '0000-00-00'
) {
$date_to = $filter['date_to']; $date_to = $filter['date_to'];
} }

View File

@ -718,17 +718,38 @@ function update_event(table, id_evento, type, row) {
} }
function validate_event(table, id_evento, row) { function validate_event(table, id_evento, row) {
row.firstChild.src = "http://localhost/pandora_console/images/spinner.gif"; var button = document.getElementById("val-" + id_evento);
if (!button) {
// Button does not exist. Ignore.
return;
}
button.children[0];
button.children[0].src = "images/spinner.gif";
return update_event(table, id_evento, { validate_event: 1 }, row); return update_event(table, id_evento, { validate_event: 1 }, row);
} }
function in_process_event(table, id_evento, row) { function in_process_event(table, id_evento, row) {
row.firstChild.src = "http://localhost/pandora_console/images/spinner.gif"; var button = document.getElementById("proc-" + id_evento);
if (!button) {
// Button does not exist. Ignore.
return;
}
button.children[0];
button.children[0].src = "images/spinner.gif";
return update_event(table, id_evento, { in_process_event: 1 }, row); return update_event(table, id_evento, { in_process_event: 1 }, row);
} }
function delete_event(table, id_evento, row) { function delete_event(table, id_evento, row) {
row.firstChild.src = "http://localhost/pandora_console/images/spinner.gif"; var button = document.getElementById("del-" + id_evento);
if (!button) {
// Button does not exist. Ignore.
return;
}
button.children[0];
button.children[0].src = "images/spinner.gif";
return update_event(table, id_evento, { delete_event: 1 }, row); return update_event(table, id_evento, { delete_event: 1 }, row);
} }

View File

@ -1455,8 +1455,6 @@ function process_datatables_item(item) {
evn += output; evn += output;
evn += '</div>' evn += '</div>'
// Add event severity format to itself.
item.evento = evn;
item.criticity = '<div class="criticity" style="background: '; item.criticity = '<div class="criticity" style="background: ';
item.criticity += color + '">' + text + "</div>"; item.criticity += color + '">' + text + "</div>";
@ -1546,8 +1544,8 @@ function process_datatables_item(item) {
/* Options */ /* Options */
// Show more. // Show more.
item.options = '<a href="javascript:" onclick="show_event_dialog('; item.options = '<a href="javascript:" onclick="show_event_dialog(\'';
item.options += item.id_evento+','+$("#group_rep").val(); item.options += btoa(JSON.stringify(item))+'\','+$("#group_rep").val();
item.options += ')" ><?php echo html_print_image('images/eye.png', true, ['title' => __('Show more')]); ?></a>'; item.options += ')" ><?php echo html_print_image('images/eye.png', true, ['title' => __('Show more')]); ?></a>';
<?php <?php
@ -1559,10 +1557,10 @@ function process_datatables_item(item) {
// Validate. // Validate.
item.options += '<a href="javascript:" onclick="validate_event(dt_<?php echo $table_id; ?>,'; item.options += '<a href="javascript:" onclick="validate_event(dt_<?php echo $table_id; ?>,';
if (item.max_id_evento) { if (item.max_id_evento) {
item.options += item.max_id_evento+', this)" >'; item.options += item.max_id_evento+', this)" id="val-'+item.max_id_evento+'">';
item.options += '<?php echo html_print_image('images/tick.png', true, ['title' => __('Validate events')]); ?></a>'; item.options += '<?php echo html_print_image('images/tick.png', true, ['title' => __('Validate events')]); ?></a>';
} else { } else {
item.options += item.id_evento+', this)" >'; item.options += item.id_evento+', this)" id="val-'+item.id_evento+'">';
item.options += '<?php echo html_print_image('images/tick.png', true, ['title' => __('Validate event')]); ?></a>'; item.options += '<?php echo html_print_image('images/tick.png', true, ['title' => __('Validate event')]); ?></a>';
} }
} }
@ -1571,9 +1569,9 @@ function process_datatables_item(item) {
// In process. // In process.
item.options += '<a href="javascript:" onclick="in_process_event(dt_<?php echo $table_id; ?>,'; item.options += '<a href="javascript:" onclick="in_process_event(dt_<?php echo $table_id; ?>,';
if (item.max_id_evento) { if (item.max_id_evento) {
item.options += item.max_id_evento+', this)" >'; item.options += item.max_id_evento+', this)" id="proc-'+item.max_id_evento+'">';
} else { } else {
item.options += item.id_evento+', this)" >'; item.options += item.id_evento+', this)" id="proc-'+item.id_evento+'">';
} }
item.options += '<?php echo html_print_image('images/hourglass.png', true, ['title' => __('Change to in progress status')]); ?></a>'; item.options += '<?php echo html_print_image('images/hourglass.png', true, ['title' => __('Change to in progress status')]); ?></a>';
} }
@ -1583,10 +1581,10 @@ function process_datatables_item(item) {
// Delete. // Delete.
item.options += '<a href="javascript:" onclick="delete_event(dt_<?php echo $table_id; ?>,'; item.options += '<a href="javascript:" onclick="delete_event(dt_<?php echo $table_id; ?>,';
if (item.max_id_evento) { if (item.max_id_evento) {
item.options += item.max_id_evento+', this)" >'; item.options += item.max_id_evento+', this)" id="del-'+item.max_id_evento+'">';
item.options += '<?php echo html_print_image('images/cross.png', true, ['title' => __('Delete events')]); ?></a>'; item.options += '<?php echo html_print_image('images/cross.png', true, ['title' => __('Delete events')]); ?></a>';
} else { } else {
item.options += item.id_evento+', this)" >'; item.options += item.id_evento+', this)" id="del-'+item.id_evento+'">';
item.options += '<?php echo html_print_image('images/cross.png', true, ['title' => __('Delete event')]); ?></a>'; item.options += '<?php echo html_print_image('images/cross.png', true, ['title' => __('Delete event')]); ?></a>';
} }
} }
@ -1627,6 +1625,9 @@ function process_datatables_item(item) {
item.owner_user = '<?php echo __('System'); ?>'; item.owner_user = '<?php echo __('System'); ?>';
} }
// Add event severity format to itself.
item.evento = evn;
} }
/* Datatables auxiliary functions ends */ /* Datatables auxiliary functions ends */