Added item to editor

This commit is contained in:
Arturo Gonzalez 2017-10-19 12:22:01 +02:00
parent 90e12d66c2
commit 1d3a082e5c
11 changed files with 88 additions and 16 deletions

View File

@ -291,7 +291,7 @@ if (modules_is_string_type($id_module_type) || $edit) {
$table_simple->data[4][1] .= '<br /><em>'.__('Inverse interval').'</em>';
$table_simple->data[4][1] .= html_print_checkbox ("warning_inverse", 1, $warning_inverse, true, $disabledBecauseInPolicy);
if (!modules_is_string_type($id_module_type) || $edit) {
$table_simple->data[4][2] = '<svg id="svg_dinamic" width="350" height="200" style="padding:40px; padding-left: 100px; margin-bottom: 60px;"> </svg>';
$table_simple->data[4][2] = '<svg id="svg_dinamic" width="350px" height="200px" style="padding:40px; padding-left: 100px; margin-bottom: 60px;"></svg>';
$table_simple->colspan[4][2] = 2;
$table_simple->rowspan[4][2] = 3;
}
@ -1323,8 +1323,8 @@ function paint_graph_status(min_w, max_w, min_c, max_c, inverse_w, inverse_c, er
.attr("id", "legend_normal")
.attr("x", 72)
.attr("y", -30)
.attr("width", 10)
.attr("height", 10)
.attr("width", '10px')
.attr("height", '10px')
.style("fill", "#82B92E");
//legend Warning text
@ -1343,8 +1343,8 @@ function paint_graph_status(min_w, max_w, min_c, max_c, inverse_w, inverse_c, er
.attr("id", "legend_warning")
.attr("x", 168)
.attr("y", -30)
.attr("width", 10)
.attr("height", 10)
.attr("width", '10px')
.attr("height", '10px')
.style("fill", "#ffd731");
//legend Critical text
@ -1363,8 +1363,8 @@ function paint_graph_status(min_w, max_w, min_c, max_c, inverse_w, inverse_c, er
.attr("id", "legend_critical")
.attr("x", 258)
.attr("y", -30)
.attr("width", 10)
.attr("height", 10)
.attr("width", '10px')
.attr("height", '10px')
.style("fill", "#fc4444");
//styles for number and axes
@ -1382,8 +1382,8 @@ function paint_graph_status(min_w, max_w, min_c, max_c, inverse_w, inverse_c, er
.attr("id", "warning_rect")
.attr("x", 3)
.attr("y", 0)
.attr("width", 300)
.attr("height", 200)
.attr("width", '300px')
.attr("height", '200px')
.style("fill", "#82B92E");
//controls the inverse warning

View File

@ -473,8 +473,8 @@ $next_row++;
.attr("id", "legend_normal")
.attr("x", 72)
.attr("y", -30)
.attr("width", 10)
.attr("height", 10)
.attr("width", '10px')
.attr("height", '10px')
.style("fill", "#82B92E");
//legend Warning text

View File

@ -1826,16 +1826,16 @@ function setBarsGraph(id_data, values) {
success: function (data) {
if (data['no_data'] == true) {
if (values['width'] == "0" || values['height'] == "0") {
$("#" + id_data + " img").attr('src', url_hack_metaconsole + 'images/console/signes/module-events.png');
$("#" + id_data + " img").attr('src', url_hack_metaconsole + 'images/console/signes/barras-no.png');
}
else {
$("#" + id_data + " img").attr('src', url_hack_metaconsole + 'images/console/signes/module-events.png');
$("#" + id_data + " img").attr('src', url_hack_metaconsole + 'images/console/signes/barras-no.png');
$("#" + id_data + " img").css('width', values['width'] + 'px');
$("#" + id_data + " img").css('height', values['height'] + 'px');
}
}
else {
$("#" + id_data + " img").attr('src', url_hack_metaconsole + 'images/console/signes/module-events.png');
$("#" + id_data + " img").attr('src', url_hack_metaconsole + 'images/console/signes/barras.png');
if($('#text-width').val() == 0 || $('#text-height').val() == 0){
// Image size

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 315 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 331 B

View File

@ -104,6 +104,7 @@ $width_percentile = get_parameter('width_percentile', null);
$max_percentile = get_parameter('max_percentile', null);
$height_module_graph = get_parameter('height_module_graph', null);
$width_module_graph = get_parameter('width_module_graph', null);
$bars_graph_type = get_parameter('bars_graph_type', null);
$id_agent_module = get_parameter('id_agent_module', 0);
$process_simple_value = get_parameter('process_simple_value', PROCESS_VALUE_NONE);
$type_percentile = get_parameter('type_percentile', 'percentile');
@ -498,6 +499,7 @@ switch ($action) {
case 'label':
case 'icon':
case 'auto_sla_graph':
case 'bars_graph':
default:
if ($type == 'label') {
$values['type'] = LABEL;
@ -621,6 +623,20 @@ switch ($action) {
$values['id_custom_graph'] = $id_custom_graph;
}
break;
case 'bars_graph':
if ($height_module_graph !== null) {
$values['height'] = $height_module_graph;
}
if ($width_module_graph !== null) {
$values['width'] = $width_module_graph;
}
if ($bars_graph_type !== null) {
$values['type_graph'] = $id_custom_graph;
}
if ($background_color !== null) {
$values['image'] = $background_color;
}
break;
case 'percentile_item':
case 'percentile_bar':
if ($action == 'update') {
@ -683,6 +699,10 @@ switch ($action) {
unset($values['image']);
unset($values['type_graph']);
break;
case 'bars_graph':
unset($values['image']);
unset($values['type_graph']);
break;
case 'box_item':
unset($values['border_width']);
unset($values['border_color']);
@ -740,6 +760,7 @@ switch ($action) {
case 'static_graph':
case 'group_item':
case 'module_graph':
case 'bars_graph':
case 'simple_value':
case 'label':
case 'icon':
@ -820,6 +841,11 @@ switch ($action) {
$elementFields['width_module_graph'] = $elementFields['width'];
$elementFields['height_module_graph'] = $elementFields['height'];
break;
case 'bars_graph':
$elementFields['width_module_graph'] = $elementFields['width'];
$elementFields['height_module_graph'] = $elementFields['height'];
$elementFields['bars_graph_type'] = $elementFields['type_graph'];
break;
case 'box_item':
$elementFields['width_box'] = $elementFields['width'];
$elementFields['height_box'] = $elementFields['height'];
@ -956,6 +982,13 @@ switch ($action) {
}
$values['period'] = $period;
break;
case 'bars_graph':
$values['type'] = BARS_GRAPH;
$values['height'] = $height_module_graph;
$values['width'] = $width_module_graph;
$values['type_graph'] = $bars_graph_type;
$values['image'] = $background_color;
break;
case 'auto_sla_graph':
$values['type'] = AUTO_SLA_GRAPH;
$values['period'] = $event_max_time_row;

View File

@ -197,6 +197,7 @@ define('SERVICE', 10); //Enterprise Item.
define('GROUP_ITEM', 11);
define('BOX_ITEM', 12);
define('LINE_ITEM', 13);
define('BARS_GRAPH', 18);
//Some styles
define('MIN_WIDTH', 300);
define('MIN_HEIGHT', 120);

View File

@ -375,6 +375,9 @@ function visual_map_print_item($mode = "read", $layoutData,
$link = true;
}
break;
case BARS_GRAPH:
$link = true;
break;
case AUTO_SLA_GRAPH:
$link = true;
@ -487,6 +490,17 @@ function visual_map_print_item($mode = "read", $layoutData,
"&date_to=" . $date_to . "&time_to=" . $time_to . "&status=-1";
}
break;
case BARS_GRAPH:
if (empty($layout_data['id_metaconsole'])) {
$url = $config['homeurl'] . "index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente=" . $layoutData['id_agent'] .
"&tab=module&edit_module=1&id_agent_module=" . $layoutData['id_agente_modulo'];
}
else {
$url = "index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente=" . $layoutData['id_agent'] .
"&tab=module&edit_module=1&id_agent_module=" . $layoutData['id_agente_modulo'];
}
break;
case GROUP_ITEM:
$is_a_link_to_other_visualconsole = false;
if ($layoutData['id_layout_linked'] != 0) {
@ -1143,6 +1157,9 @@ function visual_map_print_item($mode = "read", $layoutData,
case MODULE_GRAPH:
$class .= "module_graph";
break;
case MODULE_GRAPH:
$class .= "bars_graph";
break;
case SIMPLE_VALUE:
case SIMPLE_VALUE_MAX:
case SIMPLE_VALUE_MIN:
@ -1554,6 +1571,20 @@ function visual_map_print_item($mode = "read", $layoutData,
echo $img;
if ($layoutData['label_position']=='down') {
echo io_safe_output($text);
}
elseif($layoutData['label_position']=='left' || $layoutData['label_position']=='right') {
echo io_safe_output($text);
}
break;
case BARS_GRAPH:
if ($layoutData['label_position']=='up') {
echo io_safe_output($text);
}
echo $img;
if ($layoutData['label_position']=='down') {
echo io_safe_output($text);
}
@ -2947,6 +2978,10 @@ function visual_map_create_internal_name_item($label = null, $type, $image, $age
case MODULE_GRAPH:
$text = __('Module graph');
break;
case 'bars_graph':
case BARS_GRAPH:
$text = __('Bars graph');
break;
case 'auto_sla_graph':
case AUTO_SLA_GRAPH:
$text = __('Auto SLA Graph');
@ -3062,6 +3097,9 @@ function visual_map_type_in_js($type) {
case MODULE_GRAPH:
return 'module_graph';
break;
case BARS_GRAPH:
return 'bars_graph';
break;
case AUTO_SLA_GRAPH:
return 'auto_sla_graph';
break;

View File

@ -767,10 +767,10 @@ input.graph_min {
background: #fefefe url(../../images/chart_curve.png) no-repeat center !important;
}
input.graph_min[disabled] {
background: #fefefe url(../../images/chart_curve.disabled.png) no-repeat center !important;
background: #fefefe url(../../images/icono-barras-arriba.disabled.png) no-repeat center !important;
}
input.bars_graph_min {
background: #fefefe url(../../images/chart_curve.png) no-repeat center !important;
background: #fefefe url(../../images/icono-barras-arriba.png) no-repeat center !important;
}
input.bars_graph_min[disabled] {
background: #fefefe url(../../images/chart_curve.disabled.png) no-repeat center !important;