You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@atlas.apache.org by kb...@apache.org on 2019/04/24 12:27:48 UTC

[atlas] branch master updated: ATLAS-3154 UI - Lineage PNG export not working on Firefox

This is an automated email from the ASF dual-hosted git repository.

kbhatt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/atlas.git


The following commit(s) were added to refs/heads/master by this push:
     new 1c62015  ATLAS-3154 UI - Lineage PNG export not working on Firefox
1c62015 is described below

commit 1c6201559f3575f8f023b7a760259ebc4ef43ddd
Author: gutkaBinit <bi...@gmail.com>
AuthorDate: Wed Apr 24 17:22:16 2019 +0530

    ATLAS-3154 UI - Lineage PNG export not working on Firefox
    
    Signed-off-by: kevalbhatt <kb...@apache.org>
---
 dashboardv2/public/css/scss/graph.scss                  |  4 ++++
 .../public/js/views/detail_page/DetailPageLayoutView.js |  6 ++----
 dashboardv2/public/js/views/graph/LineageLayoutView.js  | 17 ++++++++---------
 3 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/dashboardv2/public/css/scss/graph.scss b/dashboardv2/public/css/scss/graph.scss
index ebb7c0b..457b3eb 100644
--- a/dashboardv2/public/css/scss/graph.scss
+++ b/dashboardv2/public/css/scss/graph.scss
@@ -318,6 +318,10 @@ g.type-TK>rect {
     color: $dark_gray;
     background: white;
 
+    &[disabled] {
+        opacity: .3;
+    }
+
     &:hover {
         border: 1px solid #686868;
         color: $dark_gray !important;
diff --git a/dashboardv2/public/js/views/detail_page/DetailPageLayoutView.js b/dashboardv2/public/js/views/detail_page/DetailPageLayoutView.js
index 92c42e3..ee22a9a 100644
--- a/dashboardv2/public/js/views/detail_page/DetailPageLayoutView.js
+++ b/dashboardv2/public/js/views/detail_page/DetailPageLayoutView.js
@@ -282,12 +282,10 @@ define(['require',
 
                         if (isLineageRender) {
                             this.$('.lineageGraph').show();
-                            this.renderLineageLayoutView({
+                            this.renderLineageLayoutView(_.extend(obj, {
                                 processCheck: isProcess,
-                                guid: this.id,
-                                entityDefCollection: this.entityDefCollection,
                                 fetchCollection: this.fetchCollection.bind(this),
-                            });
+                            }));
                         } else if (this.value && this.value.tabActive == "lineage") {
                             Utils.setUrl({
                                 url: Utils.getUrlState.getQueryUrl().queyParams[0],
diff --git a/dashboardv2/public/js/views/graph/LineageLayoutView.js b/dashboardv2/public/js/views/graph/LineageLayoutView.js
index 7b9ff58..6acd927 100644
--- a/dashboardv2/public/js/views/graph/LineageLayoutView.js
+++ b/dashboardv2/public/js/views/graph/LineageLayoutView.js
@@ -92,7 +92,7 @@ define(['require',
              * @constructs
              */
             initialize: function(options) {
-                _.extend(this, _.pick(options, 'processCheck', 'guid', 'entityDefCollection', 'actionCallBack', 'fetchCollection', 'attributeDefs'));
+                _.extend(this, _.pick(options, 'processCheck', 'guid', 'entity', 'entityName', 'entityDefCollection', 'actionCallBack', 'fetchCollection', 'attributeDefs'));
                 this.collection = new VLineageList();
                 this.lineageData = null;
                 this.typeMap = {};
@@ -912,12 +912,6 @@ define(['require',
             onClickSaveSvg: function(e, a) {
                 var that = this;
                 var loaderTargetDiv = $(e.currentTarget).find('>i');
-                if ($(e.currentTarget).hasClass('disabled')) {
-                    Utils.notifyWarn({
-                        content: "Lineage can be downloaded once it is rendered."
-                    });
-                    return false; // return if the lineage is not loaded.
-                }
 
                 if (loaderTargetDiv.hasClass('fa-refresh')) {
                     Utils.notifyWarn({
@@ -934,7 +928,11 @@ define(['require',
                 setTimeout(function() {
                     var svg = that.$('svg')[0],
                         svgClone = svg.cloneNode(true),
-                        scaleFactor = 1;
+                        scaleFactor = 1,
+                        svgWidth = that.$('svg').width(),
+                        svgHeight = that.$('svg').height();
+                    svgClone.setAttribute('width', svgWidth);
+                    svgClone.setAttribute('height', svgHeight);
 
                     $('.hidden-svg').html(svgClone);
                     $(svgClone).find('>g').attr("transform", "scale(" + scaleFactor + ")");
@@ -970,7 +968,8 @@ define(['require',
                     img.onload = function() {
                         try {
                             var a = document.createElement("a");
-                            a.download = "download.png";
+                            a.download = that.entityName + ".png";
+                            document.body.appendChild(a);
                             ctx.drawImage(img, 50, 50, canvas.width, canvas.height);
                             canvas.toBlob(function(blob) {
                                 if (!blob) {