mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-30 17:25:26 +02:00
Merge remote-tracking branch 'origin/develop' into ent-7074-Command-Center
This commit is contained in:
commit
074fbf916c
@ -24,4 +24,6 @@ UPDATE `tuser_task_scheduled` SET
|
|||||||
`args`= REPLACE(`args`, 's:15:"first_execution"', 'i:2;s:0:"";i:7;s:3:"PDF";s:15:"first_execution"')
|
`args`= REPLACE(`args`, 's:15:"first_execution"', 'i:2;s:0:"";i:7;s:3:"PDF";s:15:"first_execution"')
|
||||||
WHERE `id_user_task` = 2;
|
WHERE `id_user_task` = 2;
|
||||||
|
|
||||||
|
ALTER TABLE `tlayout` ADD COLUMN `auto_adjust` INTEGER UNSIGNED NOT NULL default 0;
|
||||||
|
|
||||||
COMMIT;
|
COMMIT;
|
||||||
|
@ -1665,6 +1665,8 @@ UPDATE tlayout SET is_favourite = 1 WHERE name REGEXP '^(' OR name REGEXP '^
|
|||||||
|
|
||||||
ALTER TABLE `tlayout` MODIFY COLUMN `is_favourite` int(10) unsigned NOT NULL DEFAULT '0';
|
ALTER TABLE `tlayout` MODIFY COLUMN `is_favourite` int(10) unsigned NOT NULL DEFAULT '0';
|
||||||
|
|
||||||
|
ALTER TABLE `tlayout` ADD COLUMN `auto_adjust` INTEGER UNSIGNED NOT NULL default 0;
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- Table `tlayout_data`
|
-- Table `tlayout_data`
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
|
@ -222,6 +222,9 @@ $table->data[5][1] .= '<span class="opt" style="visibility:hidden;">
|
|||||||
$table->data[6][0] = __('Favourite visual console');
|
$table->data[6][0] = __('Favourite visual console');
|
||||||
$table->data[6][1] = html_print_checkbox('is_favourite', 0, $is_favourite, true);
|
$table->data[6][1] = html_print_checkbox('is_favourite', 0, $is_favourite, true);
|
||||||
|
|
||||||
|
$table->data[7][0] = __('Auto adjust to screen in fullscreen');
|
||||||
|
$table->data[7][1] = html_print_checkbox('auto_adjust', 0, $auto_adjust, true);
|
||||||
|
|
||||||
if ($action == 'new') {
|
if ($action == 'new') {
|
||||||
$textButtonSubmit = __('Save');
|
$textButtonSubmit = __('Save');
|
||||||
$classButtonSubmit = 'sub wand';
|
$classButtonSubmit = 'sub wand';
|
||||||
@ -426,6 +429,22 @@ $(document).ready (function () {
|
|||||||
$("#hidden-is_favourite_sent").val(0);
|
$("#hidden-is_favourite_sent").val(0);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if($("#checkbox-auto_adjust").is(":checked")) {
|
||||||
|
$("#hidden-auto_adjust_sent").val(1);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$("#hidden-auto_adjust_sent").val(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
$("#checkbox-auto_adjust").change(function(){
|
||||||
|
if($(this).is(":checked")) {
|
||||||
|
$("#hidden-auto_adjust_sent").val(1);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$("#hidden-auto_adjust_sent").val(0);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
function metaconsole_url() {
|
function metaconsole_url() {
|
||||||
metaconsole = $("input[name='metaconsole_activated']").val();
|
metaconsole = $("input[name='metaconsole_activated']").val();
|
||||||
|
@ -151,6 +151,7 @@ switch ($activeTab) {
|
|||||||
$height = '';
|
$height = '';
|
||||||
$visualConsoleName = '';
|
$visualConsoleName = '';
|
||||||
$is_favourite = 0;
|
$is_favourite = 0;
|
||||||
|
$auto_adjust = 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'update':
|
case 'update':
|
||||||
@ -162,6 +163,7 @@ switch ($activeTab) {
|
|||||||
$height = (int) get_parameter('height');
|
$height = (int) get_parameter('height');
|
||||||
$visualConsoleName = (string) get_parameter('name');
|
$visualConsoleName = (string) get_parameter('name');
|
||||||
$is_favourite = (int) get_parameter('is_favourite_sent');
|
$is_favourite = (int) get_parameter('is_favourite_sent');
|
||||||
|
$auto_adjust = (int) get_parameter('auto_adjust_sent');
|
||||||
|
|
||||||
// ACL for the new visual console
|
// ACL for the new visual console
|
||||||
// $vconsole_read_new = check_acl ($config['id_user'], $idGroup, "VR");
|
// $vconsole_read_new = check_acl ($config['id_user'], $idGroup, "VR");
|
||||||
@ -186,6 +188,7 @@ switch ($activeTab) {
|
|||||||
'width' => $width,
|
'width' => $width,
|
||||||
'height' => $height,
|
'height' => $height,
|
||||||
'is_favourite' => $is_favourite,
|
'is_favourite' => $is_favourite,
|
||||||
|
'auto_adjust' => $auto_adjust,
|
||||||
];
|
];
|
||||||
|
|
||||||
$error = $_FILES['background_image']['error'];
|
$error = $_FILES['background_image']['error'];
|
||||||
@ -353,6 +356,7 @@ switch ($activeTab) {
|
|||||||
$width = $visualConsole['width'];
|
$width = $visualConsole['width'];
|
||||||
$height = $visualConsole['height'];
|
$height = $visualConsole['height'];
|
||||||
$is_favourite = $visualConsole['is_favourite'];
|
$is_favourite = $visualConsole['is_favourite'];
|
||||||
|
$auto_adjust = $visualConsole['auto_adjust'];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -254,8 +254,7 @@ Licensed under the MIT license.
|
|||||||
left: 0,
|
left: 0,
|
||||||
bottom: 0,
|
bottom: 0,
|
||||||
right: 0,
|
right: 0,
|
||||||
'font-size': "smaller",
|
'font-size': "smaller"
|
||||||
color: "#545454"
|
|
||||||
})
|
})
|
||||||
.insertAfter(this.element);
|
.insertAfter(this.element);
|
||||||
}
|
}
|
||||||
|
File diff suppressed because one or more lines are too long
@ -806,11 +806,7 @@ function pandoraFlotSlicebar(
|
|||||||
tickFormatter: xFormatter,
|
tickFormatter: xFormatter,
|
||||||
color: "",
|
color: "",
|
||||||
tickSize: intervaltick,
|
tickSize: intervaltick,
|
||||||
tickLength: 0,
|
tickLength: 0
|
||||||
font: {
|
|
||||||
size: font_size + 2,
|
|
||||||
family: font
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
yaxes: [
|
yaxes: [
|
||||||
@ -834,6 +830,10 @@ function pandoraFlotSlicebar(
|
|||||||
|
|
||||||
$.plot($("#" + graph_id), datas, options);
|
$.plot($("#" + graph_id), datas, options);
|
||||||
|
|
||||||
|
// Added for correct handle of the font size.
|
||||||
|
// xaxes-yaxes object not handle font-size properly.
|
||||||
|
$(".flot-x-axis .flot-tick-label").css("font-size", font_size);
|
||||||
|
|
||||||
if (match == null && not_interactive == 0) {
|
if (match == null && not_interactive == 0) {
|
||||||
// Events
|
// Events
|
||||||
$("#" + graph_id).bind("plothover", function(event, pos, item) {
|
$("#" + graph_id).bind("plothover", function(event, pos, item) {
|
||||||
|
@ -778,7 +778,7 @@ function flot_slicesbar_graph(
|
|||||||
|
|
||||||
$datacolor = [];
|
$datacolor = [];
|
||||||
|
|
||||||
$fontsize = $config['font_size'];
|
$fontsize = ((int) $config['font_size'] + 2);
|
||||||
$fontpath = $config['fontpath'];
|
$fontpath = $config['fontpath'];
|
||||||
|
|
||||||
$return .= '<div id="extra_'.$graph_id.'" class="slicebar-box-hover-styles invisible" style="font-size:'.$fontsize.'"></div>';
|
$return .= '<div id="extra_'.$graph_id.'" class="slicebar-box-hover-styles invisible" style="font-size:'.$fontsize.'"></div>';
|
||||||
|
@ -737,6 +737,13 @@ function loadVisualConsoleData(baseUrl, vcId, size, id_user, hash, callback) {
|
|||||||
)
|
)
|
||||||
.done(handleSuccess("props"))
|
.done(handleSuccess("props"))
|
||||||
.fail(handleFail);
|
.fail(handleFail);
|
||||||
|
|
||||||
|
var queryString = new URLSearchParams(window.location.search);
|
||||||
|
var widthScreen = 0;
|
||||||
|
if (queryString.get("width")) {
|
||||||
|
widthScreen = document.body.offsetWidth;
|
||||||
|
}
|
||||||
|
|
||||||
// Visual Console items request.
|
// Visual Console items request.
|
||||||
itemsJqXHR = jQuery
|
itemsJqXHR = jQuery
|
||||||
// .get(apiPath + "/visual-consoles/" + vcId + "/items", null, "json")
|
// .get(apiPath + "/visual-consoles/" + vcId + "/items", null, "json")
|
||||||
@ -748,7 +755,8 @@ function loadVisualConsoleData(baseUrl, vcId, size, id_user, hash, callback) {
|
|||||||
size: size,
|
size: size,
|
||||||
visualConsoleId: vcId,
|
visualConsoleId: vcId,
|
||||||
id_user: typeof id_user == undefined ? id_user : null,
|
id_user: typeof id_user == undefined ? id_user : null,
|
||||||
auth_hash: typeof hash == undefined ? hash : null
|
auth_hash: typeof hash == undefined ? hash : null,
|
||||||
|
widthScreen: widthScreen
|
||||||
},
|
},
|
||||||
"json"
|
"json"
|
||||||
)
|
)
|
||||||
|
@ -86,6 +86,8 @@ if ($getVisualConsole === true) {
|
|||||||
|
|
||||||
$size = get_parameter('size', []);
|
$size = get_parameter('size', []);
|
||||||
|
|
||||||
|
$width = get_parameter('widthScreen', 0);
|
||||||
|
|
||||||
$ratio = 0;
|
$ratio = 0;
|
||||||
if (isset($size) === true
|
if (isset($size) === true
|
||||||
&& is_array($size) === true
|
&& is_array($size) === true
|
||||||
@ -107,10 +109,16 @@ if ($getVisualConsole === true) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$widthRatio = 0;
|
||||||
|
if ($visualConsoleData['autoAdjust'] === true && $width > 0) {
|
||||||
|
$widthRatio = ($width / $visualConsoleData['width']);
|
||||||
|
}
|
||||||
|
|
||||||
$vcItems = VisualConsole::getItemsFromDB(
|
$vcItems = VisualConsole::getItemsFromDB(
|
||||||
$visualConsoleId,
|
$visualConsoleId,
|
||||||
$aclUserGroups,
|
$aclUserGroups,
|
||||||
$ratio
|
$ratio,
|
||||||
|
$widthRatio
|
||||||
);
|
);
|
||||||
|
|
||||||
echo '['.implode(',', $vcItems).']';
|
echo '['.implode(',', $vcItems).']';
|
||||||
|
@ -72,17 +72,17 @@ abstract class CachedModel extends Model
|
|||||||
*
|
*
|
||||||
* @overrides Model::fromDB.
|
* @overrides Model::fromDB.
|
||||||
*/
|
*/
|
||||||
public static function fromDB(array $filter, ?float $ratio=0): Model
|
public static function fromDB(array $filter, ?float $ratio=0, ?float $widthRatio=0): Model
|
||||||
{
|
{
|
||||||
global $config;
|
global $config;
|
||||||
$save_cache = false;
|
$save_cache = false;
|
||||||
if ($ratio == 0 && $filter['cache_expiration'] > 0) {
|
if ($ratio == 0 && $filter['cache_expiration'] > 0 && $widthRatio == 0) {
|
||||||
$data = static::fetchCachedData($filter);
|
$data = static::fetchCachedData($filter);
|
||||||
$save_cache = true;
|
$save_cache = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($data) === false) {
|
if (isset($data) === false) {
|
||||||
$data = static::fetchDataFromDB($filter, $ratio);
|
$data = static::fetchDataFromDB($filter, $ratio, $widthRatio);
|
||||||
} else {
|
} else {
|
||||||
// Retrieved from cache.
|
// Retrieved from cache.
|
||||||
$save_cache = false;
|
$save_cache = false;
|
||||||
|
@ -130,7 +130,8 @@ abstract class Model
|
|||||||
*/
|
*/
|
||||||
abstract protected static function fetchDataFromDB(
|
abstract protected static function fetchDataFromDB(
|
||||||
array $filter,
|
array $filter,
|
||||||
?float $ratio=0
|
?float $ratio=0,
|
||||||
|
?float $widthRatio=0
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -141,10 +142,10 @@ abstract class Model
|
|||||||
*
|
*
|
||||||
* @return self A modeled element's instance.
|
* @return self A modeled element's instance.
|
||||||
*/
|
*/
|
||||||
public static function fromDB(array $filter, ?float $ratio=0): self
|
public static function fromDB(array $filter, ?float $ratio=0, ?float $widthRatio=0): self
|
||||||
{
|
{
|
||||||
// The reserved word static refers to the invoked class at runtime.
|
// The reserved word static refers to the invoked class at runtime.
|
||||||
return static::fromArray(static::fetchDataFromDB($filter, $ratio));
|
return static::fromArray(static::fetchDataFromDB($filter, $ratio, $widthRatio));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -84,6 +84,7 @@ final class Container extends Model
|
|||||||
'backgroundImage' => static::extractBackgroundImage($data),
|
'backgroundImage' => static::extractBackgroundImage($data),
|
||||||
'backgroundColor' => static::extractBackgroundColor($data),
|
'backgroundColor' => static::extractBackgroundColor($data),
|
||||||
'isFavorite' => static::extractFavorite($data),
|
'isFavorite' => static::extractFavorite($data),
|
||||||
|
'autoAdjust' => static::extractAutoAdjust($data),
|
||||||
'width' => (int) $data['width'],
|
'width' => (int) $data['width'],
|
||||||
'height' => (int) $data['height'],
|
'height' => (int) $data['height'],
|
||||||
'backgroundURL' => static::extractBackgroundUrl($data),
|
'backgroundURL' => static::extractBackgroundUrl($data),
|
||||||
@ -252,6 +253,21 @@ final class Container extends Model
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Extract the "auto adjust" switch value.
|
||||||
|
*
|
||||||
|
* @param array $data Unknown input data structure.
|
||||||
|
*
|
||||||
|
* @return boolean If the item is favorite or not.
|
||||||
|
*/
|
||||||
|
private static function extractAutoAdjust(array $data): bool
|
||||||
|
{
|
||||||
|
return static::parseBool(
|
||||||
|
static::issetInArray($data, ['auto_adjust', 'autoAdjust'])
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Obtain a container data structure from the database using a filter.
|
* Obtain a container data structure from the database using a filter.
|
||||||
*
|
*
|
||||||
@ -264,7 +280,8 @@ final class Container extends Model
|
|||||||
*/
|
*/
|
||||||
protected static function fetchDataFromDB(
|
protected static function fetchDataFromDB(
|
||||||
array $filter,
|
array $filter,
|
||||||
?float $ratio=0
|
?float $ratio=0,
|
||||||
|
?float $widthRatio=0
|
||||||
) {
|
) {
|
||||||
// Due to this DB call, this function cannot be unit tested without
|
// Due to this DB call, this function cannot be unit tested without
|
||||||
// a proper mock.
|
// a proper mock.
|
||||||
@ -387,7 +404,8 @@ final class Container extends Model
|
|||||||
public static function getItemsFromDB(
|
public static function getItemsFromDB(
|
||||||
int $layoutId,
|
int $layoutId,
|
||||||
array $groupsFilter=[],
|
array $groupsFilter=[],
|
||||||
?float $ratio=0
|
?float $ratio=0,
|
||||||
|
?float $widthRatio=0
|
||||||
): array {
|
): array {
|
||||||
// Default filter.
|
// Default filter.
|
||||||
$filter = ['id_layout' => $layoutId];
|
$filter = ['id_layout' => $layoutId];
|
||||||
@ -438,7 +456,7 @@ final class Container extends Model
|
|||||||
$class = static::getItemClass((int) $data['type']);
|
$class = static::getItemClass((int) $data['type']);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
array_push($items, $class::fromDB($data, $ratio));
|
array_push($items, $class::fromDB($data, $ratio, $widthRatio));
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
error_log('VC[Container]: '.$e->getMessage());
|
error_log('VC[Container]: '.$e->getMessage());
|
||||||
}
|
}
|
||||||
|
@ -765,7 +765,8 @@ class Item extends CachedModel
|
|||||||
*/
|
*/
|
||||||
protected static function fetchDataFromDB(
|
protected static function fetchDataFromDB(
|
||||||
array $filter,
|
array $filter,
|
||||||
?float $ratio=0
|
?float $ratio=0,
|
||||||
|
?float $widthRatio=0
|
||||||
): array {
|
): array {
|
||||||
// Load side libraries.
|
// Load side libraries.
|
||||||
global $config;
|
global $config;
|
||||||
@ -805,6 +806,11 @@ class Item extends CachedModel
|
|||||||
$row['pos_y'] = ($row['pos_y'] * $ratio);
|
$row['pos_y'] = ($row['pos_y'] * $ratio);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($widthRatio != 0) {
|
||||||
|
$row['width'] = ($row['width'] * $widthRatio);
|
||||||
|
$row['pos_x'] = ($row['pos_x'] * $widthRatio);
|
||||||
|
}
|
||||||
|
|
||||||
return $row;
|
return $row;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1770,6 +1776,7 @@ class Item extends CachedModel
|
|||||||
'gridColor',
|
'gridColor',
|
||||||
'color',
|
'color',
|
||||||
'legendBackgroundColor',
|
'legendBackgroundColor',
|
||||||
|
'legendColor',
|
||||||
]
|
]
|
||||||
),
|
),
|
||||||
null
|
null
|
||||||
|
@ -192,11 +192,12 @@ final class BarsGraph extends Item
|
|||||||
*/
|
*/
|
||||||
protected static function fetchDataFromDB(
|
protected static function fetchDataFromDB(
|
||||||
array $filter,
|
array $filter,
|
||||||
?float $ratio=0
|
?float $ratio=0,
|
||||||
|
?float $widthRatio=0
|
||||||
): array {
|
): array {
|
||||||
// Due to this DB call, this function cannot be unit tested without
|
// Due to this DB call, this function cannot be unit tested without
|
||||||
// a proper mock.
|
// a proper mock.
|
||||||
$data = parent::fetchDataFromDB($filter, $ratio);
|
$data = parent::fetchDataFromDB($filter, $ratio, $widthRatio);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Retrieve extra data.
|
* Retrieve extra data.
|
||||||
|
@ -419,11 +419,12 @@ final class Clock extends Item
|
|||||||
*/
|
*/
|
||||||
protected static function fetchDataFromDB(
|
protected static function fetchDataFromDB(
|
||||||
array $filter,
|
array $filter,
|
||||||
?float $ratio=0
|
?float $ratio=0,
|
||||||
|
?float $widthRatio=0
|
||||||
): array {
|
): array {
|
||||||
// Due to this DB call, this function cannot be unit tested without
|
// Due to this DB call, this function cannot be unit tested without
|
||||||
// a proper mock.
|
// a proper mock.
|
||||||
$data = parent::fetchDataFromDB($filter, $ratio);
|
$data = parent::fetchDataFromDB($filter, $ratio, $widthRatio);
|
||||||
|
|
||||||
// Default values.
|
// Default values.
|
||||||
if ((int) $data['width'] === 0) {
|
if ((int) $data['width'] === 0) {
|
||||||
|
@ -280,11 +280,12 @@ final class ColorCloud extends Item
|
|||||||
*/
|
*/
|
||||||
protected static function fetchDataFromDB(
|
protected static function fetchDataFromDB(
|
||||||
array $filter,
|
array $filter,
|
||||||
?float $ratio=0
|
?float $ratio=0,
|
||||||
|
?float $widthRatio=0
|
||||||
): array {
|
): array {
|
||||||
// Due to this DB call, this function cannot be unit tested without
|
// Due to this DB call, this function cannot be unit tested without
|
||||||
// a proper mock.
|
// a proper mock.
|
||||||
$data = parent::fetchDataFromDB($filter, $ratio);
|
$data = parent::fetchDataFromDB($filter, $ratio, $widthRatio);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Retrieve extra data.
|
* Retrieve extra data.
|
||||||
|
@ -89,11 +89,12 @@ final class DonutGraph extends Item
|
|||||||
*/
|
*/
|
||||||
protected static function fetchDataFromDB(
|
protected static function fetchDataFromDB(
|
||||||
array $filter,
|
array $filter,
|
||||||
?float $ratio=0
|
?float $ratio=0,
|
||||||
|
?float $widthRatio=0
|
||||||
): array {
|
): array {
|
||||||
// Due to this DB call, this function cannot be unit tested without
|
// Due to this DB call, this function cannot be unit tested without
|
||||||
// a proper mock.
|
// a proper mock.
|
||||||
$data = parent::fetchDataFromDB($filter, $ratio);
|
$data = parent::fetchDataFromDB($filter, $ratio, $widthRatio);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Retrieve extra data.
|
* Retrieve extra data.
|
||||||
|
@ -49,6 +49,7 @@ final class EventsHistory extends Item
|
|||||||
$return = parent::decode($data);
|
$return = parent::decode($data);
|
||||||
$return['type'] = AUTO_SLA_GRAPH;
|
$return['type'] = AUTO_SLA_GRAPH;
|
||||||
$return['maxTime'] = static::extractMaxTime($data);
|
$return['maxTime'] = static::extractMaxTime($data);
|
||||||
|
$return['legendColor'] = $this->extractLegendColor($data);
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -69,6 +70,22 @@ final class EventsHistory extends Item
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Extract legend color value.
|
||||||
|
*
|
||||||
|
* @param array $data Unknown input data structure.
|
||||||
|
*
|
||||||
|
* @return mixed String representing the grid color (not empty) or null.
|
||||||
|
*/
|
||||||
|
private function extractLegendColor(array $data): string
|
||||||
|
{
|
||||||
|
return static::notEmptyStringOr(
|
||||||
|
static::issetInArray($data, ['legendColor', 'border_color']),
|
||||||
|
'#000000'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fetch a vc item data structure from the database using a filter.
|
* Fetch a vc item data structure from the database using a filter.
|
||||||
*
|
*
|
||||||
@ -82,11 +99,12 @@ final class EventsHistory extends Item
|
|||||||
*/
|
*/
|
||||||
protected static function fetchDataFromDB(
|
protected static function fetchDataFromDB(
|
||||||
array $filter,
|
array $filter,
|
||||||
?float $ratio=0
|
?float $ratio=0,
|
||||||
|
?float $widthRatio=0
|
||||||
): array {
|
): array {
|
||||||
// Due to this DB call, this function cannot be unit tested without
|
// Due to this DB call, this function cannot be unit tested without
|
||||||
// a proper mock.
|
// a proper mock.
|
||||||
$data = parent::fetchDataFromDB($filter, $ratio);
|
$data = parent::fetchDataFromDB($filter, $ratio, $widthRatio);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Retrieve extra data.
|
* Retrieve extra data.
|
||||||
@ -100,6 +118,7 @@ final class EventsHistory extends Item
|
|||||||
$linkedModule = static::extractLinkedModule($data);
|
$linkedModule = static::extractLinkedModule($data);
|
||||||
$agentId = static::parseIntOr($linkedModule['agentId'], null);
|
$agentId = static::parseIntOr($linkedModule['agentId'], null);
|
||||||
$moduleId = static::parseIntOr($linkedModule['moduleId'], null);
|
$moduleId = static::parseIntOr($linkedModule['moduleId'], null);
|
||||||
|
$legendColor = static::extractLegendColor($data);
|
||||||
|
|
||||||
if ($agentId === null) {
|
if ($agentId === null) {
|
||||||
throw new \InvalidArgumentException('missing agent Id');
|
throw new \InvalidArgumentException('missing agent Id');
|
||||||
@ -267,6 +286,18 @@ final class EventsHistory extends Item
|
|||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
|
// Legend color.
|
||||||
|
$inputs[] = [
|
||||||
|
'label' => __('Legend color'),
|
||||||
|
'arguments' => [
|
||||||
|
'wrapper' => 'div',
|
||||||
|
'name' => 'legendColor',
|
||||||
|
'type' => 'color',
|
||||||
|
'value' => $values['legendColor'],
|
||||||
|
'return' => true,
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
// Inputs LinkedVisualConsole.
|
// Inputs LinkedVisualConsole.
|
||||||
$inputsLinkedVisualConsole = self::inputsLinkedVisualConsole(
|
$inputsLinkedVisualConsole = self::inputsLinkedVisualConsole(
|
||||||
$values
|
$values
|
||||||
|
@ -204,11 +204,12 @@ final class Group extends Item
|
|||||||
*/
|
*/
|
||||||
protected static function fetchDataFromDB(
|
protected static function fetchDataFromDB(
|
||||||
array $filter,
|
array $filter,
|
||||||
?float $ratio=0
|
?float $ratio=0,
|
||||||
|
?float $widthRatio=0
|
||||||
): array {
|
): array {
|
||||||
// Due to this DB call, this function cannot be unit tested without
|
// Due to this DB call, this function cannot be unit tested without
|
||||||
// a proper mock.
|
// a proper mock.
|
||||||
$data = parent::fetchDataFromDB($filter, $ratio);
|
$data = parent::fetchDataFromDB($filter, $ratio, $widthRatio);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Retrieve extra data.
|
* Retrieve extra data.
|
||||||
|
@ -98,11 +98,12 @@ final class Icon extends Item
|
|||||||
*/
|
*/
|
||||||
protected static function fetchDataFromDB(
|
protected static function fetchDataFromDB(
|
||||||
array $filter,
|
array $filter,
|
||||||
?float $ratio=0
|
?float $ratio=0,
|
||||||
|
?float $widthRatio=0
|
||||||
): array {
|
): array {
|
||||||
// Due to this DB call, this function cannot be unit tested without
|
// Due to this DB call, this function cannot be unit tested without
|
||||||
// a proper mock.
|
// a proper mock.
|
||||||
$data = parent::fetchDataFromDB($filter, $ratio);
|
$data = parent::fetchDataFromDB($filter, $ratio, $widthRatio);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Retrieve extra data.
|
* Retrieve extra data.
|
||||||
|
@ -194,7 +194,8 @@ final class Line extends Model
|
|||||||
*/
|
*/
|
||||||
protected static function fetchDataFromDB(
|
protected static function fetchDataFromDB(
|
||||||
array $filter,
|
array $filter,
|
||||||
?float $ratio=0
|
?float $ratio=0,
|
||||||
|
?float $widthRatio=0
|
||||||
): array {
|
): array {
|
||||||
// Due to this DB call, this function cannot be unit tested without
|
// Due to this DB call, this function cannot be unit tested without
|
||||||
// a proper mock.
|
// a proper mock.
|
||||||
@ -211,6 +212,11 @@ final class Line extends Model
|
|||||||
$row['pos_y'] = ($row['pos_y'] * $ratio);
|
$row['pos_y'] = ($row['pos_y'] * $ratio);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($widthRatio != 0) {
|
||||||
|
$row['width'] = ($row['width'] * $widthRatio);
|
||||||
|
$row['pos_x'] = ($row['pos_x'] * $widthRatio);
|
||||||
|
}
|
||||||
|
|
||||||
return $row;
|
return $row;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -266,11 +266,12 @@ final class ModuleGraph extends Item
|
|||||||
*/
|
*/
|
||||||
protected static function fetchDataFromDB(
|
protected static function fetchDataFromDB(
|
||||||
array $filter,
|
array $filter,
|
||||||
?float $ratio=0
|
?float $ratio=0,
|
||||||
|
?float $widthRatio=0
|
||||||
): array {
|
): array {
|
||||||
// Due to this DB call, this function cannot be unit tested without
|
// Due to this DB call, this function cannot be unit tested without
|
||||||
// a proper mock.
|
// a proper mock.
|
||||||
$data = parent::fetchDataFromDB($filter, $ratio);
|
$data = parent::fetchDataFromDB($filter, $ratio, $widthRatio);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Retrieve extra data.
|
* Retrieve extra data.
|
||||||
|
@ -359,7 +359,8 @@ final class NetworkLink extends Model
|
|||||||
*/
|
*/
|
||||||
protected static function fetchDataFromDB(
|
protected static function fetchDataFromDB(
|
||||||
array $filter,
|
array $filter,
|
||||||
?float $ratio=0
|
?float $ratio=0,
|
||||||
|
?float $widthRatio=0
|
||||||
): array {
|
): array {
|
||||||
// Due to this DB call, this function cannot be unit tested without
|
// Due to this DB call, this function cannot be unit tested without
|
||||||
// a proper mock.
|
// a proper mock.
|
||||||
@ -376,6 +377,11 @@ final class NetworkLink extends Model
|
|||||||
$row['pos_y'] = ($row['pos_y'] * $ratio);
|
$row['pos_y'] = ($row['pos_y'] * $ratio);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($widthRatio != 0) {
|
||||||
|
$row['width'] = ($row['width'] * $widthRatio);
|
||||||
|
$row['pos_x'] = ($row['pos_x'] * $widthRatio);
|
||||||
|
}
|
||||||
|
|
||||||
$row['label'] = static::buildLabels($row);
|
$row['label'] = static::buildLabels($row);
|
||||||
|
|
||||||
return $row;
|
return $row;
|
||||||
|
@ -330,11 +330,12 @@ final class Percentile extends Item
|
|||||||
*/
|
*/
|
||||||
protected static function fetchDataFromDB(
|
protected static function fetchDataFromDB(
|
||||||
array $filter,
|
array $filter,
|
||||||
?float $ratio=0
|
?float $ratio=0,
|
||||||
|
?float $widthRatio=0
|
||||||
): array {
|
): array {
|
||||||
// Due to this DB call, this function cannot be unit tested without
|
// Due to this DB call, this function cannot be unit tested without
|
||||||
// a proper mock.
|
// a proper mock.
|
||||||
$data = parent::fetchDataFromDB($filter, $ratio);
|
$data = parent::fetchDataFromDB($filter, $ratio, $widthRatio);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Retrieve extra data.
|
* Retrieve extra data.
|
||||||
|
@ -230,11 +230,12 @@ final class SimpleValue extends Item
|
|||||||
*/
|
*/
|
||||||
protected static function fetchDataFromDB(
|
protected static function fetchDataFromDB(
|
||||||
array $filter,
|
array $filter,
|
||||||
?float $ratio=0
|
?float $ratio=0,
|
||||||
|
?float $widthRatio=0
|
||||||
): array {
|
): array {
|
||||||
// Due to this DB call, this function cannot be unit tested without
|
// Due to this DB call, this function cannot be unit tested without
|
||||||
// a proper mock.
|
// a proper mock.
|
||||||
$data = parent::fetchDataFromDB($filter, $ratio);
|
$data = parent::fetchDataFromDB($filter, $ratio, $widthRatio);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Retrieve extra data.
|
* Retrieve extra data.
|
||||||
|
@ -143,11 +143,12 @@ final class StaticGraph extends Item
|
|||||||
*/
|
*/
|
||||||
protected static function fetchDataFromDB(
|
protected static function fetchDataFromDB(
|
||||||
array $filter,
|
array $filter,
|
||||||
?float $ratio=0
|
?float $ratio=0,
|
||||||
|
?float $widthRatio=0
|
||||||
): array {
|
): array {
|
||||||
// Due to this DB call, this function cannot be unit tested without
|
// Due to this DB call, this function cannot be unit tested without
|
||||||
// a proper mock.
|
// a proper mock.
|
||||||
$data = parent::fetchDataFromDB($filter, $ratio);
|
$data = parent::fetchDataFromDB($filter, $ratio, $widthRatio);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Retrieve extra data.
|
* Retrieve extra data.
|
||||||
|
@ -434,6 +434,7 @@ class View extends \HTML
|
|||||||
$data['agentAlias'] = \get_parameter('agentAlias');
|
$data['agentAlias'] = \get_parameter('agentAlias');
|
||||||
$data['moduleId'] = \get_parameter('moduleId');
|
$data['moduleId'] = \get_parameter('moduleId');
|
||||||
$data['maxTime'] = \get_parameter('maxTime');
|
$data['maxTime'] = \get_parameter('maxTime');
|
||||||
|
$data['legendColor'] = \get_parameter('legendColor');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DONUT_GRAPH:
|
case DONUT_GRAPH:
|
||||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -77,6 +77,9 @@ $pure = (bool) get_parameter('pure', $config['pure']);
|
|||||||
// Refresh interval in seconds.
|
// Refresh interval in seconds.
|
||||||
$refr = (int) get_parameter('refr', $config['vc_refr']);
|
$refr = (int) get_parameter('refr', $config['vc_refr']);
|
||||||
|
|
||||||
|
$width = (int) get_parameter('width', 0);
|
||||||
|
$height = (int) get_parameter('height', 0);
|
||||||
|
|
||||||
// Load Visual Console.
|
// Load Visual Console.
|
||||||
use Models\VisualConsole\Container as VisualConsole;
|
use Models\VisualConsole\Container as VisualConsole;
|
||||||
$visualConsole = null;
|
$visualConsole = null;
|
||||||
@ -200,7 +203,7 @@ $options['view']['active'] = true;
|
|||||||
|
|
||||||
if (is_metaconsole() === false) {
|
if (is_metaconsole() === false) {
|
||||||
if (!$config['pure']) {
|
if (!$config['pure']) {
|
||||||
$options['pure']['text'] = '<a href="index.php?sec=network&sec2=operation/visual_console/render_view&id='.$visualConsoleId.'&pure=1&refr='.$refr.'">'.html_print_image(
|
$options['pure']['text'] = '<a id ="full_screen" href="index.php?sec=network&sec2=operation/visual_console/render_view&id='.$visualConsoleId.'&pure=1&refr='.$refr.'">'.html_print_image(
|
||||||
'images/full_screen.png',
|
'images/full_screen.png',
|
||||||
true,
|
true,
|
||||||
[
|
[
|
||||||
@ -489,11 +492,47 @@ ui_require_javascript_file('pandora_visual_console');
|
|||||||
include_javascript_d3();
|
include_javascript_d3();
|
||||||
visual_map_load_client_resources();
|
visual_map_load_client_resources();
|
||||||
|
|
||||||
|
$widthRatio = 0;
|
||||||
|
if ($width > 0 && $pure == 1) {
|
||||||
|
$widthRatio = ($width / $visualConsoleData['width']);
|
||||||
|
|
||||||
|
if ($visualConsoleData['width'] > $height) {
|
||||||
|
?>
|
||||||
|
<style type="text/css">
|
||||||
|
div#main_pure {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
div#visual-console-container {
|
||||||
|
width: 100% !important;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<?php
|
||||||
|
} else {
|
||||||
|
?>
|
||||||
|
<style type="text/css">
|
||||||
|
div#main_pure {
|
||||||
|
width: 100%;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
div#visual-console-container {
|
||||||
|
width: 100% !important;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Load Visual Console Items.
|
// Load Visual Console Items.
|
||||||
$visualConsoleItems = VisualConsole::getItemsFromDB(
|
$visualConsoleItems = VisualConsole::getItemsFromDB(
|
||||||
$visualConsoleId,
|
$visualConsoleId,
|
||||||
$aclUserGroups
|
$aclUserGroups,
|
||||||
|
0,
|
||||||
|
$widthRatio
|
||||||
);
|
);
|
||||||
|
|
||||||
ui_require_css_file('modal');
|
ui_require_css_file('modal');
|
||||||
ui_require_css_file('form');
|
ui_require_css_file('form');
|
||||||
?>
|
?>
|
||||||
@ -506,6 +545,7 @@ ui_require_css_file('form');
|
|||||||
var items = <?php echo '['.implode(',', $visualConsoleItems).']'; ?>;
|
var items = <?php echo '['.implode(',', $visualConsoleItems).']'; ?>;
|
||||||
var baseUrl = "<?php echo ui_get_full_url('/', false, false, false); ?>";
|
var baseUrl = "<?php echo ui_get_full_url('/', false, false, false); ?>";
|
||||||
var controls = document.getElementById('vc-controls');
|
var controls = document.getElementById('vc-controls');
|
||||||
|
|
||||||
autoHideElement(controls, 1000);
|
autoHideElement(controls, 1000);
|
||||||
var handleUpdate = function (prevProps, newProps) {
|
var handleUpdate = function (prevProps, newProps) {
|
||||||
if (!newProps) return;
|
if (!newProps) return;
|
||||||
@ -683,6 +723,19 @@ if ($edit_capable === true) {
|
|||||||
visualConsoleManager.createItem(type);
|
visualConsoleManager.createItem(type);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('#full_screen').click(function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
|
||||||
|
if (props.autoAdjust === true) {
|
||||||
|
var hrefAux = $('#full_screen').attr('href');
|
||||||
|
hrefAux += '&width=' + document.body.offsetWidth+'&height=' + screen.height;
|
||||||
|
$('#full_screen').attr('href', hrefAux);
|
||||||
|
}
|
||||||
|
|
||||||
|
window.location.href = $('#full_screen').attr('href');
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Process ajax responses and shows a dialog with results.
|
* Process ajax responses and shows a dialog with results.
|
||||||
*/
|
*/
|
||||||
|
@ -1626,6 +1626,7 @@ CREATE TABLE IF NOT EXISTS `tlayout` (
|
|||||||
`width` INTEGER UNSIGNED NOT NULL default 0,
|
`width` INTEGER UNSIGNED NOT NULL default 0,
|
||||||
`background_color` varchar(50) NOT NULL default '#FFF',
|
`background_color` varchar(50) NOT NULL default '#FFF',
|
||||||
`is_favourite` INTEGER UNSIGNED NOT NULL default 0,
|
`is_favourite` INTEGER UNSIGNED NOT NULL default 0,
|
||||||
|
`auto_adjust` INTEGER UNSIGNED NOT NULL default 0,
|
||||||
PRIMARY KEY(`id`)
|
PRIMARY KEY(`id`)
|
||||||
) ENGINE = InnoDB DEFAULT CHARSET=utf8;
|
) ENGINE = InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
|
@ -1334,18 +1334,18 @@ UPDATE `tnotification_source` SET `enabled`=1 WHERE `description` = 'System 
|
|||||||
--
|
--
|
||||||
INSERT INTO `tlayout`
|
INSERT INTO `tlayout`
|
||||||
VALUES
|
VALUES
|
||||||
(1, 'Demo visual console', 0, 'fondo.jpg', 1080, 1920, 'white', 0),
|
(1, 'Demo visual console', 0, 'fondo.jpg', 1080, 1920, 'white', 0, 0),
|
||||||
(2,'Demo visual console 2',0,'fondo-keep-alive.jpg',1080,1920,'#FFF',0),
|
(2,'Demo visual console 2',0,'fondo-keep-alive.jpg',1080,1920,'#FFF',0, 0),
|
||||||
(3,'Worldmap',0,'map_world.jpg',1080,1920,'white',0),
|
(3,'Worldmap',0,'map_world.jpg',1080,1920,'white',0, 0),
|
||||||
(4,'Europe',0,'map_europe_1.jpg',1080,1920,'white',0),
|
(4,'Europe',0,'map_europe_1.jpg',1080,1920,'white',0, 0),
|
||||||
(5,'USA',0,'map_USA.jpg',1080,1920,'white',0),
|
(5,'USA',0,'map_USA.jpg',1080,1920,'white',0, 0),
|
||||||
(6,'Spain',0,'map_spain.jpg',1080,1920,'white',0),
|
(6,'Spain',0,'map_spain.jpg',1080,1920,'white',0, 0),
|
||||||
(7,'Madrid',0,'map_madrid.jpg',1080,1920,'white',0),
|
(7,'Madrid',0,'map_madrid.jpg',1080,1920,'white',0, 0),
|
||||||
(8,'Germany',0,'map_germany_1.jpg',1080,1920,'white',0),
|
(8,'Germany',0,'map_germany_1.jpg',1080,1920,'white',0, 0),
|
||||||
(9,'France',0,'map_france.jpg',1080,1920,'white',0),
|
(9,'France',0,'map_france.jpg',1080,1920,'white',0, 0),
|
||||||
(10,'Catalonia',0,'map_catalonia.jpg',1080,1920,'white',0),
|
(10,'Catalonia',0,'map_catalonia.jpg',1080,1920,'white',0, 0),
|
||||||
(11,'Basque Country',0,'map_basque-country.jpg',1080,1920,'white',0),
|
(11,'Basque Country',0,'map_basque-country.jpg',1080,1920,'white',0, 0),
|
||||||
(12,'Andalusia',0,'map_andalusia.jpg',1080,1920,'white',0)
|
(12,'Andalusia',0,'map_andalusia.jpg',1080,1920,'white',0, 0)
|
||||||
;
|
;
|
||||||
|
|
||||||
--
|
--
|
||||||
|
@ -67,6 +67,18 @@ dbhost 127.0.0.1
|
|||||||
# Default value depends on the dbengine (mysql: 3306)
|
# Default value depends on the dbengine (mysql: 3306)
|
||||||
#dbport 3306
|
#dbport 3306
|
||||||
|
|
||||||
|
# dbssl: Enable (1) or disable (0) SSL for the database connection.
|
||||||
|
|
||||||
|
dbssl 0
|
||||||
|
|
||||||
|
# dbsslcafile: Path to a file in PEM format that contains a list of trusted SSL certificate authorities.
|
||||||
|
|
||||||
|
# dbsslcafile
|
||||||
|
|
||||||
|
# dbsslcapath: Path to a directory that contains trusted SSL certificate authority certificates in PEM format.
|
||||||
|
|
||||||
|
# dbsslcapath
|
||||||
|
|
||||||
# By default, parent agent will not be updated
|
# By default, parent agent will not be updated
|
||||||
|
|
||||||
#update_parent 0
|
#update_parent 0
|
||||||
|
@ -234,6 +234,9 @@ sub pandora_load_config {
|
|||||||
$pa_config->{"dbhost"} = "localhost";
|
$pa_config->{"dbhost"} = "localhost";
|
||||||
$pa_config->{'dbport'} = undef; # set to standard port of "dbengine" later
|
$pa_config->{'dbport'} = undef; # set to standard port of "dbengine" later
|
||||||
$pa_config->{"dbname"} = "pandora";
|
$pa_config->{"dbname"} = "pandora";
|
||||||
|
$pa_config->{"dbssl"} = 0;
|
||||||
|
$pa_config->{"dbsslcapath"} = "";
|
||||||
|
$pa_config->{"dbsslcafile"} = "";
|
||||||
$pa_config->{"basepath"} = $pa_config->{'pandora_path'}; # Compatibility with Pandora 1.1
|
$pa_config->{"basepath"} = $pa_config->{'pandora_path'}; # Compatibility with Pandora 1.1
|
||||||
$pa_config->{"incomingdir"} = "/var/spool/pandora/data_in";
|
$pa_config->{"incomingdir"} = "/var/spool/pandora/data_in";
|
||||||
$pa_config->{"user"} = "pandora"; # environment settings default user owner for files generated
|
$pa_config->{"user"} = "pandora"; # environment settings default user owner for files generated
|
||||||
@ -705,6 +708,15 @@ sub pandora_load_config {
|
|||||||
elsif ($parametro =~ m/^dbname\s(.*)/i) {
|
elsif ($parametro =~ m/^dbname\s(.*)/i) {
|
||||||
$pa_config->{'dbname'}= clean_blank($1);
|
$pa_config->{'dbname'}= clean_blank($1);
|
||||||
}
|
}
|
||||||
|
elsif ($parametro =~ m/^dbssl\s+([0-1])/i) {
|
||||||
|
$pa_config->{'dbssl'}= clean_blank($1);
|
||||||
|
}
|
||||||
|
elsif ($parametro =~ m/^dbsslcapath\s(.*)/i) {
|
||||||
|
$pa_config->{'dbsslcapath'}= clean_blank($1);
|
||||||
|
}
|
||||||
|
elsif ($parametro =~ m/^dbsslcafile\s(.*)/i) {
|
||||||
|
$pa_config->{'dbsslcafile'}= clean_blank($1);
|
||||||
|
}
|
||||||
elsif ($parametro =~ m/^dbuser\s(.*)/i) {
|
elsif ($parametro =~ m/^dbuser\s(.*)/i) {
|
||||||
$pa_config->{'dbuser'}= clean_blank($1);
|
$pa_config->{'dbuser'}= clean_blank($1);
|
||||||
}
|
}
|
||||||
@ -1283,6 +1295,9 @@ sub pandora_load_config {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Configure SSL.
|
||||||
|
set_ssl_opts($pa_config);
|
||||||
|
|
||||||
if (($pa_config->{"verbosity"} > 4) && ($pa_config->{"quiet"} == 0)){
|
if (($pa_config->{"verbosity"} > 4) && ($pa_config->{"quiet"} == 0)){
|
||||||
if ($pa_config->{"PID"} ne ""){
|
if ($pa_config->{"PID"} ne ""){
|
||||||
print " [*] PID File is written at ".$pa_config->{'PID'}."\n";
|
print " [*] PID File is written at ".$pa_config->{'PID'}."\n";
|
||||||
|
@ -110,6 +110,7 @@ our @EXPORT = qw(
|
|||||||
get_agentmodule_status
|
get_agentmodule_status
|
||||||
get_agentmodule_status_str
|
get_agentmodule_status_str
|
||||||
get_agentmodule_data
|
get_agentmodule_data
|
||||||
|
set_ssl_opts
|
||||||
$RDBMS
|
$RDBMS
|
||||||
$RDBMS_QUOTE
|
$RDBMS_QUOTE
|
||||||
$RDBMS_QUOTE_STRING
|
$RDBMS_QUOTE_STRING
|
||||||
@ -124,6 +125,9 @@ our $RDBMS_QUOTE = '';
|
|||||||
# For strings, Character used to quote in the current RDBMS
|
# For strings, Character used to quote in the current RDBMS
|
||||||
our $RDBMS_QUOTE_STRING = '';
|
our $RDBMS_QUOTE_STRING = '';
|
||||||
|
|
||||||
|
# SSL options.
|
||||||
|
my $SSL_OPTS = '';
|
||||||
|
|
||||||
##########################################################################
|
##########################################################################
|
||||||
## Connect to the DB.
|
## Connect to the DB.
|
||||||
##########################################################################
|
##########################################################################
|
||||||
@ -136,7 +140,7 @@ sub db_connect ($$$$$$) {
|
|||||||
$RDBMS_QUOTE_STRING = '"';
|
$RDBMS_QUOTE_STRING = '"';
|
||||||
|
|
||||||
# Connect to MySQL
|
# Connect to MySQL
|
||||||
my $dbh = DBI->connect("DBI:mysql:$db_name:$db_host:$db_port", $db_user, $db_pass, { RaiseError => 1, AutoCommit => 1 });
|
my $dbh = DBI->connect("DBI:mysql:$db_name:$db_host:$db_port;$SSL_OPTS", $db_user, $db_pass, { RaiseError => 1, AutoCommit => 1 });
|
||||||
return undef unless defined ($dbh);
|
return undef unless defined ($dbh);
|
||||||
|
|
||||||
# Enable auto reconnect
|
# Enable auto reconnect
|
||||||
@ -1567,6 +1571,29 @@ sub db_release_lock($$) {
|
|||||||
my ($lock) = $sth->fetchrow;
|
my ($lock) = $sth->fetchrow;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
########################################################################
|
||||||
|
## Set SSL options globally for the module.
|
||||||
|
########################################################################
|
||||||
|
sub set_ssl_opts($) {
|
||||||
|
my ($pa_config) = @_;
|
||||||
|
|
||||||
|
# SSL is disabled for the DB.
|
||||||
|
if (!defined($pa_config->{'dbssl'}) || $pa_config->{'dbssl'} == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Enable SSL.
|
||||||
|
$SSL_OPTS = "mysql_ssl=1;mysql_ssl_optional=1;mysql_ssl_verify_server_cert=1";
|
||||||
|
|
||||||
|
# Set additional SSL options.
|
||||||
|
if (defined($pa_config->{'dbsslcapath'}) && $pa_config->{'dbsslcapath'} ne "") {
|
||||||
|
$SSL_OPTS .= ";mysql_ssl_ca_path=" . $pa_config->{'dbsslcapath'};
|
||||||
|
}
|
||||||
|
if (defined($pa_config->{'dbsslcafile'}) && $pa_config->{'dbsslcafile'} ne "") {
|
||||||
|
$SSL_OPTS .= ";mysql_ssl_ca_file=" . $pa_config->{'dbsslcafile'};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
# End of function declaration
|
# End of function declaration
|
||||||
# End of defined Code
|
# End of defined Code
|
||||||
|
|
||||||
|
@ -629,6 +629,9 @@ sub pandora_load_config_pdb ($) {
|
|||||||
$conf->{'claim_back_snmp_modules'} = '1' unless defined ($conf->{'claim_back_snmp_modules'});
|
$conf->{'claim_back_snmp_modules'} = '1' unless defined ($conf->{'claim_back_snmp_modules'});
|
||||||
$conf->{'verbosity'} = '3' unless defined ($conf->{'verbosity'});
|
$conf->{'verbosity'} = '3' unless defined ($conf->{'verbosity'});
|
||||||
|
|
||||||
|
# Configure SSL.
|
||||||
|
set_ssl_opts($conf);
|
||||||
|
|
||||||
# Dynamic interval configuration.
|
# Dynamic interval configuration.
|
||||||
$conf->{"dynamic_constant"} = 0.10 unless defined($conf->{"dynamic_constant"});
|
$conf->{"dynamic_constant"} = 0.10 unless defined($conf->{"dynamic_constant"});
|
||||||
$conf->{"dynamic_warning"} = 0.10 unless defined($conf->{"dynamic_warning"});
|
$conf->{"dynamic_warning"} = 0.10 unless defined($conf->{"dynamic_warning"});
|
||||||
|
@ -11,6 +11,7 @@ import Item, { ItemType, ItemProps, itemBasePropsDecoder } from "../Item";
|
|||||||
export type EventsHistoryProps = {
|
export type EventsHistoryProps = {
|
||||||
type: ItemType.AUTO_SLA_GRAPH;
|
type: ItemType.AUTO_SLA_GRAPH;
|
||||||
maxTime: number | null;
|
maxTime: number | null;
|
||||||
|
legendColor: string;
|
||||||
html: string;
|
html: string;
|
||||||
} & ItemProps &
|
} & ItemProps &
|
||||||
WithModuleProps;
|
WithModuleProps;
|
||||||
@ -35,6 +36,7 @@ export function eventsHistoryPropsDecoder(
|
|||||||
...itemBasePropsDecoder(data), // Object spread. It will merge the properties of the two objects.
|
...itemBasePropsDecoder(data), // Object spread. It will merge the properties of the two objects.
|
||||||
type: ItemType.AUTO_SLA_GRAPH,
|
type: ItemType.AUTO_SLA_GRAPH,
|
||||||
maxTime: parseIntOr(data.maxTime, null),
|
maxTime: parseIntOr(data.maxTime, null),
|
||||||
|
legendColor: data.legendColor,
|
||||||
html: !stringIsEmpty(data.html)
|
html: !stringIsEmpty(data.html)
|
||||||
? data.html
|
? data.html
|
||||||
: decodeBase64(data.encodedHtml),
|
: decodeBase64(data.encodedHtml),
|
||||||
@ -67,6 +69,11 @@ export default class EventsHistory extends Item<EventsHistoryProps> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var flotText = element.getElementsByClassName(
|
||||||
|
"noresizevc"
|
||||||
|
) as HTMLCollectionOf<HTMLElement>;
|
||||||
|
flotText[0].style.color = this.props.legendColor;
|
||||||
|
|
||||||
return element;
|
return element;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -82,5 +89,10 @@ export default class EventsHistory extends Item<EventsHistoryProps> {
|
|||||||
eval(scripts[i].innerHTML.trim());
|
eval(scripts[i].innerHTML.trim());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var flotText = element.getElementsByClassName(
|
||||||
|
"noresizevc"
|
||||||
|
) as HTMLCollectionOf<HTMLElement>;
|
||||||
|
flotText[0].style.color = this.props.legendColor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user