mirror of
https://github.com/Tzahi12345/YoutubeDL-Material.git
synced 2026-03-27 15:10:55 +03:00
Added the ability to view logs from the settings menu
This commit is contained in:
@@ -71,6 +71,7 @@ import { AddUserDialogComponent } from './dialogs/add-user-dialog/add-user-dialo
|
||||
import { ManageUserComponent } from './components/manage-user/manage-user.component';
|
||||
import { ManageRoleComponent } from './components/manage-role/manage-role.component';
|
||||
import { CookiesUploaderDialogComponent } from './dialogs/cookies-uploader-dialog/cookies-uploader-dialog.component';
|
||||
import { LogsViewerComponent } from './components/logs-viewer/logs-viewer.component';
|
||||
|
||||
registerLocaleData(es, 'es');
|
||||
|
||||
@@ -109,7 +110,8 @@ export function isVisible({ event, element, scrollContainer, offset }: IsVisible
|
||||
AddUserDialogComponent,
|
||||
ManageUserComponent,
|
||||
ManageRoleComponent,
|
||||
CookiesUploaderDialogComponent
|
||||
CookiesUploaderDialogComponent,
|
||||
LogsViewerComponent
|
||||
],
|
||||
imports: [
|
||||
CommonModule,
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
<div style="height: 100%">
|
||||
<textarea style="height: 100%" matInput readonly [(ngModel)]="logs" placeholder="Logs will appear here" i18n-placeholder="Logs placeholder"></textarea>
|
||||
</div>
|
||||
25
src/app/components/logs-viewer/logs-viewer.component.spec.ts
Normal file
25
src/app/components/logs-viewer/logs-viewer.component.spec.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { LogsViewerComponent } from './logs-viewer.component';
|
||||
|
||||
describe('LogsViewerComponent', () => {
|
||||
let component: LogsViewerComponent;
|
||||
let fixture: ComponentFixture<LogsViewerComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ LogsViewerComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(LogsViewerComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
32
src/app/components/logs-viewer/logs-viewer.component.ts
Normal file
32
src/app/components/logs-viewer/logs-viewer.component.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { PostsService } from '../../posts.services';
|
||||
|
||||
@Component({
|
||||
selector: 'app-logs-viewer',
|
||||
templateUrl: './logs-viewer.component.html',
|
||||
styleUrls: ['./logs-viewer.component.scss']
|
||||
})
|
||||
export class LogsViewerComponent implements OnInit {
|
||||
|
||||
logs: string = null;
|
||||
|
||||
constructor(private postsService: PostsService) { }
|
||||
|
||||
ngOnInit(): void {
|
||||
this.getLogs();
|
||||
}
|
||||
|
||||
getLogs() {
|
||||
this.postsService.getLogs().subscribe(res => {
|
||||
if (res['logs']) {
|
||||
this.logs = res['logs'];
|
||||
} else {
|
||||
this.postsService.openSnackBar('Failed to retrieve logs!');
|
||||
}
|
||||
}, err => {
|
||||
console.error(err);
|
||||
this.postsService.openSnackBar('Failed to retrieve logs!');
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -234,6 +234,10 @@ export class PostsService implements CanActivate {
|
||||
return this.http.post(this.path + 'getVideoInfos', {fileNames: fileNames, type: type, urlMode: urlMode}, this.httpOptions);
|
||||
}
|
||||
|
||||
getLogs() {
|
||||
return this.http.get(this.path + 'logs', this.httpOptions);
|
||||
}
|
||||
|
||||
isPinSet() {
|
||||
return this.http.post(this.path + 'isPinSet', {}, this.httpOptions);
|
||||
}
|
||||
|
||||
@@ -311,6 +311,13 @@
|
||||
</div>
|
||||
<app-modify-users></app-modify-users>
|
||||
</mat-tab>
|
||||
<mat-tab *ngIf="postsService.config" label="Logs" i18n-label="Logs settings label">
|
||||
<ng-template matTabContent>
|
||||
<div style="margin-left: 48px; margin-top: 24px; height: 340px">
|
||||
<app-logs-viewer></app-logs-viewer>
|
||||
</div>
|
||||
</ng-template>
|
||||
</mat-tab>
|
||||
</mat-tab-group>
|
||||
</mat-dialog-content>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user