Merge branch 'develop' into ent-12137-propuesta-de-refactoring-visual-de-vista-ppal-de-agente

This commit is contained in:
miguel angel rasteu 2023-11-27 13:06:51 +01:00
commit e967b5820a
12 changed files with 119 additions and 25 deletions

View File

@ -217,6 +217,7 @@ foreach ($fields as $field) {
array_push($table->data, $data);
}
$tablePagination = '';
if ($fields) {
html_print_table($table);
$tablePagination = ui_pagination($count_fields, false, $offset, 0, true, 'offset', false);
@ -231,6 +232,9 @@ html_print_action_buttons(
[ 'icon' => 'next' ],
true
),
['type' => 'form_action']
[
'type' => 'form_action',
'right_content' => $tablePagination,
],
);
echo '</form>';

View File

@ -1240,7 +1240,7 @@ if ($step == 2) {
'priority',
$priority,
'',
0,
'',
0,
true,
false,

View File

@ -535,16 +535,47 @@ html_print_action_buttons(
__('Update'),
'update_button',
false,
[ 'icon' => 'update' ],
[
'icon' => 'update',
'onclick' => 'onFormSubmit()',
],
true
)
);
echo '</form>';
echo ui_print_warning_message(
[
'message' => __('Session timeout must be a number'),
'force_class' => 'invisible js_warning_msg',
],
'',
true
);
?>
<script type="text/javascript">
function onFormSubmit() {
const isNumber = n => $.isNumeric(n);
let session_timeout = $('#text-session_timeout').val()
if(isNumber(session_timeout)) {
if (session_timeout < 0) {
session_timeout = -1;
}
if (session_timeout > 604800) {
session_timeout = 604800;
}
$('#text-session_timeout').val(session_timeout);
} else {
$('.js_warning_msg').removeClass('invisible');
event.preventDefault();
return false;
}
}
function showAndHide() {
if ($('input[type=checkbox][name=double_auth_enabled]:checked').val() == 1) {
$('#table1-2FA_all_users').removeClass('invisible');

View File

@ -327,7 +327,7 @@ $passwordManageTable->data = [];
$passwordManageTable->data['captions_newpassword'][0] = __('New password');
$passwordManageTable->rowclass['fields_newpassword'] = 'w540px';
$passwordManageTable->data['fields_newpassword'][0] = html_print_input_text_extended(
$passwordManageTable->data['fields_newpassword'][0] = '<div class="relative container-div-input-password ">'.html_print_input_text_extended(
'password_new',
'',
'password_new',
@ -337,16 +337,17 @@ $passwordManageTable->data['fields_newpassword'][0] = html_print_input_text_exte
$view_mode,
'',
[
'class' => 'input w100p',
'class' => 'input',
'placeholder' => __('Password'),
'style' => 'width: 540px',
],
true,
true
);
).'</div>';
$passwordManageTable->data['captions_repeatpassword'][0] = __('Repeat new password');
$passwordManageTable->rowclass['fields_repeatpassword'] = 'w540px';
$passwordManageTable->data['fields_repeatpassword'][0] = html_print_input_text_extended(
$passwordManageTable->data['fields_repeatpassword'][0] = '<div class="relative container-div-input-password ">'.html_print_input_text_extended(
'password_confirm',
'',
'password_conf',
@ -358,10 +359,11 @@ $passwordManageTable->data['fields_repeatpassword'][0] = html_print_input_text_e
[
'class' => 'input w100p',
'placeholder' => __('Password confirmation'),
'style' => 'width: 540px',
],
true,
true
);
).'</div>';
if ($new_user === false && users_is_admin() === false) {
$passwordManageTable->data['captions_currentpassword'][0] = __('Current password');

View File

@ -829,7 +829,35 @@ class AgentWizard extends HTML
];
}
$create_modules_button = '';
if ($this->actionType === 'snmp' && $this->version !== null && $this->message['type'][0] !== 'error') {
$create_modules_button = html_print_submit_button(
__('Create modules'),
'create-modules-action',
false,
[
'icon' => 'next',
'onclick' => 'processListModules()',
],
true
);
} else if ($this->actionType === 'wmi' && $this->protocol === 'wmi' && $this->message['type'][0] !== 'error') {
$create_modules_button = html_print_submit_button(
__('Create modules'),
'create-modules-action',
false,
[
'icon' => 'next',
'onclick' => 'processListModules()',
],
true
);
} else {
$create_modules_button = '';
}
html_print_action_buttons(
[
html_print_submit_button(
$this->actionLabel,
'sub-protocol',
@ -839,7 +867,9 @@ class AgentWizard extends HTML
'onclick' => '$("#form-main-wizard").submit();',
],
true
)
),
$create_modules_button,
]
);
// Prints main form.
@ -3765,7 +3795,10 @@ class AgentWizard extends HTML
'label' => __('Create modules'),
'name' => 'create-modules-action',
'type' => 'button',
'attributes' => [ 'icon' => 'next' ],
'attributes' => [
'icon' => 'next',
'style' => 'display: none;',
],
'script' => 'processListModules();',
'return' => true,
],

View File

@ -142,7 +142,6 @@ function notifications_get_subtypes(?string $source=null)
'NOTIF.PANDORADB.HISTORICAL',
'NOTIF.HISTORYDB.MR',
'NOTIF.EXT.ELASTICSEARCH',
'NOTIF.EXT.LOGSTASH',
'NOTIF.METACONSOLE.DB_CONNECTION',
'NOTIF.DOWNTIME',
'NOTIF.UPDATEMANAGER.REGISTRATION',

View File

@ -45,6 +45,7 @@ if (file_exists('../languages/'.$user_language.'.mo') === true) {
$type = (string) get_parameter('type', 'csv');
$data = (string) get_parameter('data');
$data = strip_tags(io_safe_output($data));
$data = json_decode(io_safe_output($data), true);
$default_filename = 'data_exported - '.date($config['date_format']);

View File

@ -1739,3 +1739,8 @@ function loadModal() {
}
}
window.onload = loadModal;
function openEvents(severity) {
$('input[name="filter[severity]"]').val(severity);
$("#event_redirect").submit();
}

View File

@ -327,8 +327,13 @@ class EventCardboard extends Widget
$return_all_group = true;
}
$help_tip = ui_print_help_tip(
__('Only the first group selected will be used on the redirect to events view.'),
true
);
$inputs['inputs']['row1'][] = [
'label' => __('Groups'),
'label' => __('Groups').$help_tip,
'arguments' => [
'type' => 'select_groups',
'name' => 'groupId[]',
@ -526,6 +531,16 @@ class EventCardboard extends Widget
);
}
$output .= '<form style="display: none" action="'.ui_get_full_url('index.php?sec=eventos&sec2=operation/events/events').'" method="POST" id="event_redirect">';
$output .= html_print_input_hidden('filter[event_type]', $this->values['eventType'], true, false, false, 'filter[event_type]');
$output .= html_print_input_hidden('filter[event_view_hr]', $this->values['maxHours'], true, false, false, 'filter[event_view_hr]');
$output .= html_print_input_hidden('filter[status]', $this->values['eventStatus'], true, false, false, 'filter[status]');
$output .= html_print_input_hidden('filter[id_group_filter]', $this->values['groupId'][0], true, false, false, 'filter[id_group_filter]');
$output .= html_print_input_hidden('filter[severity]', '', true, false, false, 'filter[severity]');
$output .= html_print_input_hidden('get_events', '1', true, false, false, 'get_events');
$output .= html_print_input_hidden('filter[tag_with]', 'WyIwIl0=', true, false, false, 'filter[tag_with]');
$output .= html_print_input_hidden('filter[tag_without]', 'WyIwIl0=', true, false, false, 'filter[tag_without]');
$output .= '</form>';
$output .= '<table class="w100p h100p table-border-0 event-cardboard-widget"><tbody><tr>';
$width_td = (100 / count(explode(',', $severity)));
@ -539,7 +554,8 @@ class EventCardboard extends Widget
}
}
switch ((int) $key) {
$severity_row = (int) $key;
switch ($severity_row) {
case 0:
$text = __('Maintenance');
$color = get_priority_class((int) $key);
@ -600,7 +616,7 @@ class EventCardboard extends Widget
$border = ' border-right: 1px solid white; border-collapse: collapse;';
}
$output .= '<td class="'.$color.'" style="width: '.$width_td.'%;'.$border.'"><span class="med_data">';
$output .= '<td class="'.$color.'" style="width: '.$width_td.'%;'.$border.'" onclick="openEvents('.$severity_row.')"><span class="med_data">';
$output .= $count;
$output .= '</span><br>';
$output .= $text;

View File

@ -966,3 +966,7 @@ input.resize_button {
.parent_graph > .graph {
margin-left: 10px;
}
.event-cardboard-widget td {
cursor: pointer;
}

View File

@ -11809,16 +11809,14 @@ p.trademark-copyright {
}
.show-hide-pass {
position: absolute;
right: 9px;
top: 4px;
position: fixed;
border: 0;
outline: none;
margin: 0;
margin-left: -50px;
height: 30px;
width: 40px;
cursor: pointer;
display: inline-block;
display: initial;
}
.show-hide-pass-background {

View File

@ -72,6 +72,7 @@ if ($searchAgents) {
$has_secondary = enterprise_hook('agents_is_using_secondary_groups');
$stringSearchSQL = str_replace('&amp;', '&', $stringSearchSQL);
$stringSearchSQL = str_replace('&#92;', '\\', $stringSearchSQL);
$sql = "SELECT DISTINCT taddress_agent.id_agent FROM taddress
INNER JOIN taddress_agent ON
taddress.id_a = taddress_agent.id_a