Merge branch 'ent-9038-ocultar-opciones-en-la-busqueda-de-vista-de-modulos' into 'develop'

Ent 9038 ocultar opciones en la busqueda de vista de modulos

See merge request artica/pandorafms!4930
This commit is contained in:
Daniel Rodriguez 2022-06-07 09:12:51 +00:00
commit c433fcf3f0
2 changed files with 1077 additions and 1052 deletions

View File

@ -9021,3 +9021,29 @@ div#err_msg_centralised {
#reset-styles var { #reset-styles var {
font-style: italic; font-style: italic;
} }
.div-col {
width: 33%;
display: flex;
flex-direction: row;
align-items: center;
padding-top: 15px;
}
.div-span {
width: 25%;
}
.div-input {
width: 75%;
}
@media screen and (max-width: 1369px) {
.div-col {
width: 50%;
display: flex;
flex-direction: row;
align-items: center;
padding-top: 15px;
}
}

View File

@ -533,15 +533,6 @@ if (!$is_metaconsole) {
$table->data[0][5] = html_print_select($rows_select, 'modulegroup', $modulegroup, '', __($is_none), -1, true, false, true, '', false, 'width: 120px;'); $table->data[0][5] = html_print_select($rows_select, 'modulegroup', $modulegroup, '', __($is_none), -1, true, false, true, '', false, 'width: 120px;');
$table->rowspan[0][6] = 3;
$table->data[0][6] = html_print_submit_button(
__('Show'),
'uptbutton',
false,
'class="sub search mgn_tp_0"',
true
);
$table->data[1][0] = __('Module name'); $table->data[1][0] = __('Module name');
$table->data[1][1] = html_print_autocomplete_modules( $table->data[1][1] = html_print_autocomplete_modules(
'ag_modulename', 'ag_modulename',
@ -579,7 +570,12 @@ if (empty($tags)) {
); );
} }
$table2 = new StdClass();
$table2->width = '100%';
$table2->class = 'filters';
$table2->style = [];
$table2->style[0] = 'font-weight: bold;';
$table2->style[1] = 'font-weight: bold;';
$network_available = db_get_sql( $network_available = db_get_sql(
'SELECT count(*) 'SELECT count(*)
@ -647,9 +643,9 @@ if (enterprise_installed()) {
} }
$table->data[2][0] = '<span>'.__('Server type').'</span>'; $table2->data[0][0] = '<span>'.__('Server type').'</span>';
$table->data[2][1] = html_print_select($typemodules, 'moduletype', $moduletype, '', __($is_none), '', true, false, true, '', false, 'width: 150px;'); $table2->data[0][1] = html_print_select($typemodules, 'moduletype', $moduletype, '', __($is_none), '', true, false, true, '', false, 'width: 150px;');
$monitor_options = [ $monitor_options = [
0 => __('All'), 0 => __('All'),
@ -657,21 +653,18 @@ $monitor_options = [
2 => __('Only disabled'), 2 => __('Only disabled'),
]; ];
$table->data[2][2] = '<span>'.__('Show monitors...').'</span>'; $table2->data[0][2] = '<span>'.__('Show monitors...').'</span>';
$table->data[2][3] = html_print_select($monitor_options, 'module_option', $module_option, '', '', '', true, false, true, '', false, 'width: 150px;'); $table2->data[0][3] = html_print_select($monitor_options, 'module_option', $module_option, '', '', '', true, false, true, '', false, 'width: 150px;');
$min_hours_val = empty($min_hours_status) ? '' : (int) $min_hours_status; $min_hours_val = empty($min_hours_status) ? '' : (int) $min_hours_status;
$table->data[2][4] = '<span>'.__('Min. hours in current status').'</span>'; $table2->data[0][4] = '<span>'.__('Min. hours in current status').'</span>';
$table->data[2][5] = html_print_input_text('min_hours_status', $min_hours_val, '', 12, 20, true); $table2->data[0][5] = html_print_input_text('min_hours_status', $min_hours_val, '', 12, 20, true);
$table->data[3][0] = '<span id="datatypetittle"'; $table2->data[1][0] = '<span id="datatypetittle"';
$table2->data[1][0] .= '>'.__('Data type').'</span>';
$table->data[3][0] .= '>'.__('Data type').'</span>'; $table2->data[1][1] .= '<div id="datatypebox">';
$table->data[3][1] .= '<div id="datatypebox">';
switch ($moduletype) { switch ($moduletype) {
@ -744,37 +737,33 @@ switch ($moduletype) {
} }
$a = db_get_all_rows_sql($sql); $a = db_get_all_rows_sql($sql);
$table->data[3][1] .= '<select id="datatype" name="datatype" '; $table2->data[1][1] .= '<select id="datatype" name="datatype" style="height: 28px;" ';
$table->data[3][1] .= '>'; $table2->data[1][1] .= '>';
$table->data[3][1] .= '<option name="datatype" value="">'.__($is_none).'</option>'; $table2->data[1][1] .= '<option name="datatype" value="">'.__($is_none).'</option>';
foreach ($a as $valor) { foreach ($a as $valor) {
$table->data[3][1] .= '<option name="datatype" value="'.$valor['id_tipo'].'" '; $table2->data[1][1] .= '<option name="datatype" value="'.$valor['id_tipo'].'" ';
if ($valor['id_tipo'] == $datatype) { if ($valor['id_tipo'] == $datatype) {
$table->data[3][1] .= 'selected'; $table2->data[1][1] .= 'selected';
} }
$table->data[3][1] .= '>'.$valor['descripcion'].'</option>'; $table2->data[1][1] .= '>'.$valor['descripcion'].'</option>';
} }
$table->data[3][1] .= '</select>'; $table2->data[1][1] .= '</select>';
$table2->data[1][1] .= '</div>';
$check_not_condition = '';
$table->data[3][1] .= '</div>';
$check_not_condition = '';
if ($not_condition !== '') { if ($not_condition !== '') {
$check_not_condition = true; $check_not_condition = true;
} }
$table->data[4][0] .= __('Not condition').'&nbsp;'.ui_print_help_tip(__('If you check this option, those elements that do NOT meet any of the requirements will be shown'), true); $table2->data[1][2] .= __('Not condition').'&nbsp;'.ui_print_help_tip(__('If you check this option, those elements that do NOT meet any of the requirements will be shown'), true);
$table->data[4][1] = html_print_div( $table2->data[1][3] = html_print_div(
[ [
'class' => 'w120px mrgn_5px mrgn_lft_0px mrgn_right_0px', 'class' => 'w120px mrgn_5px mrgn_lft_0px mrgn_right_0px',
'content' => html_print_input( 'content' => html_print_input(
@ -790,37 +779,15 @@ $table->data[4][0] .= __('Not condition').'&nbsp;'.ui_print_help_tip(__('If you
), ),
], ],
true true
); );
$table_custom_fields = new stdClass(); $custom_fields = db_get_all_fields_in_table('tagent_custom_fields');
$table_custom_fields->class = 'filters'; if ($custom_fields === false) {
$table_custom_fields->width = '100%';
$table_custom_fields->style = [];
$table_custom_fields->style[0] = 'font-weight: bold;';
// Style is different in metaconsole.
if ($is_metaconsole === false) {
$table_custom_fields->style[0] = 'font-weight: bold; width: 150px;';
}
if ($is_metaconsole === true) {
$table_custom_fields->styleTable = 'margin-left:0px; margin-top:15px;';
$table_custom_fields->cellpadding = '0';
$table_custom_fields->cellspacing = '0';
}
$table_custom_fields->colspan = [];
$table_custom_fields->data = [];
$custom_fields = db_get_all_fields_in_table('tagent_custom_fields');
if ($custom_fields === false) {
$custom_fields = []; $custom_fields = [];
} }
foreach ($custom_fields as $custom_field) {
$row = [];
$row[0] = $custom_field['name'];
$div_custom_fields = '<div class="flex-row">';
foreach ($custom_fields as $custom_field) {
$custom_field_value = ''; $custom_field_value = '';
if (empty($ag_custom_fields) === false) { if (empty($ag_custom_fields) === false) {
$custom_field_value = $ag_custom_fields[$custom_field['id_field']]; $custom_field_value = $ag_custom_fields[$custom_field['id_field']];
@ -829,37 +796,38 @@ $table->data[4][0] .= __('Not condition').'&nbsp;'.ui_print_help_tip(__('If you
} }
} }
$row[1] = html_print_input_text('ag_custom_fields['.$custom_field['id_field'].']', $custom_field_value, '', 100, 300, true); $div_custom_fields .= '<div class="div-col">';
$table_custom_fields->data[] = $row; $div_custom_fields .= '<div class="div-span">';
} $div_custom_fields .= '<span >'.$custom_field['name'].'</span>';
$div_custom_fields .= '</div>';
$filters = '<form method="post" action="index.php?sec='.$section.'&sec2=operation/agentes/status_monitor&refr='.$refr.'&ag_group='.$ag_group.'&ag_freestring='.$ag_freestring.'&module_option='.$module_option.'&ag_modulename='.$ag_modulename.'&moduletype='.$moduletype.'&datatype='.$datatype.'&status='.$status.'&sort_field='.$sortField.'&sort='.$sort.'&pure='.$config['pure'].$ag_custom_fields_params.'">'; $div_custom_fields .= '<div class="div-input">';
$div_custom_fields .= html_print_input_text(
'ag_custom_fields['.$custom_field['id_field'].']',
if (is_metaconsole() === true) { $custom_field_value,
$table->colspan[5][0] = 7;
$table->cellstyle[5][0] = 'padding: 10px;';
$table->data[5][0] = ui_toggle(
html_print_table($table_custom_fields, true),
__('Advanced Options'),
'',
'', '',
0,
300,
true, true,
true false,
false,
'',
'div-input'
); );
$div_custom_fields .= '</div>';
$filters .= html_print_table($table, true); $div_custom_fields .= '</div>';
$filters .= '</form>'; }
ui_toggle($filters, __('Show filters'), '', '', false);
} else { $div_custom_fields .= '</div>';
$table->colspan[5][0] = 7;
$table->cellstyle[5][0] = 'padding-left: 10px;'; $filters = '<form method="post" action="index.php?sec='.$section.'&sec2=operation/agentes/status_monitor&refr='.$refr.'&ag_group='.$ag_group.'&ag_freestring='.$ag_freestring.'&module_option='.$module_option.'&ag_modulename='.$ag_modulename.'&moduletype='.$moduletype.'&datatype='.$datatype.'&status='.$status.'&sort_field='.$sortField.'&sort='.$sort.'&pure='.$config['pure'].$ag_custom_fields_params.'">';
$table->data[5][0] = ui_toggle(
html_print_table( $table2->colspan[2][0] = 7;
$table_custom_fields, $table2->cellstyle[2][0] = 'padding-left: 10px;';
true $table2->data[2][0] = ui_toggle(
), $div_custom_fields,
__('Agent custom fields'), __('Agent custom fields'),
'', '',
'', '',
@ -868,37 +836,68 @@ $table->data[4][0] .= __('Not condition').'&nbsp;'.ui_print_help_tip(__('If you
'', '',
'white-box-content', 'white-box-content',
'white_table_graph' 'white_table_graph'
); );
$filters .= html_print_table($table, true); $table->colspan[3][0] = 7;
$filters .= '</form>'; $table->cellstyle[3][0] = 'padding-left: 10px;padding-bottom: 0px;';
$table->data[3][0] = ui_toggle(
html_print_table(
$table2,
true
),
__('Advanced options'),
'',
'',
true,
true,
'',
'white-box-content',
'white_table_graph'
);
$table->colspan[4][0] = 7;
$table->cellstyle[4][0] = 'padding-top: 0px;';
$table->data[4][0] = html_print_submit_button(
__('Show'),
'uptbutton',
false,
'class="sub search mgn_tp_0 right"',
true
);
$filters .= html_print_table($table, true);
$filters .= '</form>';
if (is_metaconsole() === true) {
ui_toggle($filters, __('Show filters'), '', '', false);
} else {
echo $filters; echo $filters;
} }
unset($table); unset($table);
// End Build Search Form. // End Build Search Form.
// //
// Sort functionality. // Sort functionality.
$selected = true; $selected = true;
$selectAgentNameUp = false; $selectAgentNameUp = false;
$selectAgentNameDown = false; $selectAgentNameDown = false;
$selectDataTypeUp = false; $selectDataTypeUp = false;
$selectDataTypeDown = false; $selectDataTypeDown = false;
$selectTypeUp = false; $selectTypeUp = false;
$selectTypeDown = false; $selectTypeDown = false;
$selectModuleNameUp = false; $selectModuleNameUp = false;
$selectModuleNameDown = false; $selectModuleNameDown = false;
$selectIntervalUp = false; $selectIntervalUp = false;
$selectIntervalDown = false; $selectIntervalDown = false;
$selectStatusUp = false; $selectStatusUp = false;
$selectStatusDown = false; $selectStatusDown = false;
$selectDataUp = false; $selectDataUp = false;
$selectDataDown = false; $selectDataDown = false;
$selectTimestampUp = false; $selectTimestampUp = false;
$selectTimestampDown = false; $selectTimestampDown = false;
$order = null; $order = null;
switch ($sortField) { switch ($sortField) {
case 'agent_alias': case 'agent_alias':
switch ($sort) { switch ($sort) {
case 'up': case 'up':
@ -1101,7 +1100,7 @@ $table->data[4][0] .= __('Not condition').'&nbsp;'.ui_print_help_tip(__('If you
'order' => 'ASC', 'order' => 'ASC',
]; ];
break; break;
} }
$sql = 'SELECT $sql = 'SELECT
(SELECT GROUP_CONCAT(ttag.name SEPARATOR \',\') (SELECT GROUP_CONCAT(ttag.name SEPARATOR \',\')
@ -1150,7 +1149,7 @@ $table->data[4][0] .= __('Not condition').'&nbsp;'.ui_print_help_tip(__('If you
// We do not show the modules until the user searches with the filter. // We do not show the modules until the user searches with the filter.
if ($autosearch) { if ($autosearch) {
if (! defined('METACONSOLE')) { if (! defined('METACONSOLE')) {
$result = db_get_all_rows_sql($sql); $result = db_get_all_rows_sql($sql);
@ -1227,13 +1226,13 @@ $table->data[4][0] .= __('Not condition').'&nbsp;'.ui_print_help_tip(__('If you
// Get number of elements of the pagination. // Get number of elements of the pagination.
$result = ui_meta_get_subset_array($result, $inferior_limit, $superior_limit); $result = ui_meta_get_subset_array($result, $inferior_limit, $superior_limit);
} }
} }
if (($config['dbtype'] == 'oracle') && ($result !== false)) { if (($config['dbtype'] == 'oracle') && ($result !== false)) {
for ($i = 0; $i < count($result); $i++) { for ($i = 0; $i < count($result); $i++) {
unset($result[$i]['rnum']); unset($result[$i]['rnum']);
} }
} }
// Urls to sort the table. // Urls to sort the table.
@ -1284,7 +1283,7 @@ $table->data[4][0] .= __('Not condition').'&nbsp;'.ui_print_help_tip(__('If you
$url_timestamp_down .= '&sort_field=timestamp&sort=down'; $url_timestamp_down .= '&sort_field=timestamp&sort=down';
// Start Build List Result. // Start Build List Result.
if (!empty($result)) { if (!empty($result)) {
$table = new StdClass(); $table = new StdClass();
$table->cellpadding = 0; $table->cellpadding = 0;
$table->cellspacing = 0; $table->cellspacing = 0;
@ -1976,13 +1975,13 @@ $table->data[4][0] .= __('Not condition').'&nbsp;'.ui_print_help_tip(__('If you
if ($count_modules > $config['block_size']) { if ($count_modules > $config['block_size']) {
ui_pagination($count_modules, false, $offset, 0, false, 'offset', true, 'pagination-bottom'); ui_pagination($count_modules, false, $offset, 0, false, 'offset', true, 'pagination-bottom');
} }
} else { } else {
if ($first_interaction) { if ($first_interaction) {
ui_print_info_message(['no_close' => true, 'message' => __('This group doesn\'t have any monitor')]); ui_print_info_message(['no_close' => true, 'message' => __('This group doesn\'t have any monitor')]);
} else { } else {
ui_print_info_message(['no_close' => true, 'message' => __('Sorry no search parameters')]); ui_print_info_message(['no_close' => true, 'message' => __('Sorry no search parameters')]);
} }
} }
// End Build List Result. // End Build List Result.
@ -1992,7 +1991,7 @@ $table->data[4][0] .= __('Not condition').'&nbsp;'.ui_print_help_tip(__('If you
ui_require_javascript_file('pandora_modules'); ui_require_javascript_file('pandora_modules');
?> ?>
<script type="text/javascript"> <script type="text/javascript">
if(!document.getElementById('not_condition_switch').checked){ if(!document.getElementById('not_condition_switch').checked){