Skip to content

After refresh of page, tooltips stop working #3149

@YongBoLiu

Description

@YongBoLiu

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);

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugUndesired behaviourresolvedA fixed issue

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions