mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-04-08 18:55:09 +02:00
Merge remote-tracking branch 'origin/develop' into ent-7074-Command-Center
This commit is contained in:
commit
074fbf916c
pandora_console
extras
godmode/reporting
include
operation/visual_console
pandoradb.sqlpandoradb_data.sqlpandora_server
visual_console_client/src/items
@ -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"')
|
||||
WHERE `id_user_task` = 2;
|
||||
|
||||
ALTER TABLE `tlayout` ADD COLUMN `auto_adjust` INTEGER UNSIGNED NOT NULL default 0;
|
||||
|
||||
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` ADD COLUMN `auto_adjust` INTEGER UNSIGNED NOT NULL default 0;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- 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][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') {
|
||||
$textButtonSubmit = __('Save');
|
||||
$classButtonSubmit = 'sub wand';
|
||||
@ -426,6 +429,22 @@ $(document).ready (function () {
|
||||
$("#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() {
|
||||
metaconsole = $("input[name='metaconsole_activated']").val();
|
||||
|
@ -151,6 +151,7 @@ switch ($activeTab) {
|
||||
$height = '';
|
||||
$visualConsoleName = '';
|
||||
$is_favourite = 0;
|
||||
$auto_adjust = 0;
|
||||
break;
|
||||
|
||||
case 'update':
|
||||
@ -162,6 +163,7 @@ switch ($activeTab) {
|
||||
$height = (int) get_parameter('height');
|
||||
$visualConsoleName = (string) get_parameter('name');
|
||||
$is_favourite = (int) get_parameter('is_favourite_sent');
|
||||
$auto_adjust = (int) get_parameter('auto_adjust_sent');
|
||||
|
||||
// ACL for the new visual console
|
||||
// $vconsole_read_new = check_acl ($config['id_user'], $idGroup, "VR");
|
||||
@ -186,6 +188,7 @@ switch ($activeTab) {
|
||||
'width' => $width,
|
||||
'height' => $height,
|
||||
'is_favourite' => $is_favourite,
|
||||
'auto_adjust' => $auto_adjust,
|
||||
];
|
||||
|
||||
$error = $_FILES['background_image']['error'];
|
||||
@ -353,6 +356,7 @@ switch ($activeTab) {
|
||||
$width = $visualConsole['width'];
|
||||
$height = $visualConsole['height'];
|
||||
$is_favourite = $visualConsole['is_favourite'];
|
||||
$auto_adjust = $visualConsole['auto_adjust'];
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
@ -254,8 +254,7 @@ Licensed under the MIT license.
|
||||
left: 0,
|
||||
bottom: 0,
|
||||
right: 0,
|
||||
'font-size': "smaller",
|
||||
color: "#545454"
|
||||
'font-size': "smaller"
|
||||
})
|
||||
.insertAfter(this.element);
|
||||
}
|
||||
|
File diff suppressed because one or more lines are too long
@ -806,11 +806,7 @@ function pandoraFlotSlicebar(
|
||||
tickFormatter: xFormatter,
|
||||
color: "",
|
||||
tickSize: intervaltick,
|
||||
tickLength: 0,
|
||||
font: {
|
||||
size: font_size + 2,
|
||||
family: font
|
||||
}
|
||||
tickLength: 0
|
||||
}
|
||||
],
|
||||
yaxes: [
|
||||
@ -834,6 +830,10 @@ function pandoraFlotSlicebar(
|
||||
|
||||
$.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) {
|
||||
// Events
|
||||
$("#" + graph_id).bind("plothover", function(event, pos, item) {
|
||||
|
@ -778,7 +778,7 @@ function flot_slicesbar_graph(
|
||||
|
||||
$datacolor = [];
|
||||
|
||||
$fontsize = $config['font_size'];
|
||||
$fontsize = ((int) $config['font_size'] + 2);
|
||||
$fontpath = $config['fontpath'];
|
||||
|
||||
$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"))
|
||||
.fail(handleFail);
|
||||
|
||||
var queryString = new URLSearchParams(window.location.search);
|
||||
var widthScreen = 0;
|
||||
if (queryString.get("width")) {
|
||||
widthScreen = document.body.offsetWidth;
|
||||
}
|
||||
|
||||
// Visual Console items request.
|
||||
itemsJqXHR = jQuery
|
||||
// .get(apiPath + "/visual-consoles/" + vcId + "/items", null, "json")
|
||||
@ -748,7 +755,8 @@ function loadVisualConsoleData(baseUrl, vcId, size, id_user, hash, callback) {
|
||||
size: size,
|
||||
visualConsoleId: vcId,
|
||||
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"
|
||||
)
|
||||
|
@ -86,6 +86,8 @@ if ($getVisualConsole === true) {
|
||||
|
||||
$size = get_parameter('size', []);
|
||||
|
||||
$width = get_parameter('widthScreen', 0);
|
||||
|
||||
$ratio = 0;
|
||||
if (isset($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(
|
||||
$visualConsoleId,
|
||||
$aclUserGroups,
|
||||
$ratio
|
||||
$ratio,
|
||||
$widthRatio
|
||||
);
|
||||
|
||||
echo '['.implode(',', $vcItems).']';
|
||||
|
@ -72,17 +72,17 @@ abstract class CachedModel extends Model
|
||||
*
|
||||
* @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;
|
||||
$save_cache = false;
|
||||
if ($ratio == 0 && $filter['cache_expiration'] > 0) {
|
||||
if ($ratio == 0 && $filter['cache_expiration'] > 0 && $widthRatio == 0) {
|
||||
$data = static::fetchCachedData($filter);
|
||||
$save_cache = true;
|
||||
}
|
||||
|
||||
if (isset($data) === false) {
|
||||
$data = static::fetchDataFromDB($filter, $ratio);
|
||||
$data = static::fetchDataFromDB($filter, $ratio, $widthRatio);
|
||||
} else {
|
||||
// Retrieved from cache.
|
||||
$save_cache = false;
|
||||
|
@ -130,7 +130,8 @@ abstract class Model
|
||||
*/
|
||||
abstract protected static function fetchDataFromDB(
|
||||
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.
|
||||
*/
|
||||
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.
|
||||
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),
|
||||
'backgroundColor' => static::extractBackgroundColor($data),
|
||||
'isFavorite' => static::extractFavorite($data),
|
||||
'autoAdjust' => static::extractAutoAdjust($data),
|
||||
'width' => (int) $data['width'],
|
||||
'height' => (int) $data['height'],
|
||||
'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.
|
||||
*
|
||||
@ -264,7 +280,8 @@ final class Container extends Model
|
||||
*/
|
||||
protected static function fetchDataFromDB(
|
||||
array $filter,
|
||||
?float $ratio=0
|
||||
?float $ratio=0,
|
||||
?float $widthRatio=0
|
||||
) {
|
||||
// Due to this DB call, this function cannot be unit tested without
|
||||
// a proper mock.
|
||||
@ -387,7 +404,8 @@ final class Container extends Model
|
||||
public static function getItemsFromDB(
|
||||
int $layoutId,
|
||||
array $groupsFilter=[],
|
||||
?float $ratio=0
|
||||
?float $ratio=0,
|
||||
?float $widthRatio=0
|
||||
): array {
|
||||
// Default filter.
|
||||
$filter = ['id_layout' => $layoutId];
|
||||
@ -438,7 +456,7 @@ final class Container extends Model
|
||||
$class = static::getItemClass((int) $data['type']);
|
||||
|
||||
try {
|
||||
array_push($items, $class::fromDB($data, $ratio));
|
||||
array_push($items, $class::fromDB($data, $ratio, $widthRatio));
|
||||
} catch (\Throwable $e) {
|
||||
error_log('VC[Container]: '.$e->getMessage());
|
||||
}
|
||||
|
@ -765,7 +765,8 @@ class Item extends CachedModel
|
||||
*/
|
||||
protected static function fetchDataFromDB(
|
||||
array $filter,
|
||||
?float $ratio=0
|
||||
?float $ratio=0,
|
||||
?float $widthRatio=0
|
||||
): array {
|
||||
// Load side libraries.
|
||||
global $config;
|
||||
@ -805,6 +806,11 @@ class Item extends CachedModel
|
||||
$row['pos_y'] = ($row['pos_y'] * $ratio);
|
||||
}
|
||||
|
||||
if ($widthRatio != 0) {
|
||||
$row['width'] = ($row['width'] * $widthRatio);
|
||||
$row['pos_x'] = ($row['pos_x'] * $widthRatio);
|
||||
}
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
@ -1770,6 +1776,7 @@ class Item extends CachedModel
|
||||
'gridColor',
|
||||
'color',
|
||||
'legendBackgroundColor',
|
||||
'legendColor',
|
||||
]
|
||||
),
|
||||
null
|
||||
|
@ -192,11 +192,12 @@ final class BarsGraph extends Item
|
||||
*/
|
||||
protected static function fetchDataFromDB(
|
||||
array $filter,
|
||||
?float $ratio=0
|
||||
?float $ratio=0,
|
||||
?float $widthRatio=0
|
||||
): array {
|
||||
// Due to this DB call, this function cannot be unit tested without
|
||||
// a proper mock.
|
||||
$data = parent::fetchDataFromDB($filter, $ratio);
|
||||
$data = parent::fetchDataFromDB($filter, $ratio, $widthRatio);
|
||||
|
||||
/*
|
||||
* Retrieve extra data.
|
||||
|
@ -419,11 +419,12 @@ final class Clock extends Item
|
||||
*/
|
||||
protected static function fetchDataFromDB(
|
||||
array $filter,
|
||||
?float $ratio=0
|
||||
?float $ratio=0,
|
||||
?float $widthRatio=0
|
||||
): array {
|
||||
// Due to this DB call, this function cannot be unit tested without
|
||||
// a proper mock.
|
||||
$data = parent::fetchDataFromDB($filter, $ratio);
|
||||
$data = parent::fetchDataFromDB($filter, $ratio, $widthRatio);
|
||||
|
||||
// Default values.
|
||||
if ((int) $data['width'] === 0) {
|
||||
|
@ -280,11 +280,12 @@ final class ColorCloud extends Item
|
||||
*/
|
||||
protected static function fetchDataFromDB(
|
||||
array $filter,
|
||||
?float $ratio=0
|
||||
?float $ratio=0,
|
||||
?float $widthRatio=0
|
||||
): array {
|
||||
// Due to this DB call, this function cannot be unit tested without
|
||||
// a proper mock.
|
||||
$data = parent::fetchDataFromDB($filter, $ratio);
|
||||
$data = parent::fetchDataFromDB($filter, $ratio, $widthRatio);
|
||||
|
||||
/*
|
||||
* Retrieve extra data.
|
||||
|
@ -89,11 +89,12 @@ final class DonutGraph extends Item
|
||||
*/
|
||||
protected static function fetchDataFromDB(
|
||||
array $filter,
|
||||
?float $ratio=0
|
||||
?float $ratio=0,
|
||||
?float $widthRatio=0
|
||||
): array {
|
||||
// Due to this DB call, this function cannot be unit tested without
|
||||
// a proper mock.
|
||||
$data = parent::fetchDataFromDB($filter, $ratio);
|
||||
$data = parent::fetchDataFromDB($filter, $ratio, $widthRatio);
|
||||
|
||||
/*
|
||||
* Retrieve extra data.
|
||||
|
@ -49,6 +49,7 @@ final class EventsHistory extends Item
|
||||
$return = parent::decode($data);
|
||||
$return['type'] = AUTO_SLA_GRAPH;
|
||||
$return['maxTime'] = static::extractMaxTime($data);
|
||||
$return['legendColor'] = $this->extractLegendColor($data);
|
||||
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.
|
||||
*
|
||||
@ -82,11 +99,12 @@ final class EventsHistory extends Item
|
||||
*/
|
||||
protected static function fetchDataFromDB(
|
||||
array $filter,
|
||||
?float $ratio=0
|
||||
?float $ratio=0,
|
||||
?float $widthRatio=0
|
||||
): array {
|
||||
// Due to this DB call, this function cannot be unit tested without
|
||||
// a proper mock.
|
||||
$data = parent::fetchDataFromDB($filter, $ratio);
|
||||
$data = parent::fetchDataFromDB($filter, $ratio, $widthRatio);
|
||||
|
||||
/*
|
||||
* Retrieve extra data.
|
||||
@ -100,6 +118,7 @@ final class EventsHistory extends Item
|
||||
$linkedModule = static::extractLinkedModule($data);
|
||||
$agentId = static::parseIntOr($linkedModule['agentId'], null);
|
||||
$moduleId = static::parseIntOr($linkedModule['moduleId'], null);
|
||||
$legendColor = static::extractLegendColor($data);
|
||||
|
||||
if ($agentId === null) {
|
||||
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.
|
||||
$inputsLinkedVisualConsole = self::inputsLinkedVisualConsole(
|
||||
$values
|
||||
|
@ -204,11 +204,12 @@ final class Group extends Item
|
||||
*/
|
||||
protected static function fetchDataFromDB(
|
||||
array $filter,
|
||||
?float $ratio=0
|
||||
?float $ratio=0,
|
||||
?float $widthRatio=0
|
||||
): array {
|
||||
// Due to this DB call, this function cannot be unit tested without
|
||||
// a proper mock.
|
||||
$data = parent::fetchDataFromDB($filter, $ratio);
|
||||
$data = parent::fetchDataFromDB($filter, $ratio, $widthRatio);
|
||||
|
||||
/*
|
||||
* Retrieve extra data.
|
||||
|
@ -98,11 +98,12 @@ final class Icon extends Item
|
||||
*/
|
||||
protected static function fetchDataFromDB(
|
||||
array $filter,
|
||||
?float $ratio=0
|
||||
?float $ratio=0,
|
||||
?float $widthRatio=0
|
||||
): array {
|
||||
// Due to this DB call, this function cannot be unit tested without
|
||||
// a proper mock.
|
||||
$data = parent::fetchDataFromDB($filter, $ratio);
|
||||
$data = parent::fetchDataFromDB($filter, $ratio, $widthRatio);
|
||||
|
||||
/*
|
||||
* Retrieve extra data.
|
||||
|
@ -194,7 +194,8 @@ final class Line extends Model
|
||||
*/
|
||||
protected static function fetchDataFromDB(
|
||||
array $filter,
|
||||
?float $ratio=0
|
||||
?float $ratio=0,
|
||||
?float $widthRatio=0
|
||||
): array {
|
||||
// Due to this DB call, this function cannot be unit tested without
|
||||
// a proper mock.
|
||||
@ -211,6 +212,11 @@ final class Line extends Model
|
||||
$row['pos_y'] = ($row['pos_y'] * $ratio);
|
||||
}
|
||||
|
||||
if ($widthRatio != 0) {
|
||||
$row['width'] = ($row['width'] * $widthRatio);
|
||||
$row['pos_x'] = ($row['pos_x'] * $widthRatio);
|
||||
}
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
@ -266,11 +266,12 @@ final class ModuleGraph extends Item
|
||||
*/
|
||||
protected static function fetchDataFromDB(
|
||||
array $filter,
|
||||
?float $ratio=0
|
||||
?float $ratio=0,
|
||||
?float $widthRatio=0
|
||||
): array {
|
||||
// Due to this DB call, this function cannot be unit tested without
|
||||
// a proper mock.
|
||||
$data = parent::fetchDataFromDB($filter, $ratio);
|
||||
$data = parent::fetchDataFromDB($filter, $ratio, $widthRatio);
|
||||
|
||||
/*
|
||||
* Retrieve extra data.
|
||||
|
@ -359,7 +359,8 @@ final class NetworkLink extends Model
|
||||
*/
|
||||
protected static function fetchDataFromDB(
|
||||
array $filter,
|
||||
?float $ratio=0
|
||||
?float $ratio=0,
|
||||
?float $widthRatio=0
|
||||
): array {
|
||||
// Due to this DB call, this function cannot be unit tested without
|
||||
// a proper mock.
|
||||
@ -376,6 +377,11 @@ final class NetworkLink extends Model
|
||||
$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);
|
||||
|
||||
return $row;
|
||||
|
@ -330,11 +330,12 @@ final class Percentile extends Item
|
||||
*/
|
||||
protected static function fetchDataFromDB(
|
||||
array $filter,
|
||||
?float $ratio=0
|
||||
?float $ratio=0,
|
||||
?float $widthRatio=0
|
||||
): array {
|
||||
// Due to this DB call, this function cannot be unit tested without
|
||||
// a proper mock.
|
||||
$data = parent::fetchDataFromDB($filter, $ratio);
|
||||
$data = parent::fetchDataFromDB($filter, $ratio, $widthRatio);
|
||||
|
||||
/*
|
||||
* Retrieve extra data.
|
||||
|
@ -230,11 +230,12 @@ final class SimpleValue extends Item
|
||||
*/
|
||||
protected static function fetchDataFromDB(
|
||||
array $filter,
|
||||
?float $ratio=0
|
||||
?float $ratio=0,
|
||||
?float $widthRatio=0
|
||||
): array {
|
||||
// Due to this DB call, this function cannot be unit tested without
|
||||
// a proper mock.
|
||||
$data = parent::fetchDataFromDB($filter, $ratio);
|
||||
$data = parent::fetchDataFromDB($filter, $ratio, $widthRatio);
|
||||
|
||||
/*
|
||||
* Retrieve extra data.
|
||||
|
@ -143,11 +143,12 @@ final class StaticGraph extends Item
|
||||
*/
|
||||
protected static function fetchDataFromDB(
|
||||
array $filter,
|
||||
?float $ratio=0
|
||||
?float $ratio=0,
|
||||
?float $widthRatio=0
|
||||
): array {
|
||||
// Due to this DB call, this function cannot be unit tested without
|
||||
// a proper mock.
|
||||
$data = parent::fetchDataFromDB($filter, $ratio);
|
||||
$data = parent::fetchDataFromDB($filter, $ratio, $widthRatio);
|
||||
|
||||
/*
|
||||
* Retrieve extra data.
|
||||
|
@ -434,6 +434,7 @@ class View extends \HTML
|
||||
$data['agentAlias'] = \get_parameter('agentAlias');
|
||||
$data['moduleId'] = \get_parameter('moduleId');
|
||||
$data['maxTime'] = \get_parameter('maxTime');
|
||||
$data['legendColor'] = \get_parameter('legendColor');
|
||||
break;
|
||||
|
||||
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.
|
||||
$refr = (int) get_parameter('refr', $config['vc_refr']);
|
||||
|
||||
$width = (int) get_parameter('width', 0);
|
||||
$height = (int) get_parameter('height', 0);
|
||||
|
||||
// Load Visual Console.
|
||||
use Models\VisualConsole\Container as VisualConsole;
|
||||
$visualConsole = null;
|
||||
@ -200,7 +203,7 @@ $options['view']['active'] = true;
|
||||
|
||||
if (is_metaconsole() === false) {
|
||||
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',
|
||||
true,
|
||||
[
|
||||
@ -489,11 +492,47 @@ ui_require_javascript_file('pandora_visual_console');
|
||||
include_javascript_d3();
|
||||
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.
|
||||
$visualConsoleItems = VisualConsole::getItemsFromDB(
|
||||
$visualConsoleId,
|
||||
$aclUserGroups
|
||||
$aclUserGroups,
|
||||
0,
|
||||
$widthRatio
|
||||
);
|
||||
|
||||
ui_require_css_file('modal');
|
||||
ui_require_css_file('form');
|
||||
?>
|
||||
@ -506,6 +545,7 @@ ui_require_css_file('form');
|
||||
var items = <?php echo '['.implode(',', $visualConsoleItems).']'; ?>;
|
||||
var baseUrl = "<?php echo ui_get_full_url('/', false, false, false); ?>";
|
||||
var controls = document.getElementById('vc-controls');
|
||||
|
||||
autoHideElement(controls, 1000);
|
||||
var handleUpdate = function (prevProps, newProps) {
|
||||
if (!newProps) return;
|
||||
@ -683,6 +723,19 @@ if ($edit_capable === true) {
|
||||
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.
|
||||
*/
|
||||
|
@ -1626,6 +1626,7 @@ CREATE TABLE IF NOT EXISTS `tlayout` (
|
||||
`width` INTEGER UNSIGNED NOT NULL default 0,
|
||||
`background_color` varchar(50) NOT NULL default '#FFF',
|
||||
`is_favourite` INTEGER UNSIGNED NOT NULL default 0,
|
||||
`auto_adjust` INTEGER UNSIGNED NOT NULL default 0,
|
||||
PRIMARY KEY(`id`)
|
||||
) ENGINE = InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
|
@ -1334,18 +1334,18 @@ UPDATE `tnotification_source` SET `enabled`=1 WHERE `description` = 'System 
|
||||
--
|
||||
INSERT INTO `tlayout`
|
||||
VALUES
|
||||
(1, 'Demo visual console', 0, 'fondo.jpg', 1080, 1920, 'white', 0),
|
||||
(2,'Demo visual console 2',0,'fondo-keep-alive.jpg',1080,1920,'#FFF',0),
|
||||
(3,'Worldmap',0,'map_world.jpg',1080,1920,'white',0),
|
||||
(4,'Europe',0,'map_europe_1.jpg',1080,1920,'white',0),
|
||||
(5,'USA',0,'map_USA.jpg',1080,1920,'white',0),
|
||||
(6,'Spain',0,'map_spain.jpg',1080,1920,'white',0),
|
||||
(7,'Madrid',0,'map_madrid.jpg',1080,1920,'white',0),
|
||||
(8,'Germany',0,'map_germany_1.jpg',1080,1920,'white',0),
|
||||
(9,'France',0,'map_france.jpg',1080,1920,'white',0),
|
||||
(10,'Catalonia',0,'map_catalonia.jpg',1080,1920,'white',0),
|
||||
(11,'Basque Country',0,'map_basque-country.jpg',1080,1920,'white',0),
|
||||
(12,'Andalusia',0,'map_andalusia.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, 0),
|
||||
(3,'Worldmap',0,'map_world.jpg',1080,1920,'white',0, 0),
|
||||
(4,'Europe',0,'map_europe_1.jpg',1080,1920,'white',0, 0),
|
||||
(5,'USA',0,'map_USA.jpg',1080,1920,'white',0, 0),
|
||||
(6,'Spain',0,'map_spain.jpg',1080,1920,'white',0, 0),
|
||||
(7,'Madrid',0,'map_madrid.jpg',1080,1920,'white',0, 0),
|
||||
(8,'Germany',0,'map_germany_1.jpg',1080,1920,'white',0, 0),
|
||||
(9,'France',0,'map_france.jpg',1080,1920,'white',0, 0),
|
||||
(10,'Catalonia',0,'map_catalonia.jpg',1080,1920,'white',0, 0),
|
||||
(11,'Basque Country',0,'map_basque-country.jpg',1080,1920,'white',0, 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)
|
||||
#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
|
||||
|
||||
#update_parent 0
|
||||
|
@ -234,6 +234,9 @@ sub pandora_load_config {
|
||||
$pa_config->{"dbhost"} = "localhost";
|
||||
$pa_config->{'dbport'} = undef; # set to standard port of "dbengine" later
|
||||
$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->{"incomingdir"} = "/var/spool/pandora/data_in";
|
||||
$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) {
|
||||
$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) {
|
||||
$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->{"PID"} ne ""){
|
||||
print " [*] PID File is written at ".$pa_config->{'PID'}."\n";
|
||||
|
@ -110,6 +110,7 @@ our @EXPORT = qw(
|
||||
get_agentmodule_status
|
||||
get_agentmodule_status_str
|
||||
get_agentmodule_data
|
||||
set_ssl_opts
|
||||
$RDBMS
|
||||
$RDBMS_QUOTE
|
||||
$RDBMS_QUOTE_STRING
|
||||
@ -124,6 +125,9 @@ our $RDBMS_QUOTE = '';
|
||||
# For strings, Character used to quote in the current RDBMS
|
||||
our $RDBMS_QUOTE_STRING = '';
|
||||
|
||||
# SSL options.
|
||||
my $SSL_OPTS = '';
|
||||
|
||||
##########################################################################
|
||||
## Connect to the DB.
|
||||
##########################################################################
|
||||
@ -136,7 +140,7 @@ sub db_connect ($$$$$$) {
|
||||
$RDBMS_QUOTE_STRING = '"';
|
||||
|
||||
# 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);
|
||||
|
||||
# Enable auto reconnect
|
||||
@ -1567,6 +1571,29 @@ sub db_release_lock($$) {
|
||||
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 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->{'verbosity'} = '3' unless defined ($conf->{'verbosity'});
|
||||
|
||||
# Configure SSL.
|
||||
set_ssl_opts($conf);
|
||||
|
||||
# Dynamic interval configuration.
|
||||
$conf->{"dynamic_constant"} = 0.10 unless defined($conf->{"dynamic_constant"});
|
||||
$conf->{"dynamic_warning"} = 0.10 unless defined($conf->{"dynamic_warning"});
|
||||
|
@ -11,6 +11,7 @@ import Item, { ItemType, ItemProps, itemBasePropsDecoder } from "../Item";
|
||||
export type EventsHistoryProps = {
|
||||
type: ItemType.AUTO_SLA_GRAPH;
|
||||
maxTime: number | null;
|
||||
legendColor: string;
|
||||
html: string;
|
||||
} & ItemProps &
|
||||
WithModuleProps;
|
||||
@ -35,6 +36,7 @@ export function eventsHistoryPropsDecoder(
|
||||
...itemBasePropsDecoder(data), // Object spread. It will merge the properties of the two objects.
|
||||
type: ItemType.AUTO_SLA_GRAPH,
|
||||
maxTime: parseIntOr(data.maxTime, null),
|
||||
legendColor: data.legendColor,
|
||||
html: !stringIsEmpty(data.html)
|
||||
? data.html
|
||||
: 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;
|
||||
}
|
||||
|
||||
@ -82,5 +89,10 @@ export default class EventsHistory extends Item<EventsHistoryProps> {
|
||||
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