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

After refresh of page, tooltips stop working #3149

Closed
YongBoLiu opened this issue Dec 17, 2019 · 5 comments
Closed

After refresh of page, tooltips stop working #3149

YongBoLiu opened this issue Dec 17, 2019 · 5 comments
Labels
bug Undesired behaviour resolved A fixed issue
Milestone

Comments

@YongBoLiu
Copy link
Contributor

YongBoLiu commented Dec 17, 2019

Describe the bug
A clear and concise description of what the bug is.
Use form_selectable_cell(), get_colored_device_status() to show device status with a tooltips, such as below, it shows ok, but after click the brower refresh button, the tooltips will never show up again.

--- /scratch/cacti/host.php	2019-12-10 14:00:24.685588000 +0800
+++ host.php	2019-12-17 10:29:37.267838752 +0800
@@ -1682,7 +1682,7 @@
 			form_selectable_cell(filter_value($host['id'], get_request_var('filter')), $host['id'], '', 'right');
 			form_selectable_cell('<a class="linkEditMain" href="' . $graphs_url . '">' . number_format_i18n($host['graphs'], '-1') . '</a>', $host['id'], '', 'right');
 			form_selectable_cell('<a class="linkEditMain" href="' . $data_source_url . '">' . number_format_i18n($host['data_sources'], '-1') . '</a>', $host['id'], '', 'right');
-			form_selectable_cell(get_colored_device_status(($host['disabled'] == 'on' ? true : false), $host['status']), $host['id'], '', 'center');
+			form_selectable_cell(get_colored_device_status(($host['disabled'] == 'on' ? true : false), $host['status']), $host['id'], '', 'center', 'xxx');
 			form_selectable_cell(get_timeinstate($host), $host['id'], '', 'right');
 			form_selectable_cell($uptime, $host['id'], '', 'right');
 			form_selectable_cell(round($host['polling_time'],2), $host['id'], '', 'right');

Tooltips do not work,
To Reproduce
Steps to reproduce the behavior:

  1. Call cacti API form_selectable_cell() and get_colored_device_status() with title parameter to show device status with tooltips.
  2. Move mouse on to the status, tooltips show up, it's ok
  3. Click browser refresh, then move mouse on to the status, tooltips never show up.

Expected behavior
A clear and concise description of what you expected to happen.
Use form_selectable_cell(), get_colored_device_status() to show device status with a tooltips, always be ok.

Screenshots
If applicable, add screenshots to help explain your problem.

Untitled

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]
    Firefox and Chrome.

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]
    In cacti 1.2.x

Additional context
Add any other context about the problem here.
After check the Jquery code ./cacti/include/js/jquery-ui.js, the title of the parent will be cleaned. as below,
// Kill parent tooltips, custom or native, for hover
if ( event && event.type === "mouseover" ) {
target.parents().each( function() {
..........
if ( parent.attr( "title" ) ) {
parent.uniqueId();
that.parents[ this.id ] = {
element: this,
title: parent.attr( "title" )
};
parent.attr( "title", "" );
}
} );
}

When span with title has a child span, the tooltips will not work well. Because the event target is the child span, and the title of the parent span will be not cleaned up. So, we'd not set the tooltip items too aggressive. I think we can change the code as below,

--- /scratch/cacti/include/layout.js	2019-12-10 14:00:21.425828000 +0800
+++ include/layout.js	2019-12-17 09:57:05.791282421 +0800
@@ -709,7 +709,7 @@
 	});
 
 	$(document).tooltip({
-		items: 'div.cactiTooltipHint, span.cactiTooltipHint, a, span, .checkboxSlider',
+		items: 'div.cactiTooltipHint, span.cactiTooltipHint, .checkboxSlider',
 		content: function() {
 			var element = $(this);
@netniV
Copy link
Member

netniV commented Dec 17, 2019

I'm sure that will have some issues on an anchor link, but have you tested it out on your systems?

@YongBoLiu
Copy link
Contributor Author

@netniV yes, tested on my system. It works fine on my system after remove the item (a, span).

@netniV
Copy link
Member

netniV commented Dec 18, 2019

Are you going to submit a PR then?

@YongBoLiu
Copy link
Contributor Author

@netniV , ok. Got it. Thanks.

@cigamit
Copy link
Member

cigamit commented Dec 22, 2019

In the future, please reference the issue that you have logged in the PR.

@cigamit cigamit added bug Undesired behaviour resolved A fixed issue labels Dec 22, 2019
@cigamit cigamit added this to the v1.2.9 milestone Dec 22, 2019
@cigamit cigamit closed this as completed Jan 4, 2020
@netniV netniV changed the title show device status with tooltips do not work after refresh After refresh of page, tooltips stop working Feb 10, 2020
@github-actions github-actions bot locked and limited conversation to collaborators Jun 30, 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