cps changes - switch core touched - test this commit carefully

This commit is contained in:
fbsanchez 2019-05-27 14:12:53 +02:00
parent 7347324601
commit 9eecc414dd
6 changed files with 30 additions and 21 deletions

View File

@ -396,7 +396,7 @@ if (enterprise_installed()) {
// CSS classnames (default)
false,
// Not disabled (default)
'width:50%; min-width:170px; text-align:center',
'width:50%; min-width:170px;',
// Inline styles (default)
false,
// Option style select (default)
@ -457,7 +457,7 @@ if (enterprise_installed()) {
// Class
false,
// Disabled
'width:50%; min-width:170px; text-align:center'
'width:50%; min-width:170px;'
// Style
);
@ -510,21 +510,27 @@ if (enterprise_installed()) {
$table_adv_remote .= '</div>';
$cps_array[-1] = __('Disabled');
if ($cps > 0) {
$cps_array[$cps] = __('Enabled');
} else {
$cps_inc = 0;
if ($id_agente) {
$cps_inc = service_agents_cps($id_agente);
}
$cps_array[$cps_inc] = __('Enabled');
// Calculate cps value - agents.
if ($id_agente) {
$cps_val = service_agents_cps($id_agente);
} else {
// No agent defined, use received cps as base value.
if ($cps >= 0) {
$cps_val = $cps;
}
}
$table_adv_cascade = '<div class="label_select"><p class="input_label">'.__('Cascade protection services').': ';
$table_adv_cascade .= ui_print_help_tip(__('Disable the alerts and events of the elements that belong to this service'), true).'</p>';
$table_adv_cascade .= html_print_select($cps_array, 'cps', $cps, '', '', 0, true).'</div>';
$cps_html = '<div class="label_select"><div class="label_simple_items">';
$cps_html .= html_print_checkbox_switch('cps', $cps_val, ($cps >= 0), true);
$cps_html .= __('Cascade protection services').'&nbsp;'.ui_print_help_icon('cascade_protection', true);
$cps_html .= ui_print_help_tip(
__('Alerts and events will be managed by the service joined by this agent.'),
true
);
$cps_html .= '</div></div>';
$table_adv_cascade .= $cps_html;
}
// Custom ID

View File

@ -194,7 +194,7 @@ if ($create_agent) {
$update_gis_data = (int) get_parameter_post('update_gis_data', 0);
$url_description = (string) get_parameter('url_description');
$quiet = (int) get_parameter('quiet', 0);
$cps = (int) get_parameter('cps', 0);
$cps = (int) get_parameter_switch('cps', -1);
$secondary_groups = (string) get_parameter('secondary_hidden', '');
$fields = db_get_all_fields_in_table('tagent_custom_fields');
@ -829,8 +829,7 @@ if ($update_agent) {
$update_gis_data = (int) get_parameter_post('update_gis_data', 0);
$url_description = (string) get_parameter('url_description');
$quiet = (int) get_parameter('quiet', 0);
$cps = (int) get_parameter('cps', 0);
$cps = get_parameter_switch('cps', -1);
$old_values = db_get_row('tagente', 'id_agente', $id_agente);
$fields = db_get_all_fields_in_table('tagent_custom_fields');

View File

@ -871,12 +871,13 @@ function get_parameter_switch($name, $default='')
$data = get_parameter($name, null);
if ($data === null) {
return 0;
return (isset($default) ? $default : 0);
} else if ($data == 'on') {
return 1;
}
return 0;
// Return value assigned to switch.
return $data;
}

View File

@ -1226,7 +1226,7 @@ function paint_qrcode(text, where, width, height) {
text: text,
width: width,
height: height,
colorDark: "#3B6941",
colorDark: "#343434",
colorLight: "#ffffff",
correctLevel: QRCode.CorrectLevel.M
});

View File

@ -5588,7 +5588,9 @@ table.info_table.policy_sub_table {
background-color: transparent !important;
border: none;
border-radius: 0 !important;
border-bottom: 1px solid #343434;
border-bottom: 1px solid #888;
font-family: "lato-bolder", "Open Sans", sans-serif !important;
font-size: 10pt;
padding: 2px 5px;
box-sizing: border-box;
background-repeat: no-repeat;

View File

@ -1435,6 +1435,7 @@ switch ($tab) {
break;
case 'main':
default:
include 'estado_generalagente.php';
echo "<a name='monitors'></a>";
include 'estado_monitores.php';