Commit 1c620155 by gutkaBinit Committed by kevalbhatt

ATLAS-3154 UI - Lineage PNG export not working on Firefox

Signed-off-by: 's avatarkevalbhatt <kbhatt@apache.org>
parent c7566903
...@@ -318,6 +318,10 @@ g.type-TK>rect { ...@@ -318,6 +318,10 @@ g.type-TK>rect {
color: $dark_gray; color: $dark_gray;
background: white; background: white;
&[disabled] {
opacity: .3;
}
&:hover { &:hover {
border: 1px solid #686868; border: 1px solid #686868;
color: $dark_gray !important; color: $dark_gray !important;
......
...@@ -282,12 +282,10 @@ define(['require', ...@@ -282,12 +282,10 @@ define(['require',
if (isLineageRender) { if (isLineageRender) {
this.$('.lineageGraph').show(); this.$('.lineageGraph').show();
this.renderLineageLayoutView({ this.renderLineageLayoutView(_.extend(obj, {
processCheck: isProcess, processCheck: isProcess,
guid: this.id,
entityDefCollection: this.entityDefCollection,
fetchCollection: this.fetchCollection.bind(this), fetchCollection: this.fetchCollection.bind(this),
}); }));
} else if (this.value && this.value.tabActive == "lineage") { } else if (this.value && this.value.tabActive == "lineage") {
Utils.setUrl({ Utils.setUrl({
url: Utils.getUrlState.getQueryUrl().queyParams[0], url: Utils.getUrlState.getQueryUrl().queyParams[0],
......
...@@ -92,7 +92,7 @@ define(['require', ...@@ -92,7 +92,7 @@ define(['require',
* @constructs * @constructs
*/ */
initialize: function(options) { 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.collection = new VLineageList();
this.lineageData = null; this.lineageData = null;
this.typeMap = {}; this.typeMap = {};
...@@ -912,12 +912,6 @@ define(['require', ...@@ -912,12 +912,6 @@ define(['require',
onClickSaveSvg: function(e, a) { onClickSaveSvg: function(e, a) {
var that = this; var that = this;
var loaderTargetDiv = $(e.currentTarget).find('>i'); 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')) { if (loaderTargetDiv.hasClass('fa-refresh')) {
Utils.notifyWarn({ Utils.notifyWarn({
...@@ -934,7 +928,11 @@ define(['require', ...@@ -934,7 +928,11 @@ define(['require',
setTimeout(function() { setTimeout(function() {
var svg = that.$('svg')[0], var svg = that.$('svg')[0],
svgClone = svg.cloneNode(true), 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); $('.hidden-svg').html(svgClone);
$(svgClone).find('>g').attr("transform", "scale(" + scaleFactor + ")"); $(svgClone).find('>g').attr("transform", "scale(" + scaleFactor + ")");
...@@ -970,7 +968,8 @@ define(['require', ...@@ -970,7 +968,8 @@ define(['require',
img.onload = function() { img.onload = function() {
try { try {
var a = document.createElement("a"); 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); ctx.drawImage(img, 50, 50, canvas.width, canvas.height);
canvas.toBlob(function(blob) { canvas.toBlob(function(blob) {
if (!blob) { if (!blob) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment