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:
parent
a452599829
commit
c9e8021fe8
4 changed files with 31 additions and 2 deletions
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue