1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-30 18:59:41 +02:00

feat(k8s/logs): Add the ability to download application/stack logs (#4046)

* feat(logs): Add the ability to download application/stack logs

* feat(kubernetes): minor UI update

Co-authored-by: Anthony Lapenna <lapenna.anthony@gmail.com>
This commit is contained in:
Maxime Bajeux 2020-07-16 23:59:27 +02:00 committed by GitHub
parent a452599829
commit c9e8021fe8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 31 additions and 2 deletions

View file

@ -6,13 +6,15 @@ const colors = ['red', 'orange', 'lime', 'green', 'darkgreen', 'cyan', 'turquois
class KubernetesStackLogsController {
/* @ngInject */
constructor($async, $state, $interval, Notifications, KubernetesApplicationService, KubernetesPodService) {
constructor($async, $state, $interval, Notifications, KubernetesApplicationService, KubernetesPodService, FileSaver, Blob) {
this.$async = $async;
this.$state = $state;
this.$interval = $interval;
this.Notifications = Notifications;
this.KubernetesApplicationService = KubernetesApplicationService;
this.KubernetesPodService = KubernetesPodService;
this.Blob = Blob;
this.FileSaver = FileSaver;
this.onInit = this.onInit.bind(this);
this.stopRepeater = this.stopRepeater.bind(this);
@ -87,6 +89,11 @@ class KubernetesStackLogsController {
}
}
downloadLogs() {
const data = new this.Blob([(this.dataLogs = _.reduce(this.stackLogs, (acc, log) => acc + '\n' + log.AppName + ' ' + log.Line, ''))]);
this.FileSaver.saveAs(data, this.state.transition.name + '_logs.txt');
}
async onInit() {
this.state = {
autoRefresh: false,