fixed errors VC

This commit is contained in:
Daniel Barbero Martin 2020-01-23 19:54:47 +01:00
parent cd3691ecc3
commit fe697a98ec
22 changed files with 125 additions and 24 deletions

View File

@ -203,7 +203,7 @@ foreach ($layoutDatas as $layoutData) {
$table->data[($i + 1)]['icon'] = html_print_image(
'images/auto_sla_graph.png',
true,
['title' => __('Auto SLA Graph')]
['title' => __('Event history graph')]
);
break;

View File

@ -1685,6 +1685,8 @@ function html_print_input_number(array $settings):string
'required',
'pattern',
'autocomplete',
'min',
'max',
];
$output = '';

View File

@ -4266,7 +4266,7 @@ function visual_map_create_internal_name_item($label=null, $type, $image, $agent
case 'auto_sla_graph':
case AUTO_SLA_GRAPH:
$text = __('Auto SLA Graph');
$text = __('Event history graph');
break;
case 'percentile_bar':

View File

@ -56,7 +56,7 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background)
'static_graph' => __('Static Graph'),
'percentile_item' => __('Percentile Item'),
'module_graph' => __('Graph'),
'auto_sla_graph' => __('Auto SLA Graph'),
'auto_sla_graph' => __('Event history graph'),
'simple_value' => __('Simple value').ui_print_help_tip(
__(
"To use 'label'field, you should write
@ -1299,7 +1299,7 @@ function visual_map_editor_print_toolbox()
visual_map_print_button_editor('module_graph', __('Module Graph'), 'left', false, 'graph_min', true);
visual_map_print_button_editor('donut_graph', __('Serialized pie graph'), 'left', false, 'donut_graph_min', true);
visual_map_print_button_editor('bars_graph', __('Bars Graph'), 'left', false, 'bars_graph_min', true);
visual_map_print_button_editor('auto_sla_graph', __('Auto SLA Graph'), 'left', false, 'auto_sla_graph_min', true);
visual_map_print_button_editor('auto_sla_graph', __('Event history graph'), 'left', false, 'auto_sla_graph_min', true);
visual_map_print_button_editor('simple_value', __('Simple Value'), 'left', false, 'binary_min', true);
visual_map_print_button_editor('label', __('Label'), 'left', false, 'label_min', true);
visual_map_print_button_editor('icon', __('Icon'), 'left', false, 'icon_min', true);

View File

@ -1130,7 +1130,7 @@ function createOrUpdateVisualConsoleItem(
nameType = "Line";
break;
case 14:
nameType = "Events";
nameType = "Event history";
break;
case 17:
nameType = "Donut graph";
@ -1471,18 +1471,39 @@ function typeModuleGraph(type) {
$("#MGautoCompleteAgent").removeClass("hidden");
$("#MGautoCompleteModule").removeClass("hidden");
$("#MGcustomGraph").removeClass("hidden");
$("#MGgraphType").removeClass("hidden");
$("#MGshowLegend").removeClass("hidden");
if (type == "module") {
$("#MGautoCompleteAgent").show();
$("#MGautoCompleteModule").show();
$("#MGgraphType").show();
$("#MGshowLegend").show();
$("#MGcustomGraph").hide();
$("#customGraphId").val(0);
} else if (type == "custom") {
$("#MGautoCompleteAgent").hide();
$("#MGautoCompleteModule").hide();
$("#MGgraphType").hide();
$("#MGshowLegend").hide();
$("#MGcustomGraph").show();
}
}
/**
* Onchange input Process Simple Value.
* @return {void}
*/
// eslint-disable-next-line no-unused-vars
function simpleValuePeriod() {
$("#SVPeriod").removeClass("hidden");
if ($("#processValue :selected").val() != "none") {
$("#SVPeriod").show();
} else {
$("#SVPeriod").hide();
}
}
/**
* Onchange input Linked visual console.
* @return {void}

View File

@ -1865,6 +1865,7 @@ class Item extends CachedModel
'type' => 'number',
'value' => $values['width'],
'return' => true,
'min' => 0,
],
],
[
@ -1874,6 +1875,7 @@ class Item extends CachedModel
'type' => 'number',
'value' => $values['height'],
'return' => true,
'min' => 0,
],
],
],
@ -1895,6 +1897,7 @@ class Item extends CachedModel
'type' => 'number',
'value' => $values['x'],
'return' => true,
'min' => 0,
],
],
[
@ -1904,6 +1907,7 @@ class Item extends CachedModel
'type' => 'number',
'value' => $values['y'],
'return' => true,
'min' => 0,
],
],
],
@ -1970,7 +1974,7 @@ class Item extends CachedModel
break;
case AUTO_SLA_GRAPH:
$text = __('Auto SLA Graph');
$text = __('Event History Graph');
break;
case PERCENTILE_BAR:
@ -2343,6 +2347,7 @@ class Item extends CachedModel
'type' => 'number',
'value' => $values['linkedLayoutStatusTypeWeight'],
'return' => true,
'min' => 0,
],
];
@ -2356,6 +2361,7 @@ class Item extends CachedModel
'type' => 'number',
'value' => $values['linkedLayoutStatusTypeCriticalThreshold'],
'return' => true,
'min' => 0,
],
];
@ -2369,6 +2375,7 @@ class Item extends CachedModel
'type' => 'number',
'value' => $values['linkedLayoutStatusTypeWarningThreshold'],
'return' => true,
'min' => 0,
],
];

View File

@ -193,6 +193,7 @@ final class Box extends Item
'type' => 'number',
'value' => $values['width'],
'return' => true,
'min' => 0,
],
],
[
@ -202,6 +203,7 @@ final class Box extends Item
'type' => 'number',
'value' => $values['height'],
'return' => true,
'min' => 0,
],
],
],
@ -223,6 +225,7 @@ final class Box extends Item
'type' => 'number',
'value' => $values['x'],
'return' => true,
'min' => 0,
],
],
[
@ -232,6 +235,7 @@ final class Box extends Item
'type' => 'number',
'value' => $values['y'],
'return' => true,
'min' => 0,
],
],
],
@ -283,6 +287,7 @@ final class Box extends Item
'type' => 'number',
'value' => $values['borderWidth'],
'return' => true,
'min' => 1,
],
];

View File

@ -450,6 +450,7 @@ final class ColorCloud extends Item
'type' => 'number',
'value' => 0,
'return' => true,
'min' => 0,
],
],
[
@ -460,6 +461,7 @@ final class ColorCloud extends Item
'type' => 'number',
'value' => 0,
'return' => true,
'min' => 0,
],
],
[
@ -508,6 +510,7 @@ final class ColorCloud extends Item
'type' => 'number',
'value' => $v['fromValue'],
'return' => true,
'min' => 0,
],
],
[
@ -517,6 +520,7 @@ final class ColorCloud extends Item
'type' => 'number',
'value' => $v['toValue'],
'return' => true,
'min' => 0,
],
],
[

View File

@ -459,6 +459,7 @@ final class Line extends Model
'type' => 'number',
'value' => $values['borderWidth'],
'return' => true,
'min' => 1,
],
];

View File

@ -332,7 +332,7 @@ final class ModuleGraph extends Item
'vconsole' => true,
'backgroundColor' => $backgroundType,
'return_img_base_64' => true,
'show_legend' => $showLegend,
'show_legend' => true,
'show_title' => false,
];
@ -441,6 +441,11 @@ final class ModuleGraph extends Item
}
if ($values['tabSelected'] === 'specific') {
// Default values.
if (isset($values['period']) === false) {
$values['period'] = 3600;
}
// Background color.
$fields = [
'white' => __('White'),
@ -557,6 +562,18 @@ final class ModuleGraph extends Item
],
];
// Period.
$inputs[] = [
'label' => __('Period'),
'arguments' => [
'name' => 'period',
'type' => 'interval',
'value' => $values['period'],
'nothing' => __('None'),
'nothing_value' => 0,
],
];
// Graph Type.
$fields = [
'line' => __('Line'),
@ -564,6 +581,8 @@ final class ModuleGraph extends Item
];
$inputs[] = [
'id' => 'MGgraphType',
'hidden' => $hiddenModule,
'label' => __('Graph Type'),
'arguments' => [
'type' => 'select',
@ -576,6 +595,8 @@ final class ModuleGraph extends Item
// Show legend.
$inputs[] = [
'id' => 'MGshowLegend',
'hidden' => $hiddenModule,
'label' => __('Show legend'),
'arguments' => [
'name' => 'showLegend',

View File

@ -492,6 +492,7 @@ final class Percentile extends Item
'type' => 'number',
'value' => $values['minValue'],
'return' => true,
'min' => 0,
],
];
@ -504,6 +505,7 @@ final class Percentile extends Item
'type' => 'number',
'value' => $values['maxValue'],
'return' => true,
'min' => 0,
],
];

View File

@ -133,7 +133,7 @@ final class SimpleValue extends Item
$return['type'] = SIMPLE_VALUE;
$return['processValue'] = static::extractProcessValue($data);
$return['valueType'] = static::extractValueType($data);
$return['value'] = $data['value'];
$return['value'] = \io_safe_output($data['value']);
if ($return['processValue'] !== 'none') {
$return['period'] = static::extractPeriod($data);
@ -273,10 +273,12 @@ final class SimpleValue extends Item
}
// Get the formatted value.
$value = \visual_map_get_simple_value(
$data['type'],
$moduleId,
static::extractPeriod($data)
$value = \io_safe_output(
\visual_map_get_simple_value(
$data['type'],
$moduleId,
static::extractPeriod($data)
)
);
// Restore connection.
@ -371,6 +373,28 @@ final class SimpleValue extends Item
'selected' => $values['processValue'],
'return' => true,
'sort' => false,
'script' => 'simpleValuePeriod()',
],
];
$hiddenPeriod = true;
if (isset($values['processValue']) === true
&& $values['processValue'] !== 'none'
) {
$hiddenPeriod = false;
}
// Period.
$inputs[] = [
'id' => 'SVPeriod',
'hidden' => $hiddenPeriod,
'label' => __('Period'),
'arguments' => [
'name' => 'period',
'type' => 'interval',
'value' => $values['period'],
'nothing' => __('None'),
'nothing_value' => 0,
],
];
@ -401,6 +425,11 @@ final class SimpleValue extends Item
// Retrieve global - common inputs.
$values = parent::getDefaultGeneralValues($values);
// Default values.
if (isset($values['label']) === false) {
$values['label'] = '(_value_)';
}
return $values;
}

View File

@ -230,6 +230,7 @@ class View extends \HTML
'method' => 'POST',
'id' => 'itemForm-'.$tabSelected,
'class' => 'discovery modal',
'extra' => 'novalidate',
];
if ($itemId !== 0) {
@ -369,6 +370,7 @@ class View extends \HTML
$data['customGraphId'] = \get_parameter('customGraphId');
$data['graphType'] = \get_parameter('graphType');
$data['showLegend'] = \get_parameter_switch('showLegend');
$data['period'] = \get_parameter('period');
break;
case SIMPLE_VALUE:
@ -379,6 +381,7 @@ class View extends \HTML
$data['metaconsoleId'] = \get_parameter('metaconsoleId');
$data['moduleId'] = \get_parameter('moduleId');
$data['processValue'] = \get_parameter('processValue');
$data['period'] = \get_parameter('period');
// Insert line default position ball end.
if ($itemId === 0 && empty($data['label']) === true) {
$data['label'] = '(_value_)';

View File

@ -552,12 +552,15 @@ li#li-image-item label img {
width: 100px;
}
.discovery.modal div#period_manual select,
.discovery.modal div#period_manual input,
.discovery.modal div#period_default select,
.discovery.modal div#cacheExpiration_manual select,
.discovery.modal div#cacheExpiration_manual input,
.discovery.modal div#cacheExpiration_default select {
font-size: inherit !important;
}
.discovery.modal div#period_default select#period_select,
.discovery.modal div#cacheExpiration_default select#cacheExpiration_select {
max-width: 230px;
width: inherit;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -236,7 +236,7 @@ if ($pure === false) {
);
visual_map_print_button_editor_refactor(
'AUTO_SLA_GRAPH',
__('Auto SLA Graph'),
__('Event history graph'),
'auto_sla_graph_min link-create-item'
);
visual_map_print_button_editor_refactor(

View File

@ -188,7 +188,7 @@ export function titleItem(id: number): string {
title = t("Line");
break;
case ItemType.AUTO_SLA_GRAPH:
title = t("Auto SLA graph");
title = t("Event history graph");
break;
case ItemType.CIRCULAR_PROGRESS_BAR:
title = t("Percentile item");
@ -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(
500, // ms.
300, // 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(
500, // ms.
300, // 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

@ -1000,7 +1000,7 @@ export default class VisualConsole {
text = t("Bars graph");
break;
case ItemType.AUTO_SLA_GRAPH:
text = t("Auto SLA Graph");
text = t("Event history graph");
break;
case ItemType.PERCENTILE_BAR:
text = t("Percentile bar");

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(
500, // ms.
300, // 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(
500, // ms.
300, // ms.
(x: Position["x"], y: Position["y"]) => {
this.isMoving = false;
const endPosition = { x, y };

View File

@ -431,12 +431,15 @@ li#li-image-item label img {
width: 100px;
}
.discovery.modal div#period_manual select,
.discovery.modal div#period_manual input,
.discovery.modal div#period_default select,
.discovery.modal div#cacheExpiration_manual select,
.discovery.modal div#cacheExpiration_manual input,
.discovery.modal div#cacheExpiration_default select {
font-size: inherit !important;
}
.discovery.modal div#period_default select#period_select,
.discovery.modal div#cacheExpiration_default select#cacheExpiration_select {
max-width: 230px;
width: inherit;