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:
@@ -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!');
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user