-
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.
Merge pull request #5 from DoodleyJC/dev
massive rework, added delete page and proper subscribing to observables
- Loading branch information
Showing
21 changed files
with
257 additions
and
98 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,15 @@ | ||
import { NgModule } from '@angular/core'; | ||
import { RouterModule, Routes } from '@angular/router'; | ||
import { DeleteComponent } from './delete/delete.component'; | ||
import { HomePageComponent } from './home-page/home-page.component'; | ||
|
||
const routes: Routes = []; | ||
const routes: Routes = [ | ||
{ path: "secretdelete", component: DeleteComponent }, | ||
{path: "", component: HomePageComponent} | ||
]; | ||
|
||
@NgModule({ | ||
imports: [RouterModule.forRoot(routes)], | ||
exports: [RouterModule] | ||
}) | ||
export class AppRoutingModule { } | ||
export class AppRoutingModule { } |
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,31 +1 @@ | ||
<html> | ||
|
||
<div class="row"> | ||
<div class="col border border-danger"> | ||
Blue | ||
</div> | ||
<div class="col border border-danger"> | ||
NPS | ||
</div> | ||
</div> | ||
<div class="container"> | ||
<div class="mt-3 mb-3"> | ||
<select class="form-select" aria-label="courtSelection" id="courtSelection"> | ||
<option value="nps" selected="selected">NPS</option> | ||
<option value="blue">BLUE</option> | ||
</select> | ||
<label for="nameInput" class="form-label">Name:</label> | ||
<input class="form-control" id="nameInput" placeholder="CuteDaisey"> | ||
<button type="button" class="btn btn-success" (click)="submitCourtName()">submit</button> | ||
</div> | ||
</div> | ||
<div class="container"> | ||
<li *ngFor="let player of data"> | ||
<div class="row"> | ||
<div class="col">{{player.name}}</div> | ||
<div class="col">{{player.time}}</div> | ||
<div class="col">{{player.court}}</div> | ||
</div> | ||
</div> | ||
|
||
</html> | ||
<router-outlet></router-outlet> |
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
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,2 @@ | ||
<input class="form-control" id="regexInput" placeholder="CuteDaisey"> | ||
<button type="button" class="btn btn-success" (click)="deleteData()">submit</button> |
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,21 @@ | ||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { DeleteComponent } from './delete.component'; | ||
|
||
describe('DeleteComponent', () => { | ||
let component: DeleteComponent; | ||
let fixture: ComponentFixture<DeleteComponent>; | ||
|
||
beforeEach(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [DeleteComponent] | ||
}); | ||
fixture = TestBed.createComponent(DeleteComponent); | ||
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,23 @@ | ||
import { Component } from '@angular/core'; | ||
import { BackendService } from '../backend.service'; | ||
|
||
@Component({ | ||
selector: 'app-delete', | ||
templateUrl: './delete.component.html', | ||
styleUrls: ['./delete.component.css'] | ||
}) | ||
export class DeleteComponent { | ||
constructor(private backendService: BackendService){} | ||
|
||
deleteData(){ | ||
var name = (document.getElementById("regexInput") as HTMLInputElement).value; | ||
if(name.length<1){ | ||
alert("error"); | ||
return; | ||
} | ||
this.backendService.deleteData(name).subscribe({ | ||
next: (value) => {alert("successfully deleted")}, | ||
error: (e)=>{console.log(e); alert("error");} | ||
}); | ||
} | ||
} |
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,31 @@ | ||
<html> | ||
|
||
<div class="row"> | ||
<div class="col border border-danger"> | ||
Blue | ||
</div> | ||
<div class="col border border-danger"> | ||
NPS | ||
</div> | ||
</div> | ||
<div class="container"> | ||
<div class="mt-3 mb-3"> | ||
<select class="form-select" aria-label="courtSelection" id="courtSelection"> | ||
<option value="nps" selected="selected">NPS</option> | ||
<option value="blue">BLUE</option> | ||
</select> | ||
<label for="nameInput" class="form-label">Name:</label> | ||
<input class="form-control" id="nameInput" placeholder="CuteDaisey"> | ||
<button type="button" class="btn btn-success" (click)="submitCourtName()">submit</button> | ||
</div> | ||
</div> | ||
<div class="container"> | ||
<li *ngFor="let player of data"> | ||
<div class="row"> | ||
<div class="col">{{player.name}}</div> | ||
<div class="col">{{player.time}}</div> | ||
<div class="col">{{player.court}}</div> | ||
</div> | ||
</div> | ||
|
||
</html> |
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,21 @@ | ||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { HomePageComponent } from './home-page.component'; | ||
|
||
describe('HomePageComponent', () => { | ||
let component: HomePageComponent; | ||
let fixture: ComponentFixture<HomePageComponent>; | ||
|
||
beforeEach(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [HomePageComponent] | ||
}); | ||
fixture = TestBed.createComponent(HomePageComponent); | ||
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,49 @@ | ||
import { Component } from '@angular/core'; | ||
import {formatDate} from '@angular/common'; | ||
import { HttpClient, HttpResponse } from '@angular/common/http'; | ||
import {signup, BackendService } from '../backend.service'; | ||
import { RouterModule } from '@angular/router'; | ||
@Component({ | ||
selector: 'app-home-page', | ||
templateUrl: './home-page.component.html', | ||
styleUrls: ['./home-page.component.css'] | ||
}) | ||
export class HomePageComponent { | ||
title = 'bluenps'; | ||
test: any; | ||
data: signup[]= [{name: "uninitialized", court: "uninitialized", time: "uninitialized"}]; | ||
constructor(private http: HttpClient, private backendService: BackendService){} | ||
|
||
ngOnInit(){ | ||
this.refreshData(); | ||
} | ||
|
||
refreshData(){ | ||
console.log("refreshing data"); | ||
this.backendService.getAllData() | ||
.subscribe( data => this.data = data); | ||
} | ||
submitCourtName(): void{ | ||
var e = (document.getElementById("courtSelection") as HTMLInputElement); | ||
var court = e.value; | ||
var name = (document.getElementById("nameInput") as HTMLInputElement).value; | ||
var date = new Date(); | ||
if(name==undefined || date==undefined || court == undefined){ | ||
alert("error"); | ||
return; | ||
} | ||
var dateString = formatDate(date, "yyyy-MM-dd", 'en') | ||
|
||
var newSignup:signup = { | ||
"name" : name, | ||
"time" : dateString, | ||
"court" : court | ||
} | ||
this.backendService.postSignup(newSignup).subscribe({ | ||
next: (value) =>this.refreshData(), | ||
error:(e)=>{console.log("error",e); this.refreshData()}} | ||
) | ||
this.refreshData(); | ||
} | ||
|
||
} |
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,4 @@ | ||
export const environment = { | ||
production: false, | ||
backendUrl: "http://localhost:8000/", | ||
}; |
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,4 @@ | ||
export const environment = { | ||
production: true, | ||
backendUrl: "https://backendbluenps.azurewebsites.net/", | ||
}; |
Binary file not shown.
Binary file not shown.
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
Oops, something went wrong.