Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Graphs can incorrectly show as 'Empty Graph' #3579

Closed
YongBoLiu opened this issue May 28, 2020 · 6 comments
Closed

Graphs can incorrectly show as 'Empty Graph' #3579

YongBoLiu opened this issue May 28, 2020 · 6 comments
Labels
bug Undesired behaviour resolved A fixed issue
Milestone

Comments

@YongBoLiu
Copy link
Contributor

Describe the bug

A clear and concise description of what the bug is.
The graph title can be set as 'Reg |query_region| - Project |query_project| - |query_feature| - xxx', if user only set query_project and query_feature, not set query_region.
The graph title show as 'Empty Graph'. It is weird to users.

Users prefer to 'Reg |query_region| - Project project1 - feature1- xxx' than 'Empty Graph'. And sometimes users may set the |query_region| after graph created.

To Reproduce

  1. Add a graph template , set the title as 'Reg |query_region| - Project |query_project| - |query_feature| - xxx'.

  2. Add a data query, associate the graph template to the data query.

  3. User set the query_project and query_feature, but not set query_region.

  4. After graphs created, all the graphs base on the 'Reg |query_region| - Project |query_project| - |query_feature| - xxx', show as 'Empty Graph'.

Expected behavior

A clear and concise description of what you expected to happen.

Screenshots

If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information)

  • OS: [e.g. iOS]

  • Browser [e.g. chrome, safari]

  • Version [e.g. 22]

Smartphone (please complete the following information)

  • Device: [e.g. iPhone6]

  • OS: [e.g. iOS8.1]

  • Browser [e.g. stock browser, safari]
    firefox 60.5

  • Version [e.g. 22]

Additional context

Add any other context about the problem here.

@YongBoLiu YongBoLiu added bug Undesired behaviour unverified Some days we don't have a clue labels May 28, 2020
@YongBoLiu
Copy link
Contributor Author

YongBoLiu commented May 28, 2020

The condition is added two years ago, but the graph title is different from data source title, it is more chance to be set by users.
So, I think the condition should be removed as below.

diff -u -N rtm/cacti/lib/variables.php rtm/cacti/lib/variables.php
--- rtm/cacti/lib/variables.php	2020-04-20 10:54:42.000000000 +0800
+++ rtm/cacti/lib/variables.php	2020-05-28 15:45:28.000000942 +0800
@@ -180,12 +180,10 @@
 function update_graph_title_cache($local_graph_id) {
 	$graph_title = get_graph_title($local_graph_id);
 
-	if (strstr($graph_title, '|query_') === false && strstr($graph_title, '|host_') === false) {
 		db_execute_prepared('UPDATE graph_templates_graph
 			SET title_cache = ?
 			WHERE local_graph_id = ?',
 			array($graph_title, $local_graph_id));
-	}
 }
 
 /* null_out_substitutions - takes a string and cleans out any host variables that do not have values

@netniV
Copy link
Member

netniV commented May 29, 2020

It looks good, but does mean that there would potentially be more updates to the DB. However, since most graphs use one of those, I would agree it seems to make sense.

netniV added a commit that referenced this issue May 29, 2020
* Fix #3496, percent sign(%) is doubled in graph item of AREA type with text

* feature #3513, Add hooks for plugins to show customize graph source and customize template url

* feature #3513, Update changelog, Add hooks for plugins to show customize graph source and customize template url

* 3579, Fix it is strange that many graphs show as 'Empty Graph'.

* 3579, update change log

* 3586, Add the change log.

Co-authored-by: yboliu <yboliu@oc8636837557.ibm.com>
Co-authored-by: Mark Brugnoli-Vinten <netniv@hotmail.com>
TheWitness added a commit that referenced this issue May 30, 2020
If a graph has already been given a name, and the data query fails, don't change the name.  The should correct the issue in #3579, while at the same time correcting this issue.
@TheWitness
Copy link
Member

I had to make a change to this as it has missed a key reason for the original change. So, please change the updated lib/variables.php.

@TheWitness TheWitness added resolved A fixed issue and removed unverified Some days we don't have a clue labels May 30, 2020
@TheWitness TheWitness added this to the 1.2.13 milestone May 30, 2020
@netniV
Copy link
Member

netniV commented May 30, 2020

You are checking if old title is blank, what it is false (no row) or considered null? Can that happen? Haven’t checked it fully against the schema as on my mobile

@TheWitness
Copy link
Member

Default is not null or blank..

@netniV
Copy link
Member

netniV commented May 31, 2020

OK, so as long as schema is correct, my worry should never occur 👍

@netniV netniV changed the title It is strange that many graphs show as 'Empty Graph' Graphs can incorrectly show as 'Empty Graph' Jul 12, 2020
@github-actions github-actions bot locked and limited conversation to collaborators Oct 11, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Undesired behaviour resolved A fixed issue
Projects
None yet
Development

No branches or pull requests

3 participants