Merge branch 'ent-9662-second-round' of brutus.artica.es:artica/pandorafms into ent-9662-second-round

This commit is contained in:
Jose Gonzalez 2023-03-16 16:33:22 +01:00
commit 1500edc06e
4 changed files with 60 additions and 52 deletions

View File

@ -458,6 +458,7 @@ if (file_exists(ENTERPRISE_DIR.'/load_enterprise.php')) {
'enterprise/images/custom_splash_login/'.$config['custom_splash_login'],
false,
[
'class' => 'splash-logo',
'alt' => 'splash',
'border' => 0,
],

View File

@ -1907,62 +1907,64 @@ if ($create_module) {
);
}
if (is_error($id_agent_module) === true) {
switch ($id_agent_module) {
case ERR_EXIST:
$msg = __('There was a problem adding module. Another module already exists with the same name.');
break;
if ($update_module || $create_module) {
if (is_error($id_agent_module) === true) {
switch ($id_agent_module) {
case ERR_EXIST:
$msg = __('There was a problem adding module. Another module already exists with the same name.');
break;
case ERR_INCOMPLETE:
$msg = __('There was a problem adding module. Some required fields are missed : (name)');
break;
case ERR_INCOMPLETE:
$msg = __('There was a problem adding module. Some required fields are missed : (name)');
break;
case ERR_DB:
case ERR_GENERIC:
default:
$msg = __('There was a problem adding module. Processing error');
break;
}
case ERR_DB:
case ERR_GENERIC:
default:
$msg = __('There was a problem adding module. Processing error');
break;
}
// I save the result of the action (insert or update).
$success_action = $id_agent_module;
// I save the result of the action (insert or update).
$success_action = $id_agent_module;
$id_agent_module = false;
ui_print_error_message($msg);
$edit_module = true;
$moduletype = $id_module;
db_pandora_audit(
AUDIT_LOG_AGENT_MANAGEMENT,
"Fail to try added module '".io_safe_output($name)."' for agent ".io_safe_output($agent['alias'])
);
} else {
if ($prediction_module === MODULE_PREDICTION_SYNTHETIC) {
enterprise_hook(
'modules_create_synthetic_operations',
[
$id_agent_module,
$serialize_ops,
]
$id_agent_module = false;
ui_print_error_message($msg);
$edit_module = true;
$moduletype = $id_module;
db_pandora_audit(
AUDIT_LOG_AGENT_MANAGEMENT,
"Fail to try added module '".io_safe_output($name)."' for agent ".io_safe_output($agent['alias'])
);
} else {
if ($prediction_module === MODULE_PREDICTION_SYNTHETIC) {
enterprise_hook(
'modules_create_synthetic_operations',
[
$id_agent_module,
$serialize_ops,
]
);
}
// Update the module interval.
cron_update_module_interval($id_agent_module, $cron_interval);
ui_print_success_message(__('Module added successfully'));
$id_agent_module = false;
$edit_module = false;
$info = '';
$agent = db_get_row('tagente', 'id_agente', $id_agente);
db_pandora_audit(
AUDIT_LOG_AGENT_MANAGEMENT,
"Added module '".db_escape_string_sql($name)."' for agent ".io_safe_output($agent['alias']),
false,
true,
io_json_mb_encode($values)
);
}
// Update the module interval.
cron_update_module_interval($id_agent_module, $cron_interval);
ui_print_success_message(__('Module added successfully'));
$id_agent_module = false;
$edit_module = false;
$info = '';
$agent = db_get_row('tagente', 'id_agente', $id_agente);
db_pandora_audit(
AUDIT_LOG_AGENT_MANAGEMENT,
"Added module '".db_escape_string_sql($name)."' for agent ".io_safe_output($agent['alias']),
false,
true,
io_json_mb_encode($values)
);
}
}

View File

@ -123,7 +123,7 @@ $table->data[1][0] = html_print_label_input_block(
'w100p',
false,
'width: 100%;'
).'<span id="advanced_action" class="advanced_actions invisible"><br>'.__('Number of alerts match from').' '.html_print_input_text('fires_min', '', '', 4, 10, true).' '.__('to').' '.html_print_input_text('fires_max', '', '', 4, 10, true).'</span>'.$create_action
).'<span id="advanced_action" class="advanced_actions invisible"><br>'.__('Number of alerts match from').' '.html_print_input_text('fires_min', '', '', 4, 10, true).' '.__('to').' '.html_print_input_text('fires_max', '', '', 4, 10, true).'</span><div class="flex_justify_end">'.$create_action.'</div>'
);
$own_info = get_user_info($config['id_user']);
@ -162,7 +162,7 @@ $table->data[1][1] = html_print_label_input_block(
'w100p',
false,
'width: 100%;'
).' <a class="template_details invisible" href="#">'.html_print_image('images/zoom.png', true, ['class' => 'img_help']).'</a>'.$create_template
).' <a class="template_details invisible" href="#">'.html_print_image('images/zoom.png', true, ['class' => 'img_help']).'</a><div class="flex_justify_end">'.$create_template.'</div>'
);
$table->data[2][0] = html_print_label_input_block(

View File

@ -8255,6 +8255,11 @@ div.graph div.legend table {
justify-content: center;
}
.flex_justify_end {
display: flex;
justify-content: end;
}
.span_priority {
width: 20px;
height: 10px;