SNMP Browser modals change visual styles

This commit is contained in:
Jonathan 2023-02-28 17:22:17 +01:00
parent f72ec5eb9d
commit 1dca587455
2 changed files with 167 additions and 103 deletions

View File

@ -1534,10 +1534,13 @@ function snmp_browser_print_create_module_massive(
$table = new stdClass(); $table = new stdClass();
$table->width = '100%'; $table->width = '100%';
$table->data = []; $table->data = [];
$table->class = 'filter-table-adv databox';
$table->size[0] = '50%';
$table->size[1] = '50%';
$table->data[0][0] = __('Filter group')."<div id='loading_group' class='loading_div invisible left'><img src='images/spinner.gif'></div>"; $table->data[0][0] = html_print_label_input_block(
__('Filter group')."<div id='loading_group' class='loading_div invisible left'><img src='images/spinner.gif'></div>",
$table->data[0][1] = html_print_select_groups( html_print_select_groups(
false, false,
'RR', 'RR',
users_can_manage_group_all('RR'), users_can_manage_group_all('RR'),
@ -1556,23 +1559,59 @@ function snmp_browser_print_create_module_massive(
false, false,
$keys_field, $keys_field,
$strict_user $strict_user
)
); );
$table->data[1][0] = __('Search')."<div id='loading_filter' class='loading_div invisible left'><img src='images/spinner.gif'></div>"; $table->data[0][1] = html_print_label_input_block(
$table->data[1][1] = html_print_input_text( __('Search')."<div id='loading_filter' class='loading_div invisible left'><img src='images/spinner.gif'></div>",
html_print_input_text(
'filter', 'filter',
'', '',
'', '',
20, false,
150, 150,
true true
)
); );
$attr = [
'id' => 'image-select_all_available',
'title' => __('Select all'),
'style' => 'cursor: pointer;',
];
$table->data[1][0] = '<b>'.__($target_item.' available').'</b>&nbsp;&nbsp;'.html_print_image('images/tick.png', true, $attr, false, true);
$table->data[2][0] = '<b>'.__($target_item.' available').'</b><br> '.__('Select all').html_print_checkbox_switch('select_all_left', 1, false, true); $attr = [
$table->data[2][1] = ''; 'id' => 'image-select_all_apply',
$table->data[2][2] = '<b>'.__($target_item.' to apply').'</b><br> '.__('Select all').html_print_checkbox_switch('select_all_right', 1, false, true); 'title' => __('Select all'),
'style' => 'cursor: pointer;',
];
$table->data[1][1] = '<b>'.__($target_item.' to apply').'</b>&nbsp;&nbsp;'.html_print_image('images/tick.png', true, $attr, false, true);
$table->data[3][0] = html_print_select( if ($target == 'policy') {
if (enterprise_installed()) {
$table->data[2][0] = html_print_button(
__('Create new policy'),
'snmp_browser_create_policy',
false,
'',
'class="sub add mrgn_lft_0"',
true
);
}
$table->data[2][1] = html_print_div(
[
'style' => 'display:none',
'id' => 'policy_modal',
],
true
);
}
// Container with all agents list.
$AgentsFullList = html_print_div(
[
'content' => html_print_select(
[], [],
'id_item[]', 'id_item[]',
0, 0,
@ -1584,50 +1623,47 @@ function snmp_browser_print_create_module_massive(
true, true,
'', '',
false, false,
'width: 100%;', 'width: 100%;'
[] ),
); 'style' => 'width:45% !important',
if ($target == 'policy') {
if (enterprise_installed()) {
$table->data[4][0] = html_print_button(
__('Create new policy'),
'snmp_browser_create_policy',
false,
'',
'class="sub add mrgn_lft_0"',
true
);
}
$table->data[4][1] = html_print_div(
[
'style' => 'display:none',
'id' => 'policy_modal',
], ],
true true
); );
}
$table->cellstyle[3][1] = 'text-align: center'; $controls[] = html_print_image(
$table->data[3][1] = html_print_image( 'images/plus.svg',
'images/darrowright.png',
true, true,
[ [
'id' => 'right', 'id' => 'right',
'title' => __('Add'), 'title' => __('Add'),
'class' => 'invert_filter', 'class' => 'invert_filter main_menu_icon',
] ]
).'<br /><br /><br /><br />'.html_print_image( );
'images/darrowleft.png',
$controls[] = html_print_image(
'images/minus.svg',
true, true,
[ [
'id' => 'left', 'id' => 'left',
'title' => __('Undo'), 'title' => __('Undo'),
'class' => 'invert_filter', 'class' => 'invert_filter main_menu_icon',
] ]
); );
$table->data[3][2] = html_print_select(
// Container with controls.
$AgentsControls = html_print_div(
[
'content' => implode('', $controls),
'style' => 'width:10% !important',
'class' => 'flex-colum-center',
],
true
);
// Container with selected agents list.
$AgentsSelectedList = html_print_div(
[
'content' => html_print_select(
[], [],
'id_item2[]', 'id_item2[]',
0, 0,
@ -1639,8 +1675,21 @@ function snmp_browser_print_create_module_massive(
true, true,
'', '',
false, false,
'width: 100%;', 'width: 100%;'
[] ),
'style' => 'width:45% !important',
],
true
);
$table->colspan[3][0] = 2;
$table->data[3][0] = html_print_div(
[
'id' => 'agent_controls',
'content' => $AgentsFullList.$AgentsControls.$AgentsSelectedList,
'style' => 'width:100% !important',
],
true
); );
$output .= html_print_table($table, true); $output .= html_print_table($table, true);
@ -1716,15 +1765,28 @@ function snmp_browser_print_create_policy()
$description = get_parameter('description'); $description = get_parameter('description');
$table->width = '100%'; $table->width = '100%';
$table->class = 'databox filters bold_top'; $table->class = 'filter-table-adv databox';
$table->style = []; $table->style = [];
$table->data = []; $table->data = [];
$table->data[0][0] = __('Name'); $table->size[0] = '100%';
$table->data[0][1] = html_print_input_text('name', $name, '', '60%', 150, true); $table->size[1] = '100%';
$table->size[2] = '100%';
$table->data[1][0] = __('Group'); $table->data[0][0] = html_print_label_input_block(
$table->data[1][1] = '<div class="flex flex-row"><div class="w90p">'; __('Name'),
$table->data[1][1] .= html_print_select_groups( html_print_input_text(
'name',
$name,
'',
'60%',
150,
true
)
);
$table->data[1][0] = html_print_label_input_block(
__('Group'),
'<div class="flex flex-row"><div class="w90p">'.html_print_select_groups(
false, false,
'AW', 'AW',
false, false,
@ -1734,13 +1796,19 @@ function snmp_browser_print_create_policy()
'', '',
'', '',
true true
).'</div>'; ).'</div><span id="group_preview">'.ui_print_group_icon(
$table->data[1][1] .= ' <span id="group_preview">'; $id_group,
$table->data[1][1] .= ui_print_group_icon($id_group, true, 'groups_small', '', false); true,
$table->data[1][1] .= '</span></div>'; 'groups_small',
'',
false
).'</span></div>'
);
$table->data[2][0] = __('Description'); $table->data[2][0] = html_print_label_input_block(
$table->data[2][1] = html_print_textarea('description', 3, 30, $description, '', true); __('Description'),
html_print_textarea('description', 3, 30, $description, '', true)
);
$output = '<form method="post" id="snmp_browser_add_policy_form">'; $output = '<form method="post" id="snmp_browser_add_policy_form">';
$output .= html_print_table($table, true); $output .= html_print_table($table, true);

View File

@ -337,18 +337,14 @@ function add_module_massive_controller(target = 'agent')
}); });
// Select all Items. // Select all Items.
$("#checkbox-select_all_left").change(function () { $("#image-select_all_available").click(function (event) {
if ($("#checkbox-select_all_left").prop('checked') == true) { event.preventDefault();
$('#id_item option').map(function() { $('#id_item>option').prop('selected', true);
$(this).prop('selected', true); })
});
} else {
$('#id_item option').map(function() {
$(this).prop('selected', false);
});
}
return false; $("#image-select_all_apply").click(function (event) {
event.preventDefault();
$('#id_item2>option').prop('selected', true);
}); });
$("#checkbox-select_all_right").change(function () { $("#checkbox-select_all_right").change(function () {