From 3daad52aa5869dbc6343a217982e257b1f65739f Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Wed, 23 Oct 2024 12:57:45 +0200 Subject: [PATCH 1/2] newLine --- .../client/source/class/osparc/widget/logger/LoggerView.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/services/static-webserver/client/source/class/osparc/widget/logger/LoggerView.js b/services/static-webserver/client/source/class/osparc/widget/logger/LoggerView.js index 3ad1b437301c..564131370ad2 100644 --- a/services/static-webserver/client/source/class/osparc/widget/logger/LoggerView.js +++ b/services/static-webserver/client/source/class/osparc/widget/logger/LoggerView.js @@ -317,9 +317,10 @@ qx.Class.define("osparc.widget.logger.LoggerView", { }, __getLogsString: function() { + const newLine = "\r\n"; let logs = ""; this.__loggerModel.getFilteredRows().forEach(rowData => { - logs += this.self().printRow(rowData) + "\n"; + logs += this.self().printRow(rowData) + newLine; }); return logs; }, From e83f1253836a3eeb758ae9ff9d1da39e400bc771 Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Wed, 23 Oct 2024 13:26:17 +0200 Subject: [PATCH 2/2] downloadBlobContent --- .../client/source/class/osparc/utils/Utils.js | 7 +++---- .../client/source/class/osparc/widget/logger/LoggerView.js | 5 +++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/utils/Utils.js b/services/static-webserver/client/source/class/osparc/utils/Utils.js index d4b8aa9de481..8124b6818e19 100644 --- a/services/static-webserver/client/source/class/osparc/utils/Utils.js +++ b/services/static-webserver/client/source/class/osparc/utils/Utils.js @@ -804,11 +804,10 @@ qx.Class.define("osparc.utils.Utils", { loadedCb(); } const blob = new Blob([xhr.response]); - const urlBlob = window.URL.createObjectURL(blob); if (!fileName) { fileName = this.self().filenameFromContentDisposition(xhr); } - this.self().downloadContent(urlBlob, fileName); + this.self().downloadBlobContent(blob, fileName); resolve(); } else { reject(xhr); @@ -820,9 +819,9 @@ qx.Class.define("osparc.utils.Utils", { }); }, - downloadContent: function(content, filename = "file") { + downloadBlobContent: function(blob, filename = "file") { let downloadAnchorNode = document.createElement("a"); - downloadAnchorNode.setAttribute("href", content); + downloadAnchorNode.setAttribute("href", window.URL.createObjectURL(blob)); downloadAnchorNode.setAttribute("download", filename); downloadAnchorNode.click(); downloadAnchorNode.remove(); diff --git a/services/static-webserver/client/source/class/osparc/widget/logger/LoggerView.js b/services/static-webserver/client/source/class/osparc/widget/logger/LoggerView.js index 564131370ad2..e77ff8c6840b 100644 --- a/services/static-webserver/client/source/class/osparc/widget/logger/LoggerView.js +++ b/services/static-webserver/client/source/class/osparc/widget/logger/LoggerView.js @@ -317,7 +317,7 @@ qx.Class.define("osparc.widget.logger.LoggerView", { }, __getLogsString: function() { - const newLine = "\r\n"; + const newLine = "\n"; let logs = ""; this.__loggerModel.getFilteredRows().forEach(rowData => { logs += this.self().printRow(rowData) + newLine; @@ -339,7 +339,8 @@ qx.Class.define("osparc.widget.logger.LoggerView", { downloadLogs: function() { const logs = this.__getLogsString(); - osparc.utils.Utils.downloadContent("data:text/plain;charset=utf-8," + logs, "logs.log"); + const blob = new Blob([logs], {type: "text/plain"}); + osparc.utils.Utils.downloadBlobContent(blob, "logs.log"); }, debug: function(nodeId, msg = "") {