Added sla_auto_graph item to vc first version
This commit is contained in:
parent
8f2b4fb783
commit
d57508f09e
|
@ -295,7 +295,6 @@ function update_button_palette_callback() {
|
|||
break;
|
||||
case 'percentile_bar':
|
||||
case 'percentile_item':
|
||||
|
||||
if($('input[name=width_percentile]').val() == ''){
|
||||
alert('Undefined width');
|
||||
return false;
|
||||
|
@ -305,7 +304,6 @@ function update_button_palette_callback() {
|
|||
return false;
|
||||
}
|
||||
|
||||
|
||||
$("#text_" + idItem).html(values['label']);
|
||||
$("#image_" + idItem).attr("src", "images/spinner.gif");
|
||||
if (values['type_percentile'] == 'bubble') {
|
||||
|
@ -315,12 +313,8 @@ function update_button_palette_callback() {
|
|||
setPercentileBar(idItem, values);
|
||||
}
|
||||
|
||||
|
||||
|
||||
break;
|
||||
case 'module_graph':
|
||||
|
||||
|
||||
if($('#dir_items').html() == 'horizontal'){
|
||||
if(parseInt($('#text-left').val()) + (parseInt($('input[name=height_module_graph]').val() * $('#count_items').html())) > parseInt($('#background').css('width'))
|
||||
|| parseInt($('#text-left').val()) + (parseInt($('input[name=width_module_graph]').val() * $('#count_items').html())) > parseInt($('#background').css('width'))){
|
||||
|
@ -339,7 +333,6 @@ function update_button_palette_callback() {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
if($('input[name=width_module_graph]').val() == ''){
|
||||
alert('Undefined width');
|
||||
return false;
|
||||
|
@ -353,12 +346,24 @@ function update_button_palette_callback() {
|
|||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
$("#text_" + idItem).html(values['label']);
|
||||
$("#image_" + idItem).attr("src", "images/spinner.gif");
|
||||
setModuleGraph(idItem);
|
||||
break;
|
||||
case 'auto_sla_graph':
|
||||
if($('input[name=width]').val() == ''){
|
||||
alert('Undefined width');
|
||||
return false;
|
||||
}
|
||||
if($('input[name=height]').val() == ''){
|
||||
alert('Undefined height');
|
||||
return false;
|
||||
}
|
||||
$("#text_" + idItem).html(values['label']);
|
||||
$("#image_" + idItem).attr("src", "images/spinner.gif");
|
||||
|
||||
setEventsBar(idItem, values);
|
||||
break;
|
||||
case 'simple_value':
|
||||
$("#text_" + idItem).html(values['label']);
|
||||
//$("#simplevalue_" + idItem)
|
||||
|
@ -369,7 +374,6 @@ function update_button_palette_callback() {
|
|||
$("#text_" + idItem).html(values['label']);
|
||||
break;
|
||||
case 'icon':
|
||||
|
||||
if($('input[name=width]').val() == ''){
|
||||
alert('Undefined width');
|
||||
return false;
|
||||
|
@ -872,6 +876,7 @@ function toggle_item_palette() {
|
|||
activeToolboxButton('group_item', true);
|
||||
activeToolboxButton('box_item', true);
|
||||
activeToolboxButton('line_item', true);
|
||||
activeToolboxButton('auto_sla_graph', true);
|
||||
|
||||
if (typeof(enterprise_activeToolboxButton) == 'function') {
|
||||
enterprise_activeToolboxButton(true);
|
||||
|
@ -891,6 +896,7 @@ function toggle_item_palette() {
|
|||
|
||||
activeToolboxButton('static_graph', false);
|
||||
activeToolboxButton('module_graph', false);
|
||||
activeToolboxButton('auto_sla_graph', false);
|
||||
activeToolboxButton('simple_value', false);
|
||||
activeToolboxButton('label', false);
|
||||
activeToolboxButton('icon', false);
|
||||
|
@ -1023,6 +1029,8 @@ function loadFieldsFromDB(item) {
|
|||
fill_parent_select(idItem);
|
||||
|
||||
jQuery.each(data, function(key, val) {
|
||||
if (key == 'event_max_time_row')
|
||||
$("select[name=event_max_time_row]").val(val);
|
||||
if (key == 'background')
|
||||
$("#background_image").val(val);
|
||||
if (key == 'width') $("input[name=width]").val(val);
|
||||
|
@ -2478,13 +2486,13 @@ function updateDB_visual(type, idElement , values, event, top, left) {
|
|||
set_static_graph_status(idElement, values['image']);
|
||||
|
||||
}
|
||||
break;
|
||||
case 'percentile_item':
|
||||
case 'simple_value':
|
||||
case 'label':
|
||||
case 'icon':
|
||||
case 'module_graph':
|
||||
|
||||
|
||||
case 'auto_sla_graph':
|
||||
if (type == 'simple_value') {
|
||||
setModuleValue(idElement,
|
||||
values.process_simple_value,
|
||||
|
@ -2708,8 +2716,6 @@ function updateDB(type, idElement , values, event) {
|
|||
function copyDB(idItem) {
|
||||
metaconsole = $("input[name='metaconsole']").val();
|
||||
|
||||
|
||||
|
||||
parameter = Array();
|
||||
parameter.push ({name: "page", value: "include/ajax/visual_console_builder.ajax"});
|
||||
parameter.push ({name: "action", value: "copy"});
|
||||
|
@ -2880,6 +2886,15 @@ function eventsItems(drag) {
|
|||
activeToolboxButton('delete_item', true);
|
||||
activeToolboxButton('show_grid', false);
|
||||
}
|
||||
if ($(divParent).hasClass('auto_sla_graph')) {
|
||||
creationItem = null;
|
||||
selectedItem = 'auto_sla_graph';
|
||||
idItem = $(divParent).attr('id');
|
||||
activeToolboxButton('copy_item', true);
|
||||
activeToolboxButton('edit_item', true);
|
||||
activeToolboxButton('delete_item', true);
|
||||
activeToolboxButton('show_grid', false);
|
||||
}
|
||||
if ($(divParent).hasClass('group_item')) {
|
||||
creationItem = null;
|
||||
selectedItem = 'group_item';
|
||||
|
@ -2987,6 +3002,9 @@ function eventsItems(drag) {
|
|||
if ($(event.target).hasClass('static_graph')) {
|
||||
selectedItem = 'static_graph';
|
||||
}
|
||||
if ($(event.target).hasClass('auto_sla_graph')) {
|
||||
selectedItem = 'auto_sla_graph';
|
||||
}
|
||||
if ($(event.target).hasClass('group_item')) {
|
||||
selectedItem = 'group_item';
|
||||
}
|
||||
|
@ -3344,7 +3362,7 @@ function click_button_toolbox(id) {
|
|||
activeToolboxButton('icon', false);
|
||||
activeToolboxButton('service', false);
|
||||
activeToolboxButton('group_item', false);
|
||||
|
||||
activeToolboxButton('auto_sla_graph', false);
|
||||
activeToolboxButton('copy_item', false);
|
||||
activeToolboxButton('edit_item', false);
|
||||
activeToolboxButton('delete_item', false);
|
||||
|
@ -3374,6 +3392,7 @@ function click_button_toolbox(id) {
|
|||
activeToolboxButton('label', true);
|
||||
activeToolboxButton('icon', true);
|
||||
activeToolboxButton('group_item', true);
|
||||
activeToolboxButton('auto_sla_graph', true);
|
||||
}
|
||||
break;
|
||||
case 'save_visualmap':
|
||||
|
|
|
@ -456,12 +456,14 @@ switch ($action) {
|
|||
$process_simple_value);
|
||||
$values['period'] = $period;
|
||||
}
|
||||
break;
|
||||
case 'percentile_bar':
|
||||
case 'percentile_item':
|
||||
case 'static_graph':
|
||||
case 'module_graph':
|
||||
case 'label':
|
||||
case 'icon':
|
||||
case 'auto_sla_graph':
|
||||
default:
|
||||
if ($type == 'label') {
|
||||
$values['type'] = LABEL;
|
||||
|
@ -536,6 +538,18 @@ switch ($action) {
|
|||
$values['border_color'] = $line_color;
|
||||
break;
|
||||
// -------------------------------------------------
|
||||
case 'auto_sla_graph':
|
||||
$values['type'] = AUTO_SLA_GRAPH;
|
||||
if ($event_max_time_row !== null) {
|
||||
$values['period'] = $event_max_time_row;
|
||||
}
|
||||
if ($width !== null) {
|
||||
$values['width'] = $width;
|
||||
}
|
||||
if ($height !== null) {
|
||||
$values['height'] = $height;
|
||||
}
|
||||
break;
|
||||
case 'box_item':
|
||||
$values['border_width'] = $border_width;
|
||||
$values['border_color'] = $border_color;
|
||||
|
@ -691,6 +705,7 @@ switch ($action) {
|
|||
case 'simple_value':
|
||||
case 'label':
|
||||
case 'icon':
|
||||
case 'auto_sla_graph':
|
||||
$elementFields = db_get_row_filter('tlayout_data',
|
||||
array('id' => $id_element));
|
||||
|
||||
|
@ -742,6 +757,8 @@ switch ($action) {
|
|||
}
|
||||
|
||||
switch ($type) {
|
||||
case 'auto_sla_graph':
|
||||
$elementFields['event_max_time_row'] = $elementFields['period'];
|
||||
case 'percentile_item':
|
||||
case 'percentile_bar':
|
||||
$elementFields['width_percentile'] = $elementFields['width'];
|
||||
|
@ -1022,8 +1039,6 @@ switch ($action) {
|
|||
echo json_encode($return);
|
||||
break;
|
||||
|
||||
|
||||
|
||||
case 'delete':
|
||||
if (db_process_sql_delete('tlayout_data', array('id' => $id_element, 'id_layout' => $id_visual_console)) === false) {
|
||||
$return['correct'] = 0;
|
||||
|
|
|
@ -156,6 +156,7 @@ function visual_map_print_item($mode = "read", $layoutData,
|
|||
$wimg ='70';
|
||||
break;
|
||||
case 3:
|
||||
case 14:
|
||||
if (get_parameter('action') == 'edit') {
|
||||
$himg = '30';
|
||||
$wimg = '150';
|
||||
|
@ -1066,8 +1067,6 @@ function visual_map_print_item($mode = "read", $layoutData,
|
|||
metaconsole_restore_db();
|
||||
}
|
||||
|
||||
//$img = str_replace('>', 'class="image" id="image_' . $id . '" />', $img);
|
||||
|
||||
break;
|
||||
case LABEL:
|
||||
$z_index = 4 + 1;
|
||||
|
@ -1096,11 +1095,31 @@ function visual_map_print_item($mode = "read", $layoutData,
|
|||
}
|
||||
else {
|
||||
if ($width == 0 || $height == 0) {
|
||||
if ($layoutData['label_position']=='left') {
|
||||
$img = '<div style="float:left;height:'.$himg.'px;">' .
|
||||
$img = graph_graphic_agentevents ($layoutData['id_agent'], 500, 50, $layoutData['period'], '', true, $layoutData['id_agente_modulo']);
|
||||
}
|
||||
elseif ($layoutData['label_position']=='right') {
|
||||
$img = '<div style="float:right;height:'.$himg.'px;">' .
|
||||
$img = graph_graphic_agentevents ($layoutData['id_agent'], 500, 50, $layoutData['period'], '', true, $layoutData['id_agente_modulo']);
|
||||
}
|
||||
else {
|
||||
$img = graph_graphic_agentevents ($layoutData['id_agent'], 500, 50, $layoutData['period'], '', true, $layoutData['id_agente_modulo']);
|
||||
}
|
||||
}
|
||||
else{
|
||||
if ($layoutData['label_position']=='left') {
|
||||
$img = '<div style="float:left;height:'.$himg.'px;">' .
|
||||
$img = graph_graphic_agentevents ($layoutData['id_agent'], $width, $height, $layoutData['period'], '', true, $layoutData['id_agente_modulo']);
|
||||
}
|
||||
elseif ($layoutData['label_position']=='right') {
|
||||
$img = '<div style="float:right;height:'.$himg.'px;">' .
|
||||
$img = graph_graphic_agentevents ($layoutData['id_agent'], $width, $height, $layoutData['period'], '', true, $layoutData['id_agente_modulo']);
|
||||
}
|
||||
else {
|
||||
$img = graph_graphic_agentevents ($layoutData['id_agent'], $width, $height, $layoutData['period'], '', true, $layoutData['id_agente_modulo']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Restore db connection
|
||||
|
@ -1111,7 +1130,7 @@ function visual_map_print_item($mode = "read", $layoutData,
|
|||
$z_index = 2 + 1;
|
||||
break;
|
||||
}
|
||||
html_debug(get_parameter('action'), true);
|
||||
|
||||
$class = "item ";
|
||||
switch ($type) {
|
||||
case STATIC_GRAPH:
|
||||
|
@ -1454,7 +1473,18 @@ function visual_map_print_item($mode = "read", $layoutData,
|
|||
}
|
||||
break;
|
||||
case AUTO_SLA_GRAPH:
|
||||
if ($layoutData['label_position']=='up') {
|
||||
echo io_safe_output($text);
|
||||
}
|
||||
|
||||
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 SIMPLE_VALUE:
|
||||
case SIMPLE_VALUE_MAX:
|
||||
|
@ -1484,43 +1514,13 @@ function visual_map_print_item($mode = "read", $layoutData,
|
|||
$layoutData['id_agente_modulo'], $period);
|
||||
|
||||
global $config;
|
||||
|
||||
if ($type == SIMPLE_VALUE) {
|
||||
//~ $returnValue_value = explode(' ', $value);
|
||||
|
||||
//~ if ($returnValue_value[1] != "") {
|
||||
//~ $value = remove_right_zeros(number_format($returnValue_value[0], $config['graph_precision'])) . " " . $returnValue_value[1];
|
||||
//~ }
|
||||
//~ else {
|
||||
//~ $value = remove_right_zeros(number_format($returnValue_value[0], $config['graph_precision']));
|
||||
//~ }
|
||||
|
||||
}
|
||||
else {
|
||||
// If the value is a string, dont format it
|
||||
if (!is_string($value)) {
|
||||
//~ $value = remove_right_zeros(format_for_graph($value, $config['graph_precision']));
|
||||
}
|
||||
}
|
||||
|
||||
//$io_safe_output_text = str_replace(array('_VALUE_','_value_'), $value, $io_safe_output_text);
|
||||
|
||||
|
||||
|
||||
if(get_parameter('action') == 'edit'){
|
||||
|
||||
//echo 'Data value';
|
||||
|
||||
echo $io_safe_output_text;
|
||||
|
||||
}
|
||||
else{
|
||||
|
||||
echo str_replace(array('_VALUE_','_value_'), $value, $io_safe_output_text);
|
||||
|
||||
}
|
||||
|
||||
|
||||
//Restore db connection
|
||||
if ($layoutData['id_metaconsole'] != 0) {
|
||||
metaconsole_restore_db();
|
||||
|
@ -2931,6 +2931,9 @@ function visual_map_type_in_js($type) {
|
|||
case MODULE_GRAPH:
|
||||
return 'module_graph';
|
||||
break;
|
||||
case AUTO_SLA_GRAPH:
|
||||
return 'auto_sla_graph';
|
||||
break;
|
||||
case SIMPLE_VALUE:
|
||||
return 'simple_value';
|
||||
break;
|
||||
|
|
|
@ -154,7 +154,6 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
|
|||
html_print_input_text('height_module_graph', 180, '', 3, 5, true) .
|
||||
'</td>';
|
||||
|
||||
|
||||
$form_items['label_row'] = array();
|
||||
$form_items['label_row']['items'] = array('label',
|
||||
'static_graph',
|
||||
|
@ -163,7 +162,8 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
|
|||
'module_graph',
|
||||
'simple_value',
|
||||
'datos',
|
||||
'group_item');
|
||||
'group_item',
|
||||
'auto_sla_graph');
|
||||
$form_items['label_row']['html'] =
|
||||
'<td align="left" valign="top" style="">' . __('Label') . '
|
||||
|
||||
|
@ -540,7 +540,7 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
|
|||
$form_items_advance['parent_row']['items'] = array(
|
||||
'group_item', 'static_graph',
|
||||
'percentile_bar', 'percentile_item', 'module_graph',
|
||||
'simple_value', 'label', 'icon', 'datos');
|
||||
'simple_value', 'label', 'icon', 'datos', 'auto_sla_graph');
|
||||
$form_items_advance['parent_row']['html'] = '<td align="left">' .
|
||||
__('Parent') . '</td>
|
||||
<td align="left">' .
|
||||
|
|
|
@ -635,6 +635,10 @@ function pandoraFlotSlicebar(graph_id, values, datacolor, labels, legend, acumul
|
|||
|
||||
var stack = 0, bars = true, lines = false, steps = false;
|
||||
|
||||
var regex = /visual_console/;
|
||||
var match = regex.exec(window.location.href);
|
||||
|
||||
if (match == null) {
|
||||
var options = {
|
||||
series: {
|
||||
stack: stack,
|
||||
|
@ -662,9 +666,40 @@ function pandoraFlotSlicebar(graph_id, values, datacolor, labels, legend, acumul
|
|||
show: false
|
||||
}
|
||||
};
|
||||
}
|
||||
else {
|
||||
var options = {
|
||||
series: {
|
||||
stack: stack,
|
||||
shadowSize: 0.1,
|
||||
color: '#ddd'
|
||||
},
|
||||
grid: {
|
||||
hoverable: false,
|
||||
clickable: false,
|
||||
borderWidth:1,
|
||||
borderColor: '',
|
||||
tickColor: '#fff'
|
||||
},
|
||||
xaxes: [ {
|
||||
tickFormatter: xFormatter,
|
||||
color: '',
|
||||
tickSize: intervaltick,
|
||||
tickLength: 0
|
||||
} ],
|
||||
yaxes: [ {
|
||||
show: false,
|
||||
tickLength: 0
|
||||
}],
|
||||
legend: {
|
||||
show: false
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
var plot = $.plot($('#'+graph_id), datas, options );
|
||||
|
||||
if (match == null) {
|
||||
// Events
|
||||
$('#'+graph_id).bind('plothover', function (event, pos, item) {
|
||||
if (item) {
|
||||
|
@ -704,9 +739,8 @@ function pandoraFlotSlicebar(graph_id, values, datacolor, labels, legend, acumul
|
|||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
$('#'+graph_id).bind('mouseout',resetInteractivity);
|
||||
}
|
||||
|
||||
// Reset interactivity styles
|
||||
function resetInteractivity() {
|
||||
|
|
Loading…
Reference in New Issue