size form widgets dashboards pandora_enterprise#8827

This commit is contained in:
Daniel Barbero Martin 2022-06-27 15:43:42 +02:00
parent ebe5f0de7c
commit 3cdde5054a
34 changed files with 181 additions and 63 deletions

View File

@ -777,6 +777,7 @@ class HTML
) { ) {
$form = ($data['form'] ?? null); $form = ($data['form'] ?? null);
$inputs = ($data['inputs'] ?? []); $inputs = ($data['inputs'] ?? []);
$blocks = ($data['blocks'] ?? []);
$rawInputs = ($data['rawInputs'] ?? null); $rawInputs = ($data['rawInputs'] ?? null);
$js = ($data['js'] ?? null); $js = ($data['js'] ?? null);
$rawjs = ($data['js_block'] ?? null); $rawjs = ($data['js_block'] ?? null);
@ -843,36 +844,59 @@ class HTML
$output_submit = ''; $output_submit = '';
$output = ''; $output = '';
if ($print_white_box === true) { if (empty($blocks) === false) {
$output .= '<div class="white_box">'; $output .= '<div class="container-block-column">';
} foreach ($blocks as $valueblock) {
$output .= '<ul class="wizard">';
foreach ($inputs[$valueblock] as $input) {
if (is_array(($input['arguments'] ?? null)) === true
&& isset($input['arguments']) === true
&& isset($input['arguments']['type']) === true
&& $input['arguments']['type'] === 'submit'
) {
$output_submit .= self::printBlock($input, true);
} else {
$output .= self::printBlock($input, true);
}
}
$output .= '<ul class="wizard">'; $output .= '</ul>';
foreach ($inputs as $input) {
if (is_array(($input['arguments'] ?? null)) === true
&& isset($input['arguments']) === true
&& isset($input['arguments']['type']) === true
&& $input['arguments']['type'] === 'submit'
) {
$output_submit .= self::printBlock($input, true);
} else {
$output .= self::printBlock($input, true);
} }
}
$output .= '</ul>';
// There is possible add raw inputs for this form.
if (empty($rawInputs) === false) {
$output .= $rawInputs;
}
if ($print_white_box === true) {
$output .= '</div>'; $output .= '</div>';
} else {
if ($print_white_box === true) {
$output .= '<div class="white_box">';
}
$output .= '<ul class="wizard">';
foreach ($inputs as $input) {
if (is_array(($input['arguments'] ?? null)) === true
&& isset($input['arguments']) === true
&& isset($input['arguments']['type']) === true
&& $input['arguments']['type'] === 'submit'
) {
$output_submit .= self::printBlock($input, true);
} else {
$output .= self::printBlock($input, true);
}
}
$output .= '</ul>';
// There is possible add raw inputs for this form.
if (empty($rawInputs) === false) {
$output .= $rawInputs;
}
if ($print_white_box === true) {
$output .= '</div>';
}
$output .= '<ul class="wizard">'.$output_submit.'</ul>';
} }
$output .= '<ul class="wizard">'.$output_submit.'</ul>';
$output .= html_print_csrf_hidden(true); $output .= html_print_csrf_hidden(true);
$output .= '</form>'; $output .= '</form>';
$output .= '<script>'.$js.'</script>'; $output .= '<script>'.$js.'</script>';

View File

@ -1375,7 +1375,14 @@ class Manager implements PublicLogin
global $config; global $config;
$instance = $this->instanceWidget(); $instance = $this->instanceWidget();
$blocks = [];
$htmlInputs = $instance->getFormInputs([]); $htmlInputs = $instance->getFormInputs([]);
if (isset($htmlInputs['blocks']) === true) {
$blocks = $htmlInputs['blocks'];
$htmlInputs = $htmlInputs['inputs'];
}
$js = $instance->getFormJS(); $js = $instance->getFormJS();
View::render( View::render(
@ -1383,6 +1390,7 @@ class Manager implements PublicLogin
[ [
'dashboardId' => $this->dashboardId, 'dashboardId' => $this->dashboardId,
'cellId' => $this->cellId, 'cellId' => $this->cellId,
'blocks' => $blocks,
'htmlInputs' => $htmlInputs, 'htmlInputs' => $htmlInputs,
'js' => $js, 'js' => $js,
] ]

View File

@ -861,7 +861,7 @@ class AgentModuleWidget extends Widget
{ {
$size = [ $size = [
'width' => 800, 'width' => 800,
'height' => 600, 'height' => 580,
]; ];
return $size; return $size;

View File

@ -381,7 +381,7 @@ class AlertsFiredWidget extends Widget
{ {
$size = [ $size = [
'width' => 400, 'width' => 400,
'height' => 370, 'height' => 260,
]; ];
return $size; return $size;

View File

@ -331,7 +331,7 @@ class ClockWidget extends Widget
{ {
$size = [ $size = [
'width' => 400, 'width' => 400,
'height' => 300, 'height' => 270,
]; ];
return $size; return $size;

View File

@ -542,7 +542,7 @@ class CustomGraphWidget extends Widget
{ {
$size = [ $size = [
'width' => 400, 'width' => 400,
'height' => 480, 'height' => 440,
]; ];
return $size; return $size;

View File

@ -289,8 +289,19 @@ class EventsListWidget extends Widget
// Retrieve global - common inputs. // Retrieve global - common inputs.
$inputs = parent::getFormInputs(); $inputs = parent::getFormInputs();
$blocks = [
'row1',
'row2',
];
$inputs['blocks'] = $blocks;
foreach ($inputs as $kInput => $vInput) {
$inputs['inputs']['row1'][] = $vInput;
}
// Select pre built filter. // Select pre built filter.
$inputs[] = [ $inputs['inputs']['row1'][] = [
'label' => \__('Custom filters'), 'label' => \__('Custom filters'),
'arguments' => [ 'arguments' => [
'type' => 'select', 'type' => 'select',
@ -317,7 +328,7 @@ class EventsListWidget extends Widget
} }
// Event Type. // Event Type.
$inputs[] = [ $inputs['inputs']['row1'][] = [
'label' => \__('Event type'), 'label' => \__('Event type'),
'arguments' => [ 'arguments' => [
'type' => 'select', 'type' => 'select',
@ -332,7 +343,7 @@ class EventsListWidget extends Widget
]; ];
// Max. hours old. Default 8. // Max. hours old. Default 8.
$inputs[] = [ $inputs['inputs']['row1'][] = [
'label' => \__('Max. hours old'), 'label' => \__('Max. hours old'),
'arguments' => [ 'arguments' => [
'name' => 'maxHours', 'name' => 'maxHours',
@ -355,7 +366,7 @@ class EventsListWidget extends Widget
($config['block_size'] * 3) => ($config['block_size'] * 3), ($config['block_size'] * 3) => ($config['block_size'] * 3),
]; ];
$inputs[] = [ $inputs['inputs']['row1'][] = [
'label' => \__('Limit'), 'label' => \__('Limit'),
'arguments' => [ 'arguments' => [
'type' => 'select', 'type' => 'select',
@ -374,7 +385,7 @@ class EventsListWidget extends Widget
0 => \__('Only pending'), 0 => \__('Only pending'),
]; ];
$inputs[] = [ $inputs['inputs']['row1'][] = [
'label' => \__('Event status'), 'label' => \__('Event status'),
'arguments' => [ 'arguments' => [
'type' => 'select', 'type' => 'select',
@ -389,7 +400,7 @@ class EventsListWidget extends Widget
// Severity. // Severity.
$fields = \get_priorities(); $fields = \get_priorities();
$inputs[] = [ $inputs['inputs']['row2'][] = [
'label' => \__('Severity'), 'label' => \__('Severity'),
'arguments' => [ 'arguments' => [
'type' => 'select', 'type' => 'select',
@ -416,7 +427,7 @@ class EventsListWidget extends Widget
} }
// Groups. // Groups.
$inputs[] = [ $inputs['inputs']['row2'][] = [
'label' => \__('Groups'), 'label' => \__('Groups'),
'arguments' => [ 'arguments' => [
'type' => 'select_groups', 'type' => 'select_groups',
@ -432,7 +443,7 @@ class EventsListWidget extends Widget
]; ];
// Group recursion. // Group recursion.
$inputs[] = [ $inputs['inputs']['row2'][] = [
'label' => \__('Group recursion'), 'label' => \__('Group recursion'),
'arguments' => [ 'arguments' => [
'type' => 'switch', 'type' => 'switch',
@ -446,7 +457,7 @@ class EventsListWidget extends Widget
// Tags. // Tags.
$fields = \tags_get_user_tags($config['id_user'], 'AR'); $fields = \tags_get_user_tags($config['id_user'], 'AR');
$inputs[] = [ $inputs['inputs']['row2'][] = [
'label' => \__('Tags'), 'label' => \__('Tags'),
'arguments' => [ 'arguments' => [
'type' => 'select', 'type' => 'select',
@ -668,7 +679,6 @@ class EventsListWidget extends Widget
'columns' => $fields, 'columns' => $fields,
'ajax_return_operation' => 'buffers', 'ajax_return_operation' => 'buffers',
'ajax_return_operation_function' => 'process_buffers', 'ajax_return_operation_function' => 'process_buffers',
// 'drawCallback' => 'process_datatables_callback(this, settings)',
'return' => true, 'return' => true,
'csv' => 0, 'csv' => 0,
] ]
@ -708,8 +718,8 @@ class EventsListWidget extends Widget
public function getSizeModalConfiguration(): array public function getSizeModalConfiguration(): array
{ {
$size = [ $size = [
'width' => 450, 'width' => 800,
'height' => 700, 'height' => 520,
]; ];
return $size; return $size;

View File

@ -297,8 +297,8 @@ class WelcomeWidget extends Widget
public function getSizeModalConfiguration(): array public function getSizeModalConfiguration(): array
{ {
$size = [ $size = [
'width' => 400, 'width' => 500,
'height' => 250, 'height' => 210,
]; ];
return $size; return $size;

View File

@ -452,7 +452,7 @@ class GraphModuleHistogramWidget extends Widget
{ {
$size = [ $size = [
'width' => 400, 'width' => 400,
'height' => 500, 'height' => 480,
]; ];
return $size; return $size;

View File

@ -502,7 +502,7 @@ class GroupsStatusWidget extends Widget
{ {
$size = [ $size = [
'width' => 400, 'width' => 400,
'height' => 300, 'height' => 270,
]; ];
return $size; return $size;

View File

@ -544,7 +544,7 @@ class MapsMadeByUser extends Widget
{ {
$size = [ $size = [
'width' => 400, 'width' => 400,
'height' => 360, 'height' => 270,
]; ];
return $size; return $size;

View File

@ -409,7 +409,7 @@ class MapsStatusWidget extends Widget
{ {
$size = [ $size = [
'width' => 400, 'width' => 400,
'height' => 450, 'height' => 410,
]; ];
return $size; return $size;

View File

@ -559,7 +559,7 @@ class ModuleStatusWidget extends Widget
{ {
$size = [ $size = [
'width' => 450, 'width' => 450,
'height' => 700, 'height' => 650,
]; ];
return $size; return $size;

View File

@ -418,7 +418,7 @@ class ModuleTableValueWidget extends Widget
{ {
$size = [ $size = [
'width' => 450, 'width' => 450,
'height' => 460, 'height' => 430,
]; ];
return $size; return $size;

View File

@ -454,7 +454,7 @@ class ModuleValueWidget extends Widget
{ {
$size = [ $size = [
'width' => 450, 'width' => 450,
'height' => 500, 'height' => 490,
]; ];
return $size; return $size;

View File

@ -358,7 +358,7 @@ class MonitorHealthWidget extends Widget
{ {
$size = [ $size = [
'width' => 400, 'width' => 400,
'height' => 250, 'height' => 210,
]; ];
return $size; return $size;

View File

@ -499,7 +499,7 @@ class NetworkMapWidget extends Widget
{ {
$size = [ $size = [
'width' => 400, 'width' => 400,
'height' => 470, 'height' => 430,
]; ];
return $size; return $size;

View File

@ -347,4 +347,20 @@ class OsQuickReportWidget extends Widget
} }
/**
* Get size Modal Configuration.
*
* @return array
*/
public function getSizeModalConfiguration(): array
{
$size = [
'width' => 400,
'height' => 205,
];
return $size;
}
} }

View File

@ -296,8 +296,8 @@ class PostWidget extends Widget
public function getSizeModalConfiguration(): array public function getSizeModalConfiguration(): array
{ {
$size = [ $size = [
'width' => 520, 'width' => 480,
'height' => 520, 'height' => 480,
]; ];
return $size; return $size;

View File

@ -508,7 +508,7 @@ class ReportsWidget extends Widget
{ {
$size = [ $size = [
'width' => 400, 'width' => 400,
'height' => 360, 'height' => 260,
]; ];
return $size; return $size;

View File

@ -462,7 +462,7 @@ class ServiceMapWidget extends Widget
{ {
$size = [ $size = [
'width' => 400, 'width' => 400,
'height' => 300, 'height' => 320,
]; ];
return $size; return $size;

View File

@ -477,7 +477,7 @@ class ServiceViewWidget extends Widget
{ {
$size = [ $size = [
'width' => 400, 'width' => 400,
'height' => 300, 'height' => 270,
]; ];
return $size; return $size;

View File

@ -415,7 +415,7 @@ class SingleGraphWidget extends Widget
{ {
$size = [ $size = [
'width' => 450, 'width' => 450,
'height' => 480, 'height' => 430,
]; ];
return $size; return $size;

View File

@ -643,7 +643,7 @@ class SystemGroupStatusWidget extends Widget
{ {
$size = [ $size = [
'width' => 450, 'width' => 450,
'height' => 600, 'height' => 520,
]; ];
return $size; return $size;

View File

@ -503,7 +503,7 @@ class TacticalWidget extends Widget
{ {
$size = [ $size = [
'width' => 450, 'width' => 450,
'height' => 400, 'height' => 370,
]; ];
return $size; return $size;

View File

@ -514,4 +514,20 @@ class TopNEventByGroupWidget extends Widget
} }
/**
* Get size Modal Configuration.
*
* @return array
*/
public function getSizeModalConfiguration(): array
{
$size = [
'width' => 400,
'height' => 520,
];
return $size;
}
} }

View File

@ -549,4 +549,20 @@ class TopNEventByModuleWidget extends Widget
} }
/**
* Get size Modal Configuration.
*
* @return array
*/
public function getSizeModalConfiguration(): array
{
$size = [
'width' => 400,
'height' => 540,
];
return $size;
}
} }

View File

@ -735,7 +735,7 @@ class TreeViewWidget extends Widget
{ {
$size = [ $size = [
'width' => 450, 'width' => 450,
'height' => 520, 'height' => 590,
]; ];
return $size; return $size;

View File

@ -307,7 +307,7 @@ class UrlWidget extends Widget
{ {
$size = [ $size = [
'width' => 450, 'width' => 450,
'height' => 300, 'height' => 270,
]; ];
return $size; return $size;

View File

@ -439,7 +439,7 @@ class WuxWidget extends Widget
{ {
$size = [ $size = [
'width' => 450, 'width' => 450,
'height' => 360, 'height' => 330,
]; ];
return $size; return $size;

View File

@ -399,7 +399,7 @@ class WuxStatsWidget extends Widget
{ {
$size = [ $size = [
'width' => 450, 'width' => 450,
'height' => 400, 'height' => 370,
]; ];
return $size; return $size;

View File

@ -577,3 +577,17 @@ div#main_pure {
width: 98%; width: 98%;
margin-top: 5px; margin-top: 5px;
} }
.ui-dialog .ui-dialog-title {
top: 0px !important;
}
.ui-dialog .ui-dialog-content {
padding: 0em 1em !important;
margin-bottom: 0 !important;
}
.ui-dialog .ui-dialog-buttonpane {
margin-top: 0px !important;
padding: 0.5em 1em 0em 0em !important;
}

View File

@ -289,6 +289,19 @@ ul.wizard li > textarea {
display: inline-block; display: inline-block;
} }
.container-block-column {
display: flex;
flex-direction: row;
width: 100%;
height: 100%;
align-items: center;
justify-content: space-around;
}
.container-block-column ul.wizard {
width: 100%;
}
.hidden { .hidden {
display: none; display: none;
} }

View File

@ -50,6 +50,7 @@ $form = [
HTML::printForm( HTML::printForm(
[ [
'form' => $form, 'form' => $form,
'blocks' => $blocks,
'inputs' => $htmlInputs, 'inputs' => $htmlInputs,
'js' => $js, 'js' => $js,
] ]