aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+admin
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-07-15 15:30:14 +0200
committerChocobozzz <me@florianbigard.com>2022-07-18 11:37:18 +0200
commit42b40636991b97fe818007fab19091764fc5db73 (patch)
treedb431787c06ce898d22e91ff771f795219274fc6 /client/src/app/+admin
parent654d4ede7fa4d0faa71e49bcfab6b65a686397b2 (diff)
downloadPeerTube-42b40636991b97fe818007fab19091764fc5db73.tar.gz
PeerTube-42b40636991b97fe818007fab19091764fc5db73.tar.zst
PeerTube-42b40636991b97fe818007fab19091764fc5db73.zip
Add ability for client to create server logs
Diffstat (limited to 'client/src/app/+admin')
-rw-r--r--client/src/app/+admin/overview/users/user-list/user-list.component.ts5
-rw-r--r--client/src/app/+admin/plugins/plugin-search/plugin-search.component.ts3
-rw-r--r--client/src/app/+admin/system/logs/log-row.model.ts7
-rw-r--r--client/src/app/+admin/system/logs/logs.component.ts6
-rw-r--r--client/src/app/+admin/system/logs/logs.service.ts4
5 files changed, 14 insertions, 11 deletions
diff --git a/client/src/app/+admin/overview/users/user-list/user-list.component.ts b/client/src/app/+admin/overview/users/user-list/user-list.component.ts
index 3e1a5f6b8..99987fdff 100644
--- a/client/src/app/+admin/overview/users/user-list/user-list.component.ts
+++ b/client/src/app/+admin/overview/users/user-list/user-list.component.ts
@@ -2,11 +2,12 @@ import { SortMeta } from 'primeng/api'
2import { Component, OnInit, ViewChild } from '@angular/core' 2import { Component, OnInit, ViewChild } from '@angular/core'
3import { ActivatedRoute, Router } from '@angular/router' 3import { ActivatedRoute, Router } from '@angular/router'
4import { AuthService, ConfirmService, LocalStorageService, Notifier, RestPagination, RestTable, ServerService } from '@app/core' 4import { AuthService, ConfirmService, LocalStorageService, Notifier, RestPagination, RestTable, ServerService } from '@app/core'
5import { prepareIcu, getAPIHost } from '@app/helpers' 5import { getAPIHost, prepareIcu } from '@app/helpers'
6import { AdvancedInputFilter } from '@app/shared/shared-forms' 6import { AdvancedInputFilter } from '@app/shared/shared-forms'
7import { Actor, DropdownAction } from '@app/shared/shared-main' 7import { Actor, DropdownAction } from '@app/shared/shared-main'
8import { AccountMutedStatus, BlocklistService, UserBanModalComponent, UserModerationDisplayType } from '@app/shared/shared-moderation' 8import { AccountMutedStatus, BlocklistService, UserBanModalComponent, UserModerationDisplayType } from '@app/shared/shared-moderation'
9import { UserAdminService } from '@app/shared/shared-users' 9import { UserAdminService } from '@app/shared/shared-users'
10import { logger } from '@root-helpers/logger'
10import { User, UserRole } from '@shared/models' 11import { User, UserRole } from '@shared/models'
11 12
12type UserForList = User & { 13type UserForList = User & {
@@ -149,7 +150,7 @@ export class UserListComponent extends RestTable implements OnInit {
149 this.selectedColumns = JSON.parse(result) 150 this.selectedColumns = JSON.parse(result)
150 return 151 return
151 } catch (err) { 152 } catch (err) {
152 console.error('Cannot load selected columns.', err) 153 logger.error('Cannot load selected columns.', err)
153 } 154 }
154 } 155 }
155 156
diff --git a/client/src/app/+admin/plugins/plugin-search/plugin-search.component.ts b/client/src/app/+admin/plugins/plugin-search/plugin-search.component.ts
index d39c2ea1c..b02c054a2 100644
--- a/client/src/app/+admin/plugins/plugin-search/plugin-search.component.ts
+++ b/client/src/app/+admin/plugins/plugin-search/plugin-search.component.ts
@@ -4,6 +4,7 @@ import { Component, OnInit } from '@angular/core'
4import { ActivatedRoute, Router } from '@angular/router' 4import { ActivatedRoute, Router } from '@angular/router'
5import { PluginApiService } from '@app/+admin/plugins/shared/plugin-api.service' 5import { PluginApiService } from '@app/+admin/plugins/shared/plugin-api.service'
6import { ComponentPagination, ConfirmService, hasMoreItems, Notifier, PluginService } from '@app/core' 6import { ComponentPagination, ConfirmService, hasMoreItems, Notifier, PluginService } from '@app/core'
7import { logger } from '@root-helpers/logger'
7import { PeerTubePluginIndex, PluginType } from '@shared/models' 8import { PeerTubePluginIndex, PluginType } from '@shared/models'
8 9
9@Component({ 10@Component({
@@ -94,7 +95,7 @@ export class PluginSearchComponent implements OnInit {
94 }, 95 },
95 96
96 error: err => { 97 error: err => {
97 console.error(err) 98 logger.error(err)
98 99
99 const message = $localize`The plugin index is not available. Please retry later.` 100 const message = $localize`The plugin index is not available. Please retry later.`
100 this.notifier.error(message) 101 this.notifier.error(message)
diff --git a/client/src/app/+admin/system/logs/log-row.model.ts b/client/src/app/+admin/system/logs/log-row.model.ts
index 615778210..e83c7b064 100644
--- a/client/src/app/+admin/system/logs/log-row.model.ts
+++ b/client/src/app/+admin/system/logs/log-row.model.ts
@@ -1,10 +1,11 @@
1import { LogLevel } from '@shared/models'
2import omit from 'lodash-es/omit' 1import omit from 'lodash-es/omit'
2import { logger } from '@root-helpers/logger'
3import { ServerLogLevel } from '@shared/models'
3 4
4export class LogRow { 5export class LogRow {
5 date: Date 6 date: Date
6 localeDate: string 7 localeDate: string
7 level: LogLevel 8 level: ServerLogLevel
8 message: string 9 message: string
9 meta: string 10 meta: string
10 11
@@ -33,7 +34,7 @@ export class LogRow {
33 this.meta = JSON.stringify(message, null, 2) 34 this.meta = JSON.stringify(message, null, 2)
34 this.message = '' 35 this.message = ''
35 } catch (err) { 36 } catch (err) {
36 console.error('Cannot parse audit message.', err) 37 logger.error('Cannot parse audit message.', err)
37 } 38 }
38 } 39 }
39 } 40 }
diff --git a/client/src/app/+admin/system/logs/logs.component.ts b/client/src/app/+admin/system/logs/logs.component.ts
index 06237522a..939e710d7 100644
--- a/client/src/app/+admin/system/logs/logs.component.ts
+++ b/client/src/app/+admin/system/logs/logs.component.ts
@@ -1,6 +1,6 @@
1import { Component, ElementRef, OnInit, ViewChild } from '@angular/core' 1import { Component, ElementRef, OnInit, ViewChild } from '@angular/core'
2import { LocalStorageService, Notifier } from '@app/core' 2import { LocalStorageService, Notifier } from '@app/core'
3import { LogLevel } from '@shared/models' 3import { ServerLogLevel } from '@shared/models'
4import { LogRow } from './log-row.model' 4import { LogRow } from './log-row.model'
5import { LogsService } from './logs.service' 5import { LogsService } from './logs.service'
6 6
@@ -17,11 +17,11 @@ export class LogsComponent implements OnInit {
17 17
18 logs: LogRow[] = [] 18 logs: LogRow[] = []
19 timeChoices: { id: string, label: string, dateFormat: string }[] = [] 19 timeChoices: { id: string, label: string, dateFormat: string }[] = []
20 levelChoices: { id: LogLevel, label: string }[] = [] 20 levelChoices: { id: ServerLogLevel, label: string }[] = []
21 logTypeChoices: { id: 'audit' | 'standard', label: string }[] = [] 21 logTypeChoices: { id: 'audit' | 'standard', label: string }[] = []
22 22
23 startDate: string 23 startDate: string
24 level: LogLevel 24 level: ServerLogLevel
25 logType: 'audit' | 'standard' 25 logType: 'audit' | 'standard'
26 tagsOneOf: string[] = [] 26 tagsOneOf: string[] = []
27 27
diff --git a/client/src/app/+admin/system/logs/logs.service.ts b/client/src/app/+admin/system/logs/logs.service.ts
index ea7e08b9b..933a074a8 100644
--- a/client/src/app/+admin/system/logs/logs.service.ts
+++ b/client/src/app/+admin/system/logs/logs.service.ts
@@ -3,7 +3,7 @@ import { catchError, map } from 'rxjs/operators'
3import { HttpClient, HttpParams } from '@angular/common/http' 3import { HttpClient, HttpParams } from '@angular/common/http'
4import { Injectable } from '@angular/core' 4import { Injectable } from '@angular/core'
5import { RestExtractor, RestService } from '@app/core' 5import { RestExtractor, RestService } from '@app/core'
6import { LogLevel } from '@shared/models' 6import { ServerLogLevel } from '@shared/models'
7import { environment } from '../../../../environments/environment' 7import { environment } from '../../../../environments/environment'
8import { LogRow } from './log-row.model' 8import { LogRow } from './log-row.model'
9 9
@@ -22,7 +22,7 @@ export class LogsService {
22 isAuditLog: boolean 22 isAuditLog: boolean
23 startDate: string 23 startDate: string
24 tagsOneOf?: string[] 24 tagsOneOf?: string[]
25 level?: LogLevel 25 level?: ServerLogLevel
26 endDate?: string 26 endDate?: string
27 }): Observable<any[]> { 27 }): Observable<any[]> {
28 const { isAuditLog, startDate, endDate, tagsOneOf } = options 28 const { isAuditLog, startDate, endDate, tagsOneOf } = options