1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-23 15:29:42 +02:00

fix(logs): copy issues caused by extra CR (#6150)

This commit is contained in:
Hao Zhang 2021-11-25 12:46:58 +08:00 committed by GitHub
parent 0928d1832d
commit 97b8da9d10
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -24,13 +24,13 @@ angular.module('portainer.docker').controller('LogViewerController', [
};
this.copy = function () {
clipboard.copyText(this.state.filteredLogs.map((log) => log.line).join(''));
clipboard.copyText(this.state.filteredLogs.map((log) => log.line).join(NEW_LINE_BREAKER));
$('#refreshRateChange').show();
$('#refreshRateChange').fadeOut(2000);
};
this.copySelection = function () {
clipboard.copyText(this.state.selectedLines.join(''));
clipboard.copyText(this.state.selectedLines.join(NEW_LINE_BREAKER));
$('#refreshRateChange').show();
$('#refreshRateChange').fadeOut(2000);
};
@ -49,7 +49,8 @@ angular.module('portainer.docker').controller('LogViewerController', [
};
this.downloadLogs = function () {
// To make the feature of downloading container logs working both on Windows and Linux, we need to use correct new line breakers on corresponding OS.
// To make the feature of downloading container logs working both on Windows and Linux,
// we need to use correct new line breakers on corresponding OS.
const data = new Blob([_.reduce(this.state.filteredLogs, (acc, log) => acc + log.line + NEW_LINE_BREAKER, '')]);
FileSaver.saveAs(data, this.resourceName + '_logs.txt');
};