#11206 Fix custom field view

This commit is contained in:
miguel angel rasteu 2023-08-21 15:11:13 +02:00
commit 817c3223be
15 changed files with 21104 additions and 76 deletions

View File

@ -24,6 +24,14 @@ if (! check_acl($config['id_user'], 0, 'AR')
ui_require_css_file('discovery');
ui_require_javascript_file('pandora_alerts');
ui_include_time_picker();
ui_require_jquery_file('ui.datepicker-'.get_user_language(), 'include/javascript/i18n/');
ui_require_javascript_file('tinymce', 'vendor/tinymce/tinymce/');
ui_require_css_file('main.min', 'include/javascript/fullcalendar/');
ui_require_javascript_file('main.min', 'include/javascript/fullcalendar/');
ui_require_javascript_file('pandora_fullcalendar');
/**
* Mask class names.
@ -204,3 +212,115 @@ if ($classname_selected === null) {
Wizard::printBigButtonsList($wiz_data);
}
$is_management_allowed = is_management_allowed();
$task_id = get_parameter('task', '');
if ($task_id !== '') {
$task = db_get_row_filter(
'tuser_task_scheduled',
['id' => $task_id]
);
$args = unserialize($task['args']);
$event_calendar = io_safe_output($args['weekly_schedule']);
} else {
$event_calendar = '{"monday":[{"start":"00:00:00","end":"00:00:00"}],"tuesday":[{"start":"00:00:00","end":"00:00:00"}],"wednesday":[{"start":"00:00:00","end":"00:00:00"}],"thursday":[{"start":"00:00:00","end":"00:00:00"}],"friday":[{"start":"00:00:00","end":"00:00:00"}],"saturday":[{"start":"00:00:00","end":"00:00:00"}],"sunday":[{"start":"00:00:00","end":"00:00:00"}]}';
}
?>
<script type="text/javascript">
$(document).ready (function () {
$("#table-new-job-3").hide();
var edit = '<?php echo $task_id; ?>';
if (edit != '') {
exec_calendar();
}
$("#scheduled").change(exec_calendar);
function exec_calendar() {
if ($("#scheduled").val() == "weekly") {
var is_management_allowed = parseInt('<?php echo (int) $is_management_allowed; ?>');
var eventsBBDD = '<?php echo $event_calendar; ?>';
var events = loadEventBBDD(eventsBBDD);
var calendarEl = document.getElementById('calendar_map');
var options = {
contentHeight: "auto",
headerToolbar: {
left: "",
center: "",
right: is_management_allowed === 0 ? '' : "timeGridWeek,dayGridWeek"
},
buttonText: {
dayGridWeek: '<?php echo __('Simple'); ?>',
timeGridWeek: '<?php echo __('Detailed'); ?>'
},
dayHeaderFormat: { weekday: "short" },
initialView: "dayGridWeek",
navLinks: false,
selectable: true,
selectMirror: true,
slotDuration: "01:00:00",
slotLabelInterval: "02:00:00",
snapDuration: "01:00:00",
slotMinTime: "00:00:00",
slotMaxTime: "24:00:00",
scrollTime: "01:00:00",
locale: "en-GB",
firstDay: 1,
eventTimeFormat: {
hour: "numeric",
minute: "2-digit",
hour12: false
},
eventColor: "#82b92e",
editable: is_management_allowed === 0 ? false : true,
dayMaxEvents: 3,
dayPopoverFormat: { weekday: "long" },
defaultAllDay: false,
displayEventTime: true,
displayEventEnd: true,
selectOverlap: false,
eventOverlap: false,
allDaySlot: true,
droppable: false,
select: is_management_allowed === 0 ? false : select_alert_template,
selectAllow: is_management_allowed === 0 ? false : selectAllow_alert_template,
eventAllow: is_management_allowed === 0 ? false : eventAllow_alert_template,
eventDrop: is_management_allowed === 0 ? false : eventDrop_alert_template,
eventDragStop: is_management_allowed === 0 ? false : eventDragStop_alert_template,
eventResize: is_management_allowed === 0 ? false : eventResize_alert_template,
eventMouseEnter: is_management_allowed === 0 ? false : eventMouseEnter_alert_template,
eventMouseLeave: is_management_allowed === 0 ? false : eventMouseLeave_alert_template,
eventClick: is_management_allowed === 0 ? false : eventClick_alert_template,
};
var settings = {
timeFormat: '<?php echo TIME_FORMAT_JS; ?>',
timeOnlyTitle: '<?php echo __('Choose time'); ?>',
timeText: '<?php echo __('Time'); ?>',
hourText: '<?php echo __('Hour'); ?>',
minuteText: '<?php echo __('Minute'); ?>',
secondText: '<?php echo __('Second'); ?>',
currentText: '<?php echo __('Now'); ?>',
closeText: '<?php echo __('Close'); ?>',
url: '<?php echo ui_get_full_url('ajax.php', false, false, false); ?>',
removeText: '<?php echo __('Remove'); ?>',
userLanguage: '<?php echo get_user_language(); ?>',
loadingText: '<?php echo __('Loading, this operation might take several minutes...'); ?>',
tooltipText: '<?php echo __('Drag out to remove'); ?>',
alert: '<?php echo __('Alert'); ?>'
}
var calendar = fullCalendarPandora(calendarEl, options, settings, events);
calendar.render();
$("#table-new-job-3").show();
$('.fc-event-title').hide();
$(".fc-button-active" ).trigger( "click" );
} else {
$("#calendar_map").html();
$("#table-new-job-3").hide();
}
}
});
</script>

View File

@ -682,7 +682,6 @@ if (check_login()) {
),
true
);
$table = new StdClass;
$table->id = 'save_filter_form';
$table->width = '100%';
@ -724,6 +723,7 @@ if (check_login()) {
);
$table->rowspan[0][2] = 2;
$table->data[0][2] = html_print_submit_button(
__('Create filter'),
'create_filter',
@ -788,7 +788,9 @@ if (check_login()) {
);
}
echo '<form method="post" action="index.php?sec=geventos&sec2=godmode/events/events&section=edit_filter&amp;pure='.$config['pure'].'">';
html_print_table($table);
echo '</form>';
return;
}

View File

@ -1444,6 +1444,7 @@ if ($add_comment === true) {
if ($change_status === true) {
$event_ids = get_parameter('event_ids');
$new_status = get_parameter('new_status');
$group_rep = (int) get_parameter('group_rep', 0);
$server_id = 0;
if (is_metaconsole() === true) {
$server_id = (int) get_parameter('server_id');
@ -1457,10 +1458,19 @@ if ($change_status === true) {
$node->connect();
}
$return = events_change_status(
explode(',', $event_ids),
$new_status
);
if ($group_rep !== 3) {
$return = events_change_status(
explode(',', $event_ids),
$new_status
);
} else {
// Update all elements with same extraid.
$return = events_update_status(
$event_ids,
(int) $new_status,
['group_rep' => $group_rep]
);
}
} catch (\Exception $e) {
// Unexistent agent.
if (is_metaconsole() === true

View File

@ -122,10 +122,11 @@ class Tree
public function setFilter($filter)
{
// There is not module filter in metaconsole.
if (is_metaconsole()) {
/*
if (is_metaconsole()) {
$filter['searchModule'] = '';
$filter['statusModule'] = self::TV_DEFAULT_AGENT_STATUS;
}
}*/
$this->filter = $filter;
}

View File

@ -477,7 +477,7 @@ function events_update_status($id_evento, $status, $filter=null)
{
global $config;
if (!$status) {
if (!$status && $status !== 0) {
return false;
}
@ -1762,11 +1762,9 @@ function events_get_all(
}
}
$string_metaconsole_connections = implode(',', $metaconsole_connections);
$explode_metaconsole_connections = explode(',', $string_metaconsole_connections);
$result_meta = Promise\wait(
parallelMap(
$explode_metaconsole_connections,
$metaconsole_connections,
function ($node_int) use ($sql, $history) {
try {
if (is_metaconsole() === true
@ -3540,11 +3538,15 @@ function events_page_responses($event)
);
if ($status_blocked === false) {
if (isset($event['server_id']) === false) {
$event['server_id'] = '0';
}
$data[2] = html_print_button(
__('Update'),
'status_button',
false,
'event_change_status("'.$event['similar_ids'].'",'.$event['server_id'].');',
'event_change_status("'.$event['similar_ids'].'",'.$event['server_id'].', '.$event['group_rep'].');',
[
'icon' => 'next',
'mode' => 'link',

20740
pandora_console/include/javascript/d3.v7.js vendored Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -322,7 +322,7 @@ function perform_response(response, response_id, index = "") {
}
// Change the status of an event to new, in process or validated.
function event_change_status(event_ids, server_id) {
function event_change_status(event_ids, server_id, group_rep) {
var new_status = $("#estado").val();
$("#button-status_button").attr("disabled", "disabled");
@ -334,7 +334,8 @@ function event_change_status(event_ids, server_id) {
change_status: 1,
event_ids: event_ids,
new_status: new_status,
server_id: server_id
server_id: server_id,
group_rep: group_rep
},
type: "POST",
url: getUrlAjax(),

View File

@ -340,6 +340,7 @@ class GroupsStatusWidget extends Widget
// Head agents.
$table->data[0][0] = '<span>';
$table->data[0][0] .= html_print_image(
'images/agent.png',
true,
@ -359,38 +360,70 @@ class GroupsStatusWidget extends Widget
$table->data[0][1] .= '</span>';
if ($stats['total_agents'] !== 0) {
if (is_metaconsole() === true) {
$agentdetail_url = $url.'&statusAgent=';
} else {
$agentdetail_url = $url.'&status=';
}
// Agent Critical.
$table->data[1][0] = $this->getCellCounter(
$agent_url = '';
$agent_url .= $agentdetail_url.'1';
$agent_data = '<a href="'.$agent_url.'">';
$agent_data .= $this->getCellCounter(
$stats['agent_critical'],
'',
'bg_ff5'
);
$agent_data .= '</a>';
$table->data[1][0] = $agent_data;
// Agent Warning.
$table->data[2][0] = $this->getCellCounter(
$agent_url = '';
$agent_url .= $agentdetail_url.'2';
$agent_data = '<a href="'.$agent_url.'">';
$agent_data .= $this->getCellCounter(
$stats['agent_warning'],
'',
'bg_ffd'
);
$agent_data .= '</a>';
$table->data[2][0] = $agent_data;
// Agent OK.
$table->data[3][0] = $this->getCellCounter(
$agent_url = '';
$agent_url .= $agentdetail_url.'0';
$agent_data = '<a href="'.$agent_url.'">';
$agent_data .= $this->getCellCounter(
$stats['agent_ok'],
'',
'bg_82B92E'
);
$agent_data .= '</a>';
$table->data[3][0] = $agent_data;
// Agent Unknown.
$table->data[1][1] = $this->getCellCounter(
$agent_url = '';
$agent_url .= $agentdetail_url.'3';
$agent_data = '<a href="'.$agent_url.'">';
$agent_data .= $this->getCellCounter(
$stats['agent_unknown'],
'#B2B2B2'
);
$agent_data .= '</a>';
$table->data[1][1] = $agent_data;
// Agent Not Init.
$table->data[2][1] = $this->getCellCounter(
$agent_url = '';
$agent_url .= $agentdetail_url.'5';
$agent_data = '<a href="'.$agent_url.'">';
$agent_data .= $this->getCellCounter(
$stats['agent_not_init'],
'#4a83f3'
);
$agent_data .= '</a>';
$table->data[2][1] = $agent_data;
$data .= html_print_table($table, true);
$data .= '</div>';
@ -436,38 +469,69 @@ class GroupsStatusWidget extends Widget
$table->data[0][1] .= '</b>';
$table->data[0][1] .= '</span>';
if (is_metaconsole() === true) {
$monitordetail_url = $url.'&statusModule=';
} else {
$monitordetail_url = 'index.php?sec=view&sec2=operation/agentes/status_monitor&refr=0&ag_group='.$this->values['groupId'].'&status=';
}
// Modules Critical.
$table->data[1][0] = $this->getCellCounter(
$module_url = '';
$module_url .= $monitordetail_url.'1';
$module_data = '<a href="'.$module_url.'">';
$module_data .= $this->getCellCounter(
$stats['monitor_critical'],
'',
'bg_ff5'
);
$module_data .= '</a>';
$table->data[1][0] = $module_data;
// Modules Warning.
$table->data[2][0] = $this->getCellCounter(
$module_url = '';
$module_url .= $monitordetail_url.'2';
$module_data = '<a href="'.$module_url.'">';
$module_data .= $this->getCellCounter(
$stats['monitor_warning'],
'',
'bg_ffd'
);
$module_data .= '</a>';
$table->data[2][0] = $module_data;
// Modules OK.
$table->data[3][0] = $this->getCellCounter(
$module_url = '';
$module_url .= $monitordetail_url.'0';
$module_data = '<a href="'.$module_url.'">';
$module_data .= $this->getCellCounter(
$stats['monitor_ok'],
'',
'bg_82B92E'
);
$module_data .= '</a>';
$table->data[3][0] = $module_data;
// Modules Unknown.
$table->data[1][1] = $this->getCellCounter(
$module_url = '';
$module_url .= $monitordetail_url.'3';
$module_data = '<a href="'.$module_url.'">';
$module_data .= $this->getCellCounter(
$stats['monitor_unknown'],
'#B2B2B2'
);
$module_data .= '</a>';
$table->data[1][1] = $module_data;
// Modules Not Init.
$table->data[2][1] = $this->getCellCounter(
$module_url = '';
$module_url .= $monitordetail_url.'5';
$module_data = '<a href="'.$module_url.'">';
$module_data .= $this->getCellCounter(
$stats['monitor_not_init'],
'#4a83f3'
);
$module_data .= '</a>';
$table->data[2][1] = $module_data;
$data .= html_print_table($table, true);
$data .= '</div>';

View File

@ -1822,10 +1822,7 @@ table.dataTable td {
.dataTables_wrapper .dataTables_length {
float: left;
}
.dataTables_wrapper .dataTables_filter {
float: right;
text-align: right;
}
.dataTables_wrapper .dataTables_filter input {
margin-left: 0.5em;
}
@ -1875,7 +1872,7 @@ table.dataTable td {
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled:hover,
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled:active {
cursor: default;
color: #666 !important;
color: #fff !important;
border: 1px solid transparent;
background: transparent;
box-shadow: none;

View File

@ -6711,7 +6711,7 @@ form#modal_form_feedback ul.wizard li > textarea {
/* Generic classes to reuse and facilitate the creation of custom themes */
.pandora_green_text {
color: #1d7873;
color: #82b92e;
}
.pandora_green_bg {
@ -10249,7 +10249,7 @@ select:focus {
}
.dataTables_length > label {
font-size: 0px;
color: #fff;
}
input[type="button"],
@ -12358,7 +12358,7 @@ tr[id^="network_component-plugin-snmp-fields-dynamicMacroRow-"] input {
width: 100% !important;
}
<<<<<<< head form.cfv_status_agent {
form.cfv_status_agent {
margin: 0 auto;
display: flex;
justify-content: space-around;
@ -12426,11 +12426,66 @@ div.agents_custom_fields #datatables_wrapper div.bottom {
width: 99%;
}
======= .label_agent_service > label {
/*Horizontal tree*/
.horizontal_tree-icon {
position: absolute;
background: #f4f4f4;
margin-top: 140px;
margin-left: 15px;
transform: rotate(-90deg);
}
.horizontal_tree-icon-sunburst {
position: absolute;
background: #f4f4f4;
margin-top: 40px;
/*margin-left: 15px;*/
transform: rotate(-90deg);
}
.tree-icon {
position: absolute;
background: #f4f4f4;
margin-top: 140px;
margin-left: 15px;
}
.label_agent_service > label {
margin-top: 15px;
}
>>>>>>>develop .animation-blink {
.custom_fields_view {
width: 30%;
float: left;
margin-left: 10px;
padding-right: 10px;
max-height: 890px;
overflow: auto;
background-color: #f9f9f9;
}
.agents_custom_fields {
width: 100%;
margin-bottom: 15px;
padding: 25px 5px;
}
div.agents_custom_fields #datatables_wrapper div.top,
div.agents_custom_fields #datatables_wrapper div.bottom {
background-color: #414141;
color: #ffffff;
border: none;
padding: 5px;
height: 38px;
width: 99%;
}
.label_agent_service > label {
margin-top: 15px;
}
.animation-blink {
-webkit-animation: glowing 1500ms infinite;
-moz-animation: glowing 1500ms infinite;
-o-animation: glowing 1500ms infinite;
@ -12543,3 +12598,23 @@ div.agents_custom_fields #datatables_wrapper div.bottom {
flex-wrap: nowrap;
justify-content: flex-start !important;
}
.dt-buttons {
width: auto;
position: fixed;
margin-left: 55px;
}
.title_tactical {
padding: 10px 0px 10px 0px;
text-align: center;
font-size: 12px;
line-height: 23px;
color: #000;
letter-spacing: 0.3pt;
font-family: "lato-bolder";
font-style: normal;
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;
font-weight: bold;
}

View File

@ -364,13 +364,12 @@ a.pandora_pagination.current:hover {
background-size: 22px;
background-position: 48px center;
background-repeat: no-repeat;
background-color: transparent;
background-color: #fff;
color: var(--primary-color);
font-size: 20px;
height: 38px;
/* height: 32px; */
width: 80px;
margin-left: 10px;
margin-left: 130px;
display: flex;
justify-content: space-between;
@ -893,3 +892,15 @@ td.w75p#rightcolumn {
#pending_alerts_paginate {
margin-bottom: 15px;
}
.dataTables_filter > label {
color: #fff;
}
.dataTables_wrapper .dataTables_filter {
float: left;
text-align: right;
margin-left: 65%;
padding-left: 0px;
margin-top: -5px;
}

View File

@ -1000,7 +1000,7 @@ function table_datatables(filters, indexed_descriptions, processing){
[ 1, "desc" ]
]
});
console.log(table);
$.ajax ({
url : "ajax.php",
data : {

View File

@ -157,6 +157,10 @@ try {
throw new Exception('Invalid filter. ['.$plain_filter.']');
}
if (key_exists('server_id', $filter) === true && is_array($filter['server_id']) === false) {
$filter['server_id'] = explode(',', $filter['server_id']);
}
$filter['csv_all'] = true;
$names = events_get_column_names($column_names);

View File

@ -291,47 +291,46 @@ if (is_metaconsole() === true) {
);
}
if (is_metaconsole() === false) {
// Module filter.
$module_status_arr = [];
$module_status_arr[-1] = __('All');
// Default.
$module_status_arr[AGENT_MODULE_STATUS_NORMAL] = __('Normal');
$module_status_arr[AGENT_MODULE_STATUS_WARNING] = __('Warning');
$module_status_arr[AGENT_MODULE_STATUS_CRITICAL_BAD] = __('Critical');
$module_status_arr[AGENT_MODULE_STATUS_UNKNOWN] = __('Unknown');
$module_status_arr[AGENT_MODULE_STATUS_NOT_INIT] = __('Not init');
$module_status_arr['fired'] = __('Fired alerts');
// if (is_metaconsole() === false) {
// Module filter.
$module_status_arr = [];
$module_status_arr[-1] = __('All');
// Default.
$module_status_arr[AGENT_MODULE_STATUS_NORMAL] = __('Normal');
$module_status_arr[AGENT_MODULE_STATUS_WARNING] = __('Warning');
$module_status_arr[AGENT_MODULE_STATUS_CRITICAL_BAD] = __('Critical');
$module_status_arr[AGENT_MODULE_STATUS_UNKNOWN] = __('Unknown');
$module_status_arr[AGENT_MODULE_STATUS_NOT_INIT] = __('Not init');
$module_status_arr['fired'] = __('Fired alerts');
$table->data['last_row'][] = html_print_label_input_block(
__('Search module'),
html_print_input_text('search_module', $search_module, '', 25, 30, true)
);
$table->data['last_row'][] = html_print_label_input_block(
__('Search module'),
html_print_input_text('search_module', $search_module, '', 25, 30, true)
);
$table->data['last_row'][] = html_print_label_input_block(
__('Show not init modules'),
html_print_checkbox_switch('show_not_init_modules', $show_not_init_modules, true, true)
);
$table->data['last_row'][] = html_print_label_input_block(
__('Module status'),
html_print_select(
$module_status_arr,
'status_module',
$status_module,
'',
'',
0,
true,
false,
false,
'',
false,
'width:100%'
)
);
}
$table->data['last_row'][] = html_print_label_input_block(
__('Show not init modules'),
html_print_checkbox_switch('show_not_init_modules', $show_not_init_modules, true, true)
);
$table->data['last_row'][] = html_print_label_input_block(
__('Module status'),
html_print_select(
$module_status_arr,
'status_module',
$status_module,
'',
'',
0,
true,
false,
false,
'',
false,
'width:100%'
)
);
// }
$form_html = '<form id="tree_search" method="post" action="index.php?sec=monitoring&sec2=operation/tree&refr=0&tab='.$tab.'&pure='.$config['pure'].'">';
$form_html .= html_print_table($table, true);
$form_html .= html_print_div(