mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-28 00:04:37 +02:00
Merge branch '2471-Custom_graphs_en_consolas_visuales' into 'develop'
2471 custom graphs en consolas visuales See merge request artica/pandorafms!1868
This commit is contained in:
commit
9eefa6ff85
@ -4,6 +4,7 @@ ALTER TABLE `tservice` ADD COLUMN `is_favourite` tinyint(1) NOT NULL default 0;
|
|||||||
UPDATE tservice SET `is_favourite` = 1 WHERE `name` REGEXP '^[_|.|\[|\(]';
|
UPDATE tservice SET `is_favourite` = 1 WHERE `name` REGEXP '^[_|.|\[|\(]';
|
||||||
|
|
||||||
ALTER TABLE tlayout_data ADD COLUMN `show_last_value` tinyint(1) UNSIGNED NULL default '0';
|
ALTER TABLE tlayout_data ADD COLUMN `show_last_value` tinyint(1) UNSIGNED NULL default '0';
|
||||||
|
ALTER TABLE tlayout_template_data ADD COLUMN `show_last_value` tinyint(1) UNSIGNED NULL default '0';
|
||||||
ALTER TABLE tlayout MODIFY `name` varchar(600) NOT NULL;
|
ALTER TABLE tlayout MODIFY `name` varchar(600) NOT NULL;
|
||||||
|
|
||||||
ALTER TABLE tmetaconsole_setup ADD COLUMN `meta_dbuser` text;
|
ALTER TABLE tmetaconsole_setup ADD COLUMN `meta_dbuser` text;
|
||||||
|
@ -1778,6 +1778,7 @@ CREATE TABLE IF NOT EXISTS `tlayout_template_data` (
|
|||||||
FOREIGN KEY (`id_layout_template`) REFERENCES tlayout_template(`id`) ON DELETE CASCADE ON UPDATE CASCADE
|
FOREIGN KEY (`id_layout_template`) REFERENCES tlayout_template(`id`) ON DELETE CASCADE ON UPDATE CASCADE
|
||||||
) ENGINE = InnoDB DEFAULT CHARSET=utf8;
|
) ENGINE = InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
|
ALTER TABLE tlayout_template_data ADD COLUMN `show_last_value` tinyint(1) UNSIGNED NULL default '0';
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- Table `tlog_graph_models`
|
-- Table `tlog_graph_models`
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
|
@ -849,8 +849,7 @@ function readFields() {
|
|||||||
|
|
||||||
values['enable_link'] = $("input[name=enable_link]").is(':checked') ? 1 : 0;
|
values['enable_link'] = $("input[name=enable_link]").is(':checked') ? 1 : 0;
|
||||||
values['id_group'] = $("select[name=group]").val();
|
values['id_group'] = $("select[name=group]").val();
|
||||||
values['id_custom_graph'] = parseInt(
|
values['id_custom_graph'] = $("#custom_graph option:selected").val();
|
||||||
$("#custom_graph option:selected").val());
|
|
||||||
values['width_box'] = parseInt(
|
values['width_box'] = parseInt(
|
||||||
$("input[name='width_box']").val());
|
$("input[name='width_box']").val());
|
||||||
values['height_box'] = parseInt(
|
values['height_box'] = parseInt(
|
||||||
@ -1715,7 +1714,12 @@ function loadFieldsFromDB(item) {
|
|||||||
.prop('checked', true);
|
.prop('checked', true);
|
||||||
$("input[name='radio_choice']").trigger('change');
|
$("input[name='radio_choice']").trigger('change');
|
||||||
|
|
||||||
$("#custom_graph option[value=" + data.id_custom_graph + "]").prop("selected", true);
|
if (is_metaconsole()){
|
||||||
|
$("#custom_graph option[value='" + data.id_custom_graph + '|' + data.id_metaconsole + "']").prop("selected", true);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$("#custom_graph option[value=" + data.id_custom_graph + "]").prop("selected", true);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2316,12 +2320,18 @@ function setModuleGraph(id_data) {
|
|||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
success: function (data)
|
success: function (data)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
var url_hack_metaconsole = '';
|
||||||
|
if (is_metaconsole()) {
|
||||||
|
url_hack_metaconsole = '../../';
|
||||||
|
}
|
||||||
|
|
||||||
if (data['no_data'] == true) {
|
if (data['no_data'] == true) {
|
||||||
$('#' + id_data).html(data['url']);
|
$('#' + id_data).html(data['url']);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if($("#module_row").css('display')!='none'){
|
if($("#module_row").css('display')!='none'){
|
||||||
$("#" + id_data + " img").attr('src', 'images/console/signes/module_graph.png');
|
$("#" + id_data + " img").attr('src', url_hack_metaconsole + 'images/console/signes/module_graph.png');
|
||||||
if($('#text-width_module_graph').val() == 0 || $('#text-height_module_graph').val() == 0){
|
if($('#text-width_module_graph').val() == 0 || $('#text-height_module_graph').val() == 0){
|
||||||
$("#" + id_data + " img").css('width', '300px');
|
$("#" + id_data + " img").css('width', '300px');
|
||||||
$("#" + id_data + " img").css('height', '180px');
|
$("#" + id_data + " img").css('height', '180px');
|
||||||
@ -2331,7 +2341,7 @@ function setModuleGraph(id_data) {
|
|||||||
$("#" + id_data + " img").css('height', $('#text-height_module_graph').val()+'px');
|
$("#" + id_data + " img").css('height', $('#text-height_module_graph').val()+'px');
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
$("#" + id_data + " img").attr('src', 'images/console/signes/custom_graph.png');
|
$("#" + id_data + " img").attr('src', url_hack_metaconsole + 'images/console/signes/custom_graph.png');
|
||||||
if($('#text-width_module_graph').val() == 0 || $('#text-height_module_graph').val() == 0){
|
if($('#text-width_module_graph').val() == 0 || $('#text-height_module_graph').val() == 0){
|
||||||
$("#" + id_data + " img").css('width', '300px');
|
$("#" + id_data + " img").css('width', '300px');
|
||||||
$("#" + id_data + " img").css('height', '180px');
|
$("#" + id_data + " img").css('height', '180px');
|
||||||
|
@ -431,9 +431,23 @@ foreach ($layoutDatas as $layoutData) {
|
|||||||
$modules = io_safe_output($modules);
|
$modules = io_safe_output($modules);
|
||||||
|
|
||||||
if ($layoutData['id_agent'] == 0 and $layoutData['id_custom_graph'] != 0) {
|
if ($layoutData['id_agent'] == 0 and $layoutData['id_custom_graph'] != 0) {
|
||||||
$table->data[$i + 2][1] = html_print_select_from_sql(
|
if(is_metaconsole()){
|
||||||
"SELECT id_graph, name FROM tgraph", 'custom_graph_' . $idLayoutData,
|
$graphs = array();
|
||||||
$layoutData['id_custom_graph'], '', __('None'), 0, true);
|
$graphs = metaconsole_get_custom_graphs(true);
|
||||||
|
$table->data[$i + 2][1] = html_print_select(
|
||||||
|
$graphs, 'custom_graph_' . $idLayoutData,
|
||||||
|
$layoutData['id_custom_graph'] . "|" . $layoutData['id_metaconsole'],
|
||||||
|
'', __('None'), 0, true
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$table->data[$i + 2][1] = html_print_select_from_sql(
|
||||||
|
"SELECT id_graph, name FROM tgraph",
|
||||||
|
'custom_graph_' . $idLayoutData,
|
||||||
|
$layoutData['id_custom_graph'],
|
||||||
|
'', __('None'), 0, true
|
||||||
|
);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$table->data[$i + 2][1] = html_print_select($modules,
|
$table->data[$i + 2][1] = html_print_select($modules,
|
||||||
'module_' . $idLayoutData,
|
'module_' . $idLayoutData,
|
||||||
@ -447,8 +461,6 @@ foreach ($layoutDatas as $layoutData) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//Empty
|
//Empty
|
||||||
$table->data[$i + 2][2] = '';
|
$table->data[$i + 2][2] = '';
|
||||||
|
|
||||||
|
@ -1207,12 +1207,28 @@ switch ($action) {
|
|||||||
case 'module_graph':
|
case 'module_graph':
|
||||||
$values['type'] = MODULE_GRAPH;
|
$values['type'] = MODULE_GRAPH;
|
||||||
|
|
||||||
|
if(is_metaconsole()){
|
||||||
|
$explode_id = explode("|", $values['id_custom_graph']);
|
||||||
|
$values['id_custom_graph'] = $explode_id[0];
|
||||||
|
$values['id_metaconsole'] = $explode_id[1];
|
||||||
|
}
|
||||||
|
|
||||||
if ($values['id_custom_graph'] > 0 ) {
|
if ($values['id_custom_graph'] > 0 ) {
|
||||||
$values['height'] = $height_module_graph;
|
$values['height'] = $height_module_graph;
|
||||||
$values['width'] = $width_module_graph;
|
$values['width'] = $width_module_graph;
|
||||||
|
|
||||||
|
if(is_metaconsole()){
|
||||||
|
$server_data = metaconsole_get_connection_by_id($values['id_metaconsole']);
|
||||||
|
// Establishes connection
|
||||||
|
if (metaconsole_load_external_db($server_data) !== NOERR) continue;
|
||||||
|
}
|
||||||
|
|
||||||
$graph_conf = db_get_row('tgraph', 'id_graph', $values['id_custom_graph']);
|
$graph_conf = db_get_row('tgraph', 'id_graph', $values['id_custom_graph']);
|
||||||
|
|
||||||
|
if(is_metaconsole()){
|
||||||
|
metaconsole_restore_db();
|
||||||
|
}
|
||||||
|
|
||||||
$graph_stacked = $graph_conf['stacked'];
|
$graph_stacked = $graph_conf['stacked'];
|
||||||
if ( $graph_stacked == CUSTOM_GRAPH_BULLET_CHART) {
|
if ( $graph_stacked == CUSTOM_GRAPH_BULLET_CHART) {
|
||||||
$values['height'] = 50;
|
$values['height'] = 50;
|
||||||
|
@ -313,19 +313,17 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
|
|||||||
html_print_radio_button('radio_choice', 'custom_graph', '', 'module_graph', true) .
|
html_print_radio_button('radio_choice', 'custom_graph', '', 'module_graph', true) .
|
||||||
'</td>';
|
'</td>';
|
||||||
|
|
||||||
|
|
||||||
$form_items['custom_graph_row'] = array();
|
$form_items['custom_graph_row'] = array();
|
||||||
$form_items['custom_graph_row']['items'] = array(
|
$form_items['custom_graph_row']['html'] = '<td align="left" style="">' . __('Custom graph') . '</td><td align="left" style="">';
|
||||||
'module_graph',
|
if(is_metaconsole()){
|
||||||
'datos');
|
$graphs = array();
|
||||||
$form_items['custom_graph_row']['html'] =
|
$graphs = metaconsole_get_custom_graphs(true);
|
||||||
'<td align="left" style="">' . __('Custom graph') . '</td>
|
$form_items['custom_graph_row']['html'] .= html_print_select($graphs, 'custom_graph', '', '', __('None'), 0, true);
|
||||||
<td align="left" style="">' .
|
}
|
||||||
html_print_select_from_sql(
|
else{
|
||||||
"SELECT id_graph, name FROM tgraph", 'custom_graph',
|
$form_items['custom_graph_row']['html'] .= html_print_select_from_sql("SELECT id_graph, name FROM tgraph", 'custom_graph','', '', __('None'), 0, true);
|
||||||
'', '', __('None'), 0, true) .
|
}
|
||||||
'</td>';
|
$form_items['custom_graph_row']['html'] .= '</td>';
|
||||||
|
|
||||||
|
|
||||||
$form_items['agent_row'] = array();
|
$form_items['agent_row'] = array();
|
||||||
$form_items['agent_row']['items'] = array('static_graph',
|
$form_items['agent_row']['items'] = array('static_graph',
|
||||||
|
@ -185,7 +185,7 @@ function d3_bullet_chart($chart_data, $width, $height, $color, $legend,
|
|||||||
.bullet g text { font-size:'.$font_size.'pt;}
|
.bullet g text { font-size:'.$font_size.'pt;}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
<script src="'. $config['homeurl'] . 'include/graphs/bullet.js"></script>
|
<script src="'. $homeurl . 'include/graphs/bullet.js"></script>
|
||||||
<script language="javascript" type="text/javascript">
|
<script language="javascript" type="text/javascript">
|
||||||
|
|
||||||
var margin = {top: 5, right: 40, bottom: 20, left: 120};
|
var margin = {top: 5, right: 40, bottom: 20, left: 120};
|
||||||
|
@ -3342,6 +3342,7 @@ CREATE TABLE IF NOT EXISTS `tlayout_template_data` (
|
|||||||
`clock_animation` varchar(60) NOT NULL default "analogic_1",
|
`clock_animation` varchar(60) NOT NULL default "analogic_1",
|
||||||
`time_format` varchar(60) NOT NULL default "time",
|
`time_format` varchar(60) NOT NULL default "time",
|
||||||
`timezone` varchar(60) NOT NULL default "Europe/Madrid",
|
`timezone` varchar(60) NOT NULL default "Europe/Madrid",
|
||||||
|
`show_last_value` tinyint(1) UNSIGNED NULL default '0',
|
||||||
PRIMARY KEY(`id`),
|
PRIMARY KEY(`id`),
|
||||||
FOREIGN KEY (`id_layout_template`) REFERENCES tlayout_template(`id`) ON DELETE CASCADE ON UPDATE CASCADE
|
FOREIGN KEY (`id_layout_template`) REFERENCES tlayout_template(`id`) ON DELETE CASCADE ON UPDATE CASCADE
|
||||||
) ENGINE = InnoDB DEFAULT CHARSET=utf8;
|
) ENGINE = InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user