2022-06-02 12:45:41 +02:00
|
|
|
import { Component, OnInit } from '@angular/core';
|
2022-06-22 12:42:02 +02:00
|
|
|
import { RecordingService } from 'openvidu-angular';
|
|
|
|
import { RestService } from 'src/app/services/rest.service';
|
2022-06-02 12:45:41 +02:00
|
|
|
|
|
|
|
@Component({
|
2022-06-22 12:42:02 +02:00
|
|
|
selector: 'app-admin-dashboard',
|
|
|
|
templateUrl: './admin-dashboard.component.html',
|
|
|
|
styleUrls: ['./admin-dashboard.component.scss']
|
2022-06-02 12:45:41 +02:00
|
|
|
})
|
|
|
|
export class AdminDashboardComponent implements OnInit {
|
2022-06-22 12:42:02 +02:00
|
|
|
recordings: any[] = [];
|
|
|
|
logged: boolean;
|
|
|
|
error: any;
|
|
|
|
constructor(private restService: RestService, private recordingService: RecordingService) {}
|
2022-06-02 12:45:41 +02:00
|
|
|
|
2022-06-22 12:42:02 +02:00
|
|
|
async ngOnInit() {
|
|
|
|
try {
|
|
|
|
const resp: any = await this.restService.login('');
|
|
|
|
this.logged = true;
|
|
|
|
this.recordings = resp.recordings;
|
2022-10-19 12:30:19 +02:00
|
|
|
} catch (error) {
|
|
|
|
|
|
|
|
this.logged = true;
|
|
|
|
}
|
2022-06-22 12:42:02 +02:00
|
|
|
}
|
2022-06-02 12:45:41 +02:00
|
|
|
|
2022-06-22 12:42:02 +02:00
|
|
|
async login(pass: string) {
|
|
|
|
try {
|
|
|
|
const resp: any = await this.restService.login(pass);
|
|
|
|
this.logged = true;
|
|
|
|
this.recordings = resp.recordings;
|
|
|
|
} catch (error) {
|
|
|
|
this.error = error;
|
|
|
|
console.log(error);
|
|
|
|
}
|
|
|
|
}
|
2022-06-02 12:45:41 +02:00
|
|
|
|
2022-06-22 12:42:02 +02:00
|
|
|
async onLogoutClicked() {
|
|
|
|
this.logged = false;
|
|
|
|
await this.restService.logout();
|
|
|
|
}
|
|
|
|
|
|
|
|
async onRefreshRecordingsClicked() {
|
|
|
|
console.log('GET ALL ');
|
|
|
|
const ecordings = await this.restService.getRecordings();
|
|
|
|
console.log(this.recordings);
|
|
|
|
this.recordings = ecordings;
|
|
|
|
}
|
|
|
|
|
|
|
|
async onDeleteRecordingClicked(recordingId: string) {
|
|
|
|
console.warn('DELETE RECORDING CLICKED');
|
|
|
|
|
|
|
|
try {
|
|
|
|
this.recordings = await this.restService.deleteRecording(recordingId);
|
|
|
|
} catch (error) {
|
|
|
|
console.error(error);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-06-02 12:45:41 +02:00
|
|
|
}
|