#9038 filter remake

This commit is contained in:
Daniel Maya 2022-06-01 15:07:51 +02:00
parent aa6977e4db
commit 6c48717627
2 changed files with 1077 additions and 1052 deletions

View File

@ -9018,3 +9018,29 @@ div#err_msg_centralised {
#reset-styles var {
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->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][1] = html_print_autocomplete_modules(
'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(
'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 = [
0 => __('All'),
@ -657,21 +653,18 @@ $monitor_options = [
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;
$table->data[2][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][4] = '<span>'.__('Min. hours in current status').'</span>';
$table2->data[0][5] = html_print_input_text('min_hours_status', $min_hours_val, '', 12, 20, true);
$table->data[3][0] = '<span id="datatypetittle"';
$table->data[3][0] .= '>'.__('Data type').'</span>';
$table->data[3][1] .= '<div id="datatypebox">';
$table2->data[1][0] = '<span id="datatypetittle"';
$table2->data[1][0] .= '>'.__('Data type').'</span>';
$table2->data[1][1] .= '<div id="datatypebox">';
switch ($moduletype) {
@ -744,37 +737,33 @@ switch ($moduletype) {
}
$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) {
$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) {
$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>';
$table->data[3][1] .= '</div>';
$table2->data[1][1] .= '</select>';
$table2->data[1][1] .= '</div>';
$check_not_condition = '';
if ($not_condition !== '') {
$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);
$table->data[4][1] = html_print_div(
$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);
$table2->data[1][3] = html_print_div(
[
'class' => 'w120px mrgn_5px mrgn_lft_0px mrgn_right_0px',
'content' => html_print_input(
@ -792,35 +781,13 @@ $table->data[4][0] .= __('Not condition').'&nbsp;'.ui_print_help_tip(__('If you
true
);
$table_custom_fields = new stdClass();
$table_custom_fields->class = 'filters';
$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 = [];
}
$div_custom_fields = '<div class="flex-row">';
foreach ($custom_fields as $custom_field) {
$row = [];
$row[0] = $custom_field['name'];
$custom_field_value = '';
if (empty($ag_custom_fields) === false) {
$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>';
$div_custom_fields .= '<div class="div-input">';
$div_custom_fields .= html_print_input_text(
'ag_custom_fields['.$custom_field['id_field'].']',
$custom_field_value,
'',
0,
300,
true,
false,
false,
'',
'div-input'
);
$div_custom_fields .= '</div>';
$div_custom_fields .= '</div>';
}
$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.'">';
if (is_metaconsole() === true) {
$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'),
'',
'',
true,
true
);
$filters .= html_print_table($table, true);
$filters .= '</form>';
ui_toggle($filters, __('Show filters'), '', '', false);
} else {
$table->colspan[5][0] = 7;
$table->cellstyle[5][0] = 'padding-left: 10px;';
$table->data[5][0] = ui_toggle(
html_print_table(
$table_custom_fields,
true
),
$table2->colspan[2][0] = 7;
$table2->cellstyle[2][0] = 'padding-left: 10px;';
$table2->data[2][0] = ui_toggle(
$div_custom_fields,
__('Agent custom fields'),
'',
'',
@ -870,8 +838,39 @@ $table->data[4][0] .= __('Not condition').'&nbsp;'.ui_print_help_tip(__('If you
'white_table_graph'
);
$table->colspan[3][0] = 7;
$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;
}