diff --git a/openvidu-call/openvidu-call-front/src/app/app-routing.module.ts b/openvidu-call/openvidu-call-front/src/app/app-routing.module.ts index cc8e801e..e484529f 100644 --- a/openvidu-call/openvidu-call-front/src/app/app-routing.module.ts +++ b/openvidu-call/openvidu-call-front/src/app/app-routing.module.ts @@ -1,10 +1,12 @@ import { NgModule } from '@angular/core'; import { RouterModule, Routes } from '@angular/router'; +import { AdminDashboardComponent } from './components/admin-dashboard/admin-dashboard.component'; import { CallComponent } from './components/call/call.component'; import { HomeComponent } from './components/home/home.component'; const routes: Routes = [ { path: '', component: HomeComponent }, + { path: 'admin', component: AdminDashboardComponent }, { path: ':roomName', component: CallComponent } ]; diff --git a/openvidu-call/openvidu-call-front/src/app/app.module.ts b/openvidu-call/openvidu-call-front/src/app/app.module.ts index 2851b3b1..8cb3d20f 100644 --- a/openvidu-call/openvidu-call-front/src/app/app.module.ts +++ b/openvidu-call/openvidu-call-front/src/app/app.module.ts @@ -16,6 +16,7 @@ import { HomeComponent } from './components/home/home.component'; // OpenVidu Angular import { OpenViduAngularConfig, OpenViduAngularModule } from 'openvidu-angular'; +import { AdminDashboardComponent } from './components/admin-dashboard/admin-dashboard.component'; // Services @@ -25,7 +26,7 @@ const config: OpenViduAngularConfig = { @NgModule({ - declarations: [AppComponent, HomeComponent, CallComponent], + declarations: [AppComponent, HomeComponent, CallComponent, AdminDashboardComponent], imports: [ BrowserModule, BrowserAnimationsModule, diff --git a/openvidu-call/openvidu-call-front/src/app/components/admin-dashboard/admin-dashboard.component.css b/openvidu-call/openvidu-call-front/src/app/components/admin-dashboard/admin-dashboard.component.css new file mode 100644 index 00000000..e69de29b diff --git a/openvidu-call/openvidu-call-front/src/app/components/admin-dashboard/admin-dashboard.component.html b/openvidu-call/openvidu-call-front/src/app/components/admin-dashboard/admin-dashboard.component.html new file mode 100644 index 00000000..64081243 --- /dev/null +++ b/openvidu-call/openvidu-call-front/src/app/components/admin-dashboard/admin-dashboard.component.html @@ -0,0 +1,11 @@ + + + diff --git a/openvidu-call/openvidu-call-front/src/app/components/admin-dashboard/admin-dashboard.component.spec.ts b/openvidu-call/openvidu-call-front/src/app/components/admin-dashboard/admin-dashboard.component.spec.ts new file mode 100644 index 00000000..b6955164 --- /dev/null +++ b/openvidu-call/openvidu-call-front/src/app/components/admin-dashboard/admin-dashboard.component.spec.ts @@ -0,0 +1,25 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { AdminDashboardComponent } from './admin-dashboard.component'; + +describe('AdminDashboardComponent', () => { + let component: AdminDashboardComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [ AdminDashboardComponent ] + }) + .compileComponents(); + }); + + beforeEach(() => { + fixture = TestBed.createComponent(AdminDashboardComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/openvidu-call/openvidu-call-front/src/app/components/admin-dashboard/admin-dashboard.component.ts b/openvidu-call/openvidu-call-front/src/app/components/admin-dashboard/admin-dashboard.component.ts new file mode 100644 index 00000000..7a7152fc --- /dev/null +++ b/openvidu-call/openvidu-call-front/src/app/components/admin-dashboard/admin-dashboard.component.ts @@ -0,0 +1,66 @@ +import { Component, OnInit } from '@angular/core'; +import { RecordingService } from 'openvidu-angular'; +import { RestService } from 'src/app/services/rest.service'; + +@Component({ + selector: 'app-admin-dashboard', + templateUrl: './admin-dashboard.component.html', + styleUrls: ['./admin-dashboard.component.css'] +}) +export class AdminDashboardComponent implements OnInit { + recordings = []; + logged: boolean; + error: any; + constructor(private restService: RestService, private recordingService: RecordingService) {} + + ngOnInit(): void {} + + async onLoginClicked(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); + } + } + async onLogoutClicked() { + this.logged = false; + await this.restService.logout(); + } + + async onRefreshRecordingsClicked() { + try { + this.recordings = await this.restService.getRecordings(); + } catch (error) { + this.onLogoutClicked(); + } + } + + async onDownloadRecordingClicked(recordingId: string) { + try { + const file = await this.restService.downloadRecording(recordingId); + this.recordingService.downloadRecording(recordingId, file); + } catch (error) { + console.error(error); + } + } + + async onDeleteRecordingClicked(recordingId: string) { + try { + this.recordings = await this.restService.deleteRecording(recordingId); + } catch (error) { + console.error(error); + } + } + + async onPlayRecordingClicked(recordingId: string) { + try { + const file: Blob = await this.restService.downloadRecording(recordingId); + this.recordingService.playRecording(file); + } catch (error) { + console.error(error); + } + } +} diff --git a/openvidu-call/openvidu-call-front/src/app/components/call/call.component.html b/openvidu-call/openvidu-call-front/src/app/components/call/call.component.html index 8bd90191..fbe2e2a3 100644 --- a/openvidu-call/openvidu-call-front/src/app/components/call/call.component.html +++ b/openvidu-call/openvidu-call-front/src/app/components/call/call.component.html @@ -10,6 +10,5 @@ (onActivitiesPanelDownloadRecordingClicked)="onDownloadRecordingClicked($event)" (onActivitiesPanelDeleteRecordingClicked)="onDeleteRecordingClicked($event)" (onActivitiesPanelPlayRecordingClicked)="onPlayRecordingClicked($event)" - (onRefreshRecordingsClicked)="onRefreshRecordingsClicked()" >