diff --git a/docs/en_US/release_notes_6_3.rst b/docs/en_US/release_notes_6_3.rst index f0fe7a170..d980bbc55 100644 --- a/docs/en_US/release_notes_6_3.rst +++ b/docs/en_US/release_notes_6_3.rst @@ -23,6 +23,7 @@ Housekeeping Bug fixes ********* +| `Issue #6840 `_ - Fixed an issue where tooltip data are not displaying on downloaded graphical explain plan. | `Issue #6906 `_ - Fixed an issue where referenced table drop-down should be disabled in foreign key -> columns after one row is added. | `Issue #6955 `_ - Ensure that sort order should be maintained when renaming a server group. | `Issue #6963 `_ - Ensure that the user should be allowed to set the schema of an extension while creating it. diff --git a/web/pgadmin/misc/static/explain/js/explain.js b/web/pgadmin/misc/static/explain/js/explain.js index a3a0ff4f9..da50040fd 100644 --- a/web/pgadmin/misc/static/explain/js/explain.js +++ b/web/pgadmin/misc/static/explain/js/explain.js @@ -937,7 +937,7 @@ define('pgadmin.misc.explain', [ drawImage: function( g, image_content, currentXpos, currentYpos, graphContainer, - toolTipContainer + toolTipContainer, downloadSVG=false ) { // Draw the actual image for current node var image = g.image( @@ -955,6 +955,73 @@ define('pgadmin.misc.explain', [ // Draw tooltip var image_data = this.toJSON(), nodeLabel = this.getLabel(); + + if (downloadSVG) { + var title = ''; + _.each(image_data, function (value, key) { + if ( + key !== 'image' && + key !== 'Plans' && + key !== 'level' && + key !== 'image' && + key !== 'image_text' && + key !== 'xpos' && + key !== 'ypos' && + key !== 'width' && + key !== 'height' + ) { + title += `${key}: ${value}\n`; + } + }); + + title += ''; + + image.append(Snap.parse(title)); + + image.mouseover(() => { + // Empty the tooltip content if it has any and add new data + let toolTipBody = toolTipContainer.find('.details-body'); + let toolTipTitle = toolTipContainer.find('.details-title'); + toolTipTitle.text(nodeLabel); + + toolTipBody.empty(); + + // Remove the title content so that we can show our custom build tooltips. + image.node.textContent = ''; + + var tooltipTable = $(` + + +
`).appendTo(toolTipBody); + var tooltip = tooltipTable.find('tbody'); + + _.each(image_data, function (value, key) { + if ( + key !== 'image' && + key !== 'Plans' && + key !== 'level' && + key !== 'image' && + key !== 'image_text' && + key !== 'xpos' && + key !== 'ypos' && + key !== 'width' && + key !== 'height' + ) { + key = _.escape(key); + value = _.escape(value); + tooltip.append(` + + ${key} + ${value} + + `); + } + }); + toolTipContainer.removeClass('d-none'); + toolTipBody.scrollTop(0); + }); + } + image.click(() => { // Empty the tooltip content if it has any and add new data let toolTipBody = toolTipContainer.find('.details-body'); @@ -1033,10 +1100,11 @@ define('pgadmin.misc.explain', [ var onSVGLoaded = function(data) { var svg_image = Snap(); svg_image.append(data); + var downloadSVG = true; that.drawImage( g, svg_image.toDataURL(), startX, startY, graphContainer, - toolTipContainer + toolTipContainer, downloadSVG ); // This attribute is required to download the file as SVG image.