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

pull/6156/head
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
1 changed files with 4 additions and 3 deletions

View File

@ -24,13 +24,13 @@ angular.module('portainer.docker').controller('LogViewerController', [
}; };
this.copy = function () { 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').show();
$('#refreshRateChange').fadeOut(2000); $('#refreshRateChange').fadeOut(2000);
}; };
this.copySelection = function () { this.copySelection = function () {
clipboard.copyText(this.state.selectedLines.join('')); clipboard.copyText(this.state.selectedLines.join(NEW_LINE_BREAKER));
$('#refreshRateChange').show(); $('#refreshRateChange').show();
$('#refreshRateChange').fadeOut(2000); $('#refreshRateChange').fadeOut(2000);
}; };
@ -49,7 +49,8 @@ angular.module('portainer.docker').controller('LogViewerController', [
}; };
this.downloadLogs = function () { 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, '')]); const data = new Blob([_.reduce(this.state.filteredLogs, (acc, log) => acc + log.line + NEW_LINE_BREAKER, '')]);
FileSaver.saveAs(data, this.resourceName + '_logs.txt'); FileSaver.saveAs(data, this.resourceName + '_logs.txt');
}; };