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

fix(UI): update-log-viewer-ui [EE-3522] (#7202)

* fix update log viewer layout

* use por-switch in logs

Co-authored-by: Hao Zhang <hao.zhang@portainer.io>
This commit is contained in:
sunportainer 2022-07-12 07:26:23 +08:00 committed by GitHub
parent 82fb5f7ac1
commit 4cc672f902
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 40 additions and 16 deletions

View file

@ -3,10 +3,11 @@ import _ from 'lodash-es';
import { NEW_LINE_BREAKER } from '@/constants';
angular.module('portainer.docker').controller('LogViewerController', [
'$scope',
'clipboard',
'Blob',
'FileSaver',
function (clipboard, Blob, FileSaver) {
function ($scope, clipboard, Blob, FileSaver) {
this.state = {
availableSinceDatetime: [
{ desc: 'Last day', value: moment().subtract(1, 'days').format() },
@ -23,6 +24,30 @@ angular.module('portainer.docker').controller('LogViewerController', [
selectedLines: [],
};
this.handleLogsCollectionChange = handleLogsCollectionChange.bind(this);
this.handleLogsWrapLinesChange = handleLogsWrapLinesChange.bind(this);
this.handleDisplayTimestampsChange = handleDisplayTimestampsChange.bind(this);
function handleLogsCollectionChange(enabled) {
$scope.$evalAsync(() => {
this.state.logCollection = enabled;
this.state.autoScroll = enabled;
this.logCollectionChange(enabled);
});
}
function handleLogsWrapLinesChange(enabled) {
$scope.$evalAsync(() => {
this.state.wrapLines = enabled;
});
}
function handleDisplayTimestampsChange(enabled) {
$scope.$evalAsync(() => {
this.displayTimestamps = enabled;
});
}
this.copy = function () {
clipboard.copyText(this.state.filteredLogs.map((log) => log.line).join(NEW_LINE_BREAKER));
$('#refreshRateChange').show();