fixed errors VC

This commit is contained in:
Daniel Barbero Martin 2020-01-27 16:15:54 +01:00
parent 570ebd9a0a
commit 6ddb501b08
8 changed files with 21 additions and 26 deletions
pandora_console/include
functions_graph.php
graphs
rest-api/models/VisualConsole/Items
visual-console-client
visual_console_client/src

View File

@ -4862,7 +4862,7 @@ function graph_nodata_image($width=300, $height=110, $type='area', $text='')
// if ($text == '') {
// $text = __('No data to show');
// }
$text_div = '<div class="nodata_text" style="text-align:center; padding: 30px 0; display:block; font-size:9.5pt;">'.$text.'</div>';
$text_div = '<div class="nodata_text" style="text-align:center; padding: 30px 0; display:block; font-size:9.5pt;">'.$text.'</div>';
$image_div = $text_div.'<div class="nodata_container" style="background-position: top; width:40%;height:40%;background-size: contain;background-image: url(\''.$image.'\');"><div></div></div>';

View File

@ -352,7 +352,7 @@ function hbar_graph(
) {
setup_watermark($water_mark, $water_mark_file, $water_mark_url);
if (empty($chart_data)) {
if ($chart_data === false || empty($chart_data) === true) {
return graph_nodata_image($width, $height, 'hbar');
}

View File

@ -223,14 +223,6 @@ final class BarsGraph extends Item
$moduleId = $linkedModule['moduleId'];
$metaconsoleId = $linkedModule['metaconsoleId'];
if ($agentId === null) {
throw new \InvalidArgumentException('missing agent Id');
}
if ($moduleId === null) {
throw new \InvalidArgumentException('missing module Id');
}
// Add colors that will use the graphics.
$color = [];
@ -313,9 +305,9 @@ final class BarsGraph extends Item
// Maybe connect to node.
$nodeConnected = false;
if (\is_metaconsole() === true && $metaconsoleId !== null) {
$server = \metaconsole_get_connection_by_id($metaconsoleId);
$nodeConnected = \metaconsole_connect(
null,
$metaconsoleId
$server
) === NOERR;
if ($nodeConnected === false) {
@ -326,7 +318,9 @@ final class BarsGraph extends Item
}
$moduleData = \get_bars_module_data($moduleId);
array_pop($moduleData);
if ($moduleData !== false && is_array($moduleData) === true) {
array_pop($moduleData);
}
$waterMark = [
'file' => $config['homedir'].'/images/logo_vertical_water.png',

View File

@ -124,9 +124,9 @@ final class DonutGraph extends Item
// Maybe connect to node.
$nodeConnected = false;
if (\is_metaconsole() === true && $metaconsoleId !== null) {
$server = \metaconsole_get_connection_by_id($metaconsoleId);
$nodeConnected = \metaconsole_connect(
null,
$metaconsoleId
$server
) === NOERR;
if ($nodeConnected === false) {
@ -147,12 +147,8 @@ final class DonutGraph extends Item
$agentId,
$moduleId
);
$isString = (bool) \db_get_value_sql($sql);
// Restore connection.
if ($nodeConnected === true) {
\metaconsole_restore_db();
}
$isString = (bool) \db_get_value_sql($sql);
$width = (int) $data['width'];
$height = (int) $data['height'];
@ -177,6 +173,11 @@ final class DonutGraph extends Item
$data['html'] = '<img src="'.$src.'" style="'.$style.'">';
}
// Restore connection.
if ($nodeConnected === true) {
\metaconsole_restore_db();
}
return $data;
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -257,7 +257,7 @@ abstract class VisualConsoleItem<Props extends ItemProps> {
// This function will only run the 2nd arg function after the time
// of the first arg have passed after its last execution.
private debouncedMovementSave = debounce(
300, // ms.
500, // ms.
(x: Position["x"], y: Position["y"]) => {
// Update the metadata information.
// Don't use the .meta property cause we don't need DOM updates.
@ -338,7 +338,7 @@ abstract class VisualConsoleItem<Props extends ItemProps> {
// This function will only run the 2nd arg function after the time
// of the first arg have passed after its last execution.
private debouncedResizementSave = debounce(
300, // ms.
500, // ms.
(width: Size["width"], height: Size["height"]) => {
// Update the metadata information.
// Don't use the .meta property cause we don't need DOM updates.

View File

@ -96,7 +96,7 @@ export default class Line extends Item<LineProps> {
// This function will only run the 2nd arg function after the time
// of the first arg have passed after its last execution.
private debouncedStartPositionMovementSave = debounce(
300, // ms.
500, // ms.
(x: Position["x"], y: Position["y"]) => {
this.isMoving = false;
const startPosition = { x, y };
@ -154,7 +154,7 @@ export default class Line extends Item<LineProps> {
// This function will only run the 2nd arg function after the time
// of the first arg have passed after its last execution.
private debouncedEndPositionMovementSave = debounce(
300, // ms.
500, // ms.
(x: Position["x"], y: Position["y"]) => {
this.isMoving = false;
const endPosition = { x, y };