openvidu-call: Added admin panel
This commit is contained in:
parent
0dc070bb38
commit
028d8da609
@ -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 }
|
||||
];
|
||||
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -0,0 +1,11 @@
|
||||
<ov-admin-login *ngIf="!logged" [error]="error" (onLoginButtonClicked)="onLoginClicked($event)"></ov-admin-login>
|
||||
|
||||
<ov-admin-dashboard
|
||||
*ngIf="logged"
|
||||
[recordingsList]="recordings"
|
||||
(onLogoutClicked)="onLogoutClicked()"
|
||||
(onRefreshRecordingsClicked)="onRefreshRecordingsClicked()"
|
||||
(onPlayRecordingClicked)="onPlayRecordingClicked($event)"
|
||||
(onDownloadRecordingClicked)="onDownloadRecordingClicked($event)"
|
||||
(onDeleteRecordingClicked)="onDeleteRecordingClicked($event)"
|
||||
></ov-admin-dashboard>
|
||||
@ -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<AdminDashboardComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ AdminDashboardComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(AdminDashboardComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -10,6 +10,5 @@
|
||||
(onActivitiesPanelDownloadRecordingClicked)="onDownloadRecordingClicked($event)"
|
||||
(onActivitiesPanelDeleteRecordingClicked)="onDeleteRecordingClicked($event)"
|
||||
(onActivitiesPanelPlayRecordingClicked)="onPlayRecordingClicked($event)"
|
||||
(onRefreshRecordingsClicked)="onRefreshRecordingsClicked()"
|
||||
>
|
||||
</ov-videoconference>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user