WIP: Refactor and solve visual issues

This commit is contained in:
Jose Gonzalez 2020-04-07 17:46:12 +02:00
parent 1a080a4e3a
commit 396c93c8b8
2 changed files with 125 additions and 77 deletions

View File

@ -341,18 +341,19 @@ class AgentWizard extends HTML
'return' => true, 'return' => true,
], ],
]; ];
// Prints main form.
$output = '<div class="white_box">'; html_print_div(
$output .= $this->printForm( [
'class' => 'white_box',
'content' => $this->printForm(
[ [
'form' => $form, 'form' => $form,
'inputs' => $inputs, 'inputs' => $inputs,
], ],
true true
),
]
); );
$output .= '</div>';
echo $output;
} }
@ -392,7 +393,8 @@ class AgentWizard extends HTML
]; ];
} }
$output = '<div class="white_box" style="margin-top: 20px;">'; // Lets generate the block tables.
$output = '';
foreach ($blockTables as $id_group => $blockTable) { foreach ($blockTables as $id_group => $blockTable) {
// Data with all components. // Data with all components.
$blockData = $blockTable['data']; $blockData = $blockTable['data'];
@ -405,9 +407,21 @@ class AgentWizard extends HTML
$blockComponentList = chop($blockComponentList, ','); $blockComponentList = chop($blockComponentList, ',');
// Title of Block. // Title of Block.
$blockTitle = $blockTable['name']; $blockTitle = $blockTable['name'];
$blockTitle .= '<div class="white_table_header_checkbox">'; $blockTitle .= html_print_div(
$blockTitle .= html_print_checkbox_switch_extended('sel_block_'.$id_group, 1, 0, false, 'switchBlockControl(event)', '', true); [
$blockTitle .= '</div>'; 'class' => 'white_table_header_checkbox',
'content' => html_print_checkbox_switch_extended(
'sel_block_'.$id_group,
1,
0,
false,
'switchBlockControl(event)',
'',
true
),
],
true
);
$table = new StdClasS(); $table = new StdClasS();
$table->class = 'databox data'; $table->class = 'databox data';
@ -422,12 +436,12 @@ class AgentWizard extends HTML
$table->class = 'info_table'; $table->class = 'info_table';
$table->head = []; $table->head = [];
$table->head[0] = '<div style="font-weight:700;">'.__('Module Name').'</div>'; $table->head[0] = html_print_div(['style' => 'font-weight:700;', 'content' => __('Module Name')], true);
$table->head[1] = '<div style="text-align:center;font-weight:700;">'.__('Type').'</div>'; $table->head[1] = html_print_div(['style' => 'font-weight:700;text-align:center;', 'content' => __('Type')], true);
$table->head[2] = '<div style="font-weight:700;">'.__('Module info').'</div>'; $table->head[2] = html_print_div(['style' => 'font-weight:700;', 'content' => __('Module info')], true);
$table->head[3] = '<div style="text-align:center;font-weight:700;">'.__('Warning').'</div>'; $table->head[3] = html_print_div(['style' => 'font-weight:700;text-align:center;', 'content' => __('Warning')], true);
$table->head[4] = '<div style="text-align:center;font-weight:700;">'.__('Critical').'</div>'; $table->head[4] = html_print_div(['style' => 'font-weight:700;text-align:center;', 'content' => __('Critical')], true);
$table->head[5] = '<div style="margin-right:1.2em;font-weight:700;">'.__('Active').'</div>'; $table->head[5] = html_print_div(['style' => 'font-weight:700;margin-right:1.2em;', 'content' => __('Active')], true);
$table->size = []; $table->size = [];
$table->size[0] = '15%'; $table->size[0] = '15%';
@ -449,69 +463,92 @@ class AgentWizard extends HTML
// Module info column. // Module info column.
$data[2] = mb_strimwidth(io_safe_output($module['description']), 0, 150, '...'); $data[2] = mb_strimwidth(io_safe_output($module['description']), 0, 150, '...');
// Warning column. // Warning column.
$data[3] = '<div style="float: left;width: 33%;text-align: center;">Min: '; $data[3] = html_print_div(
$data[3] .= html_print_input_text( [
'txt_min_warn_'.$module['component_id'], 'class' => 'wizard-column-levels',
'content' => 'Min: '.html_print_input_text(
'warning_min_'.$module['component_id'],
'0', '0',
'', '',
3, 3,
4, 4,
true true
).' ',
],
true
); );
$data[3] .= '</div>'; $data[3] .= html_print_div(
$data[3] .= ' '; [
$data[3] .= '<div style="float: left;width: 33%;text-align: center;">Max: '; 'class' => 'wizard-column-levels',
$data[3] .= html_print_input_text( 'content' => 'Max: '.html_print_input_text(
'txt_max_warn_'.$module['component_id'], 'warning_max_'.$module['component_id'],
'0', '0',
'', '',
3, 3,
4, 4,
true true
),
],
true
); );
$data[3] .= '</div>'; $data[3] .= html_print_div(
$data[3] .= '<div style="float: left;width: 33%;margin-top: 0.3em;">Inv: '; [
$data[3] .= html_print_checkbox( 'class' => 'wizard-column-levels',
'chk_inv_warn_'.$module['component_id'], 'style' => 'margin-top: 0.3em;',
'content' => 'Inv: '.html_print_checkbox(
'warning_inv_'.$module['component_id'],
0, 0,
false, false,
true, true,
false false
),
],
true
); );
$data[3] .= '</div>';
// Critical column. // Critical column.
$data[4] = '<div style="float: left;width: 33%;text-align: center;">Min: '; $data[4] = html_print_div(
$data[4] .= html_print_input_text( [
'txt_min_crit_'.$module['component_id'], 'class' => 'wizard-column-levels',
'content' => 'Min: '.html_print_input_text(
'critical_min_'.$module['component_id'],
'0', '0',
'', '',
3, 3,
4, 4,
true true
).' ',
],
true
); );
$data[4] .= '</div>'; $data[4] .= html_print_div(
$data[4] .= ' '; [
$data[4] .= '<div style="float: left;width: 33%;text-align: center;">Max: '; 'class' => 'wizard-column-levels',
$data[4] .= html_print_input_text( 'content' => 'Max: '.html_print_input_text(
'txt_max_crit_'.$module['component_id'], 'critical_max_'.$module['component_id'],
'0', '0',
'', '',
3, 3,
4, 4,
true true
),
],
true
); );
$data[4] .= '</div>'; $data[4] .= html_print_div(
$data[4] .= ' '; [
$data[4] .= '<div style="float: left;width: 33%;margin-top: 0.3em;">Inv: '; 'class' => 'wizard-column-levels',
$data[4] .= html_print_checkbox( 'style' => 'margin-top: 0.3em;',
'chk_inv_crit_'.$module['component_id'], 'content' => 'Inv: '.html_print_checkbox(
'critical_inv_'.$module['component_id'],
0, 0,
false, false,
true, true,
false false
),
],
true
); );
$data[4] .= '</div>'; // Activation column.
// Activavion column.
$data[5] = html_print_checkbox_switch_extended('sel_module_'.$id_group.'_'.$module['component_id'], 1, 0, false, 'switchBlockControl(event)', '', true); $data[5] = html_print_checkbox_switch_extended('sel_module_'.$id_group.'_'.$module['component_id'], 1, 0, false, 'switchBlockControl(event)', '', true);
array_push($table->data, $data); array_push($table->data, $data);
@ -522,10 +559,15 @@ class AgentWizard extends HTML
$output .= ui_toggle($content, $blockTitle, '', '', false, true); $output .= ui_toggle($content, $blockTitle, '', '', false, true);
} }
$output .= '</div>'; html_print_div(
[
'class' => 'white_box',
'style' => 'margin-top: 20px;',
'content' => $output,
]
);
echo $output; // Form. Not used at this moment.
// Main form.
$form = [ $form = [
'action' => $this->baseUrl, 'action' => $this->baseUrl,
'id' => 'modal_form_action_response', 'id' => 'modal_form_action_response',
@ -594,7 +636,7 @@ class AgentWizard extends HTML
// The functions goes here! // The functions goes here!
/** /**
* Loads modal from AJAX to perform the required action. * WIP: Loads modal from AJAX to perform the required action.
*/ */
function performAction() { function performAction() {
var btn_ok_text = '<?php echo __('OK'); ?>'; var btn_ok_text = '<?php echo __('OK'); ?>';
@ -632,7 +674,7 @@ class AgentWizard extends HTML
} }
/** /**
* Process ajax responses and shows a dialog with results. * WIP: Process ajax responses and shows a dialog with results.
*/ */
function showMsg(data) { function showMsg(data) {
var title = "<?php echo __('Success'); ?>"; var title = "<?php echo __('Success'); ?>";

View File

@ -110,3 +110,9 @@ ul.wizard li > textarea {
.wizard #interval_manual_container #interval_manual > * { .wizard #interval_manual_container #interval_manual > * {
flex: 1 1 auto; flex: 1 1 auto;
} }
.wizard-column-levels {
float: left;
width: 33%;
text-align: center;
}