-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
and write room list add room class
- Loading branch information
Showing
9 changed files
with
118 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
export class Room { | ||
_id:string; | ||
name:string; | ||
date:Date; | ||
members:Array<Member>; | ||
messages:Array<Message>; | ||
} | ||
class Member { | ||
username:string; | ||
sessionId:string; | ||
} | ||
class Message { | ||
username:string; | ||
date:Date; | ||
text:string; | ||
type:string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
<div class="container"> | ||
<router-outlet></router-outlet> | ||
<!--<app-register></app-register>--> | ||
<!--<router-outlet></router-outlet>--> | ||
<app-list></app-list> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<nav class=" navbar navbar-light bg-light"> | ||
<span>Room List</span> | ||
<button (click)="logout()" class="btn btn-primary float-right">Logout</button> | ||
</nav> | ||
<hr> | ||
<div class="row"> | ||
<div class="col"> | ||
<div class="form-group col-md-5 m-auto"> | ||
<input class="form-control" [(ngModel)]="searchQuery" placeholder="Search"> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="row"> | ||
<div class="col"> | ||
<table class="table table-hover table-bordered m-2"> | ||
<tr> | ||
<th>Name</th> | ||
<th>Create Date</th> | ||
<th>Members</th> | ||
|
||
<th></th> | ||
</tr> | ||
<tr *ngFor="let vid of getQueryFilteredRooms()"> | ||
<td>{{vid.name}}</td> | ||
<td>{{vid.date}} minutes</td> | ||
<td>{{vid.members.length}}</td> | ||
|
||
<td><a href="/join/{{vid._id}}" class="btn btn-secondary">Join</a></td> | ||
<!--todo make join work--> | ||
</tr> | ||
</table> | ||
</div> | ||
</div> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { ListComponent } from './list.component'; | ||
|
||
describe('ListComponent', () => { | ||
let component: ListComponent; | ||
let fixture: ComponentFixture<ListComponent>; | ||
|
||
beforeEach(async(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [ ListComponent ] | ||
}) | ||
.compileComponents(); | ||
})); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(ListComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import {Component, OnInit, Input} from '@angular/core'; | ||
import {BackendService} from '../backend.service'; | ||
import {Room} from "../../Room"; | ||
|
||
@Component({ | ||
selector: 'app-list', | ||
templateUrl: './list.component.html', | ||
styleUrls: ['./list.component.css'] | ||
}) | ||
export class ListComponent implements OnInit { | ||
list: Room[]; | ||
@Input() searchQuery = ''; | ||
|
||
constructor(private httpService: BackendService) { | ||
} | ||
|
||
getQueryFilteredRooms(): Room[] { | ||
return this.list.filter(vid => vid.name.includes(this.searchQuery) | ||
|
||
); | ||
} | ||
|
||
getRooms() { | ||
this.httpService.getRooms().subscribe(roomList => { | ||
this.list = roomList; | ||
}); | ||
} | ||
|
||
ngOnInit() { | ||
this.getRooms(); | ||
} | ||
|
||
} |