This is an automated email from the ASF dual-hosted git repository. kbhatt pushed a commit to branch branch-1.0 in repository https://gitbox.apache.org/repos/asf/atlas.git
commit 31b4d25a6f577fe11c1f88a6ee427734ba73ea32 Author: gutkaBinit <binitgu...@gmail.com> AuthorDate: Tue May 21 09:59:33 2019 +0530 ATLAS-3213 UI : Png export not working in Safari Browser. (cherry picked from commit da13d53a049eebd6de2fa34283f5ac01f184708d) --- .../public/js/views/graph/LineageLayoutView.js | 44 +++++++++------------- dashboardv2/public/js/views/graph/LineageUtils.js | 14 +++++-- .../js/views/graph/PropagationPropertyModal.js | 2 +- 3 files changed, 29 insertions(+), 31 deletions(-) diff --git a/dashboardv2/public/js/views/graph/LineageLayoutView.js b/dashboardv2/public/js/views/graph/LineageLayoutView.js index 2495e71..34f0b39 100644 --- a/dashboardv2/public/js/views/graph/LineageLayoutView.js +++ b/dashboardv2/public/js/views/graph/LineageLayoutView.js @@ -603,10 +603,13 @@ define(['require', } }); } - getImageData({ - "imagePath": imagePath, - "imageIconPath": imageIconPath - }); + if (_.keys(imageObject).indexOf(imageIconPath) === -1) { + getImageData({ + "imagePath": imagePath, + "imageIconPath": imageIconPath + }); + } + if (_.isUndefined(imageObject[imageIconPath])) { // before img success imageObject[imageIconPath] = [d3.select(that)]; @@ -755,6 +758,7 @@ define(['require', return; } that.$('svg').removeClass('hover'); + that.$('svg').removeClass('hover-active'); LineageUtils.onHoverFade({ opacity: 1, selectedNode: d, @@ -825,39 +829,17 @@ define(['require', } }).init(); zoom.event(svg); - // console.log(this.$('svg')[0].getBBox()) - //svg.attr('height', this.g.graph().height * initialScale + 40); if (platform.name === "IE") { - - LineageUtils.refreshGraphForIE({ edgeEl: this.$('svg .edgePath') }); - // this.$('svg .edgePath').each(function(argument) { - // var childNode = $(this).find('marker'); - // console.log(childNode); - // $(this).find('marker').remove(); - // var eleRef = this; - // ++that.IEGraphRenderDone; - // setTimeout(function(argument) { - // $(eleRef).find('defs').append(childNode); - // --that.IEGraphRenderDone; - // if (that.IEGraphRenderDone === 0) { - // this.$('.fontLoader').hide(); - // this.$('svg').fadeTo(1000, 1) - // } - // }, 1000); - // }); } - // console.log(platform.name) - // if (platform.name !== "IE") { LineageUtils.DragNode({ svg: this.svg, g: this.g, guid: this.guid, edgeEl: this.$('svg .edgePath') }).init(); - // } }, renderLineageTypeSearch: function() { var that = this, @@ -987,7 +969,7 @@ define(['require', scaleFactor = 1, svgWidth = that.$('svg').width(), svgHeight = that.$('svg').height(); - if (platform.name != "Chrome") { + if (platform.name === "Firefox") { svgClone.setAttribute('width', svgWidth); svgClone.setAttribute('height', svgHeight); } @@ -1020,6 +1002,9 @@ define(['require', var img = new Image(canvas.width, canvas.height); var svgBlob = new Blob([data], { type: 'image/svg+xml;base64' }); + if (platform.name === "Safari") { + svgBlob = new Blob([data], { type: 'image/svg+xml' }); + } var url = DOMURL.createObjectURL(svgBlob); img.onload = function() { @@ -1045,6 +1030,11 @@ define(['require', } a.click(); that.toggleLoader(loaderTargetDiv); + if (platform.name === 'Safari') { + LineageUtils.refreshGraphForSafari({ + edgeEl: that.$('svg g.node') + }); + } }, 'image/png'); $('.hidden-svg').html(''); createCanvas.remove(); diff --git a/dashboardv2/public/js/views/graph/LineageUtils.js b/dashboardv2/public/js/views/graph/LineageUtils.js index a477e0b..2f50fbd 100644 --- a/dashboardv2/public/js/views/graph/LineageUtils.js +++ b/dashboardv2/public/js/views/graph/LineageUtils.js @@ -63,7 +63,6 @@ define(['require', ''], function(require) { nodeDrag.call(svg.selectAll("g.node")); edgeDrag.call(svg.selectAll("g.edgePath")); - // this.refreshGraphForIE(); }, dragstart: function(d) { d3.event.sourceEvent.stopPropagation(); @@ -159,9 +158,18 @@ define(['require', ''], function(require) { }, } } - + LinegaeUtils.refreshGraphForSafari = function(options) { + var edgePathEl = options.edgeEl, + IEGraphRenderDone = 0; + edgePathEl.each(function(argument) { + var eleRef = this, + childNode = $(this).find('pattern'); + setTimeout(function(argument) { + $(eleRef).find('defs').append(childNode); + }, 500); + }); + } LinegaeUtils.refreshGraphForIE = function(options) { - var edgePathEl = options.edgeEl, IEGraphRenderDone = 0; edgePathEl.each(function(argument) { diff --git a/dashboardv2/public/js/views/graph/PropagationPropertyModal.js b/dashboardv2/public/js/views/graph/PropagationPropertyModal.js index 9aef264..8bba109 100644 --- a/dashboardv2/public/js/views/graph/PropagationPropertyModal.js +++ b/dashboardv2/public/js/views/graph/PropagationPropertyModal.js @@ -318,7 +318,7 @@ define(['require', var that = this, notifyObj = { modal: true, - text: "It looks like you have been edited something. If you leave before saving, your changes will be lost.", + text: "It looks like you have edited something. If you leave before saving, your changes will be lost.", ok: function(argument) { that.viewType = that.ui.editPropagationType.is(":checked") ? "flow" : "table"; that.ui.editPropagationType.prop("checked", that.viewType === "flow" ? false : true).trigger("change");