fixed modal size configuration widgets pandora_enterprise#8827

This commit is contained in:
Daniel Barbero Martin 2022-05-18 12:55:10 +02:00
parent 4ae4f6b7bd
commit c437b894a3
32 changed files with 531 additions and 19 deletions

View File

@ -1685,7 +1685,9 @@ function html_print_select_multiple_modules_filtered(array $data):string
);
}
if ($data['mAgents'] !== null) {
if (empty($data['mAgents']) === false
&& empty($data['mModuleGroup'] === false)
) {
$all_modules = get_modules_agents(
$data['mModuleGroup'],
explode(',', $data['mAgents']),

View File

@ -266,7 +266,7 @@ function initialiceLayout(data) {
});
$("#configure-widget-" + id).click(function() {
configurationWidget(id, widgetId);
getSizeModalConfiguration(id, widgetId);
});
},
error: function(error) {
@ -275,6 +275,29 @@ function initialiceLayout(data) {
});
}
function getSizeModalConfiguration(cellId, widgetId) {
$.ajax({
method: "post",
url: data.url,
data: {
page: data.page,
method: "getSizeModalConfiguration",
dashboardId: data.dashboardId,
cellId: cellId,
widgetId: widgetId
},
dataType: "json",
success: function(size) {
configurationWidget(cellId, widgetId, size);
},
error: function(error) {
console.log(error);
return [];
}
});
return false;
}
function saveLayout() {
var items = $(".grid-stack > .grid-stack-item:visible")
.map(function(i, el) {
@ -370,7 +393,7 @@ function initialiceLayout(data) {
});
}
function configurationWidget(cellId, widgetId) {
function configurationWidget(cellId, widgetId, size) {
load_modal({
target: $("#modal-config-widget"),
form: "form-config-widget",
@ -388,12 +411,9 @@ function initialiceLayout(data) {
dashboardId: data.dashboardId,
widgetId: widgetId
},
width:
widgetId == 14 || widgetId == 2 || widgetId == 23 || widgetId == 16
? 750
: 450,
maxHeight: 650,
minHeight: widgetId == 16 ? 450 : 400
width: size.width,
maxHeight: size.height,
minHeight: size.height
},
onsubmit: {
page: data.page,
@ -710,7 +730,7 @@ function initialiceLayout(data) {
});
$("#configure-widget-" + cellId).click(function() {
configurationWidget(cellId, widgetId);
getSizeModalConfiguration(cellId, widgetId);
});
saveLayout();

View File

@ -180,6 +180,7 @@ class Manager implements PublicLogin
'imageIconDashboardAjax',
'formSlides',
'callWidgetMethod',
'getSizeModalConfiguration',
];
@ -1524,4 +1525,22 @@ class Manager implements PublicLogin
}
/**
* Size configuration modal (ajax only).
*
* @return void.
*/
public function getSizeModalConfiguration():void
{
$result = [];
$widget = $this->instanceWidget();
$result = $widget->getSizeModalConfiguration();
echo json_encode($result);
return;
}
}

View File

@ -512,7 +512,9 @@ class Widget
if (empty($values['background']) === true) {
$values['background'] = '#ffffff';
if ($config['style'] === 'pandora_black' && !is_metaconsole()) {
if ($config['style'] === 'pandora_black'
&& is_metaconsole() === false
) {
$values['background'] = '#222222';
}
}
@ -759,4 +761,20 @@ class Widget
}
/**
* Get size Modal Configuration.
*
* @return array
*/
public function getSizeModalConfiguration():array
{
$size = [
'width' => 400,
'height' => 650,
];
return $size;
}
}

View File

@ -285,12 +285,12 @@ class AgentModuleWidget extends Widget
'arguments' => [
'type' => 'select_multiple_modules_filtered',
'uniqId' => $this->cellId,
'mGroup' => $this->values['mGroup'],
'mRecursion' => $this->values['mRecursion'],
'mModuleGroup' => $this->values['mModuleGroup'],
'mAgents' => $this->values['mAgents'],
'mShowCommonModules' => $this->values['mShowCommonModules'],
'mModules' => $this->values['mModules'],
'mGroup' => (isset($this->values['mGroup']) === true) ? $this->values['mGroup'] : '',
'mRecursion' => (isset($this->values['mRecursion']) === true) ? $this->values['mRecursion'] : '',
'mModuleGroup' => (isset($this->values['mModuleGroup']) === true) ? $this->values['mModuleGroup'] : '',
'mAgents' => (isset($this->values['mAgents']) === true) ? $this->values['mAgents'] : '',
'mShowCommonModules' => (isset($this->values['mShowCommonModules']) === true) ? $this->values['mShowCommonModules'] : '',
'mModules' => (isset($this->values['mModules']) === true) ? $this->values['mModules'] : '',
'mShowSelectedOtherGroups' => true,
'mReturnAllGroup' => $return_all_group,
'mMetaFields' => ((bool) is_metaconsole()),
@ -852,4 +852,20 @@ class AgentModuleWidget extends Widget
}
/**
* Get size Modal Configuration.
*
* @return array
*/
public function getSizeModalConfiguration(): array
{
$size = [
'width' => 800,
'height' => 600,
];
return $size;
}
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -378,7 +378,7 @@ class ModuleValueWidget extends Widget
{
global $config;
$output .= '';
$output = '';
$id_agent = $this->values['agentId'];
$id_group = agents_get_agent_group($id_agent);
@ -445,4 +445,20 @@ class ModuleValueWidget extends Widget
}
/**
* Get size Modal Configuration.
*
* @return array
*/
public function getSizeModalConfiguration(): array
{
$size = [
'width' => 450,
'height' => 500,
];
return $size;
}
}

View File

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

View File

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

View File

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

View File

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

View File

@ -254,6 +254,9 @@ class ServiceMapWidget extends Widget
$inputs = parent::getFormInputs();
$services_res = services_get_services();
if ($services_res === false) {
$services_res = [];
}
// If currently selected report is not included in fields array (it belongs to a group over which user has no permissions), then add it to fields array.
// This is aimed to avoid overriding this value when a user with narrower permissions edits widget configuration.
@ -341,6 +344,8 @@ class ServiceMapWidget extends Widget
$size = parent::getSize();
$output = '';
if (check_acl($config['id_user'], 0, 'AR') === 0) {
$output .= '<div class="container-center">';
$output .= \ui_print_error_message(
@ -461,4 +466,20 @@ class ServiceMapWidget extends Widget
}
/**
* Get size Modal Configuration.
*
* @return array
*/
public function getSizeModalConfiguration(): array
{
$size = [
'width' => 400,
'height' => 300,
];
return $size;
}
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -176,7 +176,7 @@ class WuxWidget extends Widget
// Must be configured before using.
$this->configurationRequired = false;
if (empty($this->options) === true) {
$this->configuration_required = true;
$this->configurationRequired = true;
}
$this->overflow_scrollbars = false;
@ -430,4 +430,20 @@ class WuxWidget extends Widget
}
/**
* Get size Modal Configuration.
*
* @return array
*/
public function getSizeModalConfiguration(): array
{
$size = [
'width' => 450,
'height' => 360,
];
return $size;
}
}

View File

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