backend fertig gestellt
frontend angefangen
This commit is contained in:
10
ui/src/app/app-routing.module.ts
Normal file
10
ui/src/app/app-routing.module.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { RouterModule, Routes } from '@angular/router';
|
||||
|
||||
const routes: Routes = [];
|
||||
|
||||
@NgModule({
|
||||
imports: [RouterModule.forRoot(routes)],
|
||||
exports: [RouterModule]
|
||||
})
|
||||
export class AppRoutingModule { }
|
||||
0
ui/src/app/app.component.css
Normal file
0
ui/src/app/app.component.css
Normal file
2
ui/src/app/app.component.html
Normal file
2
ui/src/app/app.component.html
Normal file
@@ -0,0 +1,2 @@
|
||||
|
||||
<app-besucher></app-besucher>
|
||||
35
ui/src/app/app.component.spec.ts
Normal file
35
ui/src/app/app.component.spec.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
import { AppComponent } from './app.component';
|
||||
|
||||
describe('AppComponent', () => {
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
imports: [
|
||||
RouterTestingModule
|
||||
],
|
||||
declarations: [
|
||||
AppComponent
|
||||
],
|
||||
}).compileComponents();
|
||||
});
|
||||
|
||||
it('should create the app', () => {
|
||||
const fixture = TestBed.createComponent(AppComponent);
|
||||
const app = fixture.componentInstance;
|
||||
expect(app).toBeTruthy();
|
||||
});
|
||||
|
||||
it(`should have as title 'ui'`, () => {
|
||||
const fixture = TestBed.createComponent(AppComponent);
|
||||
const app = fixture.componentInstance;
|
||||
expect(app.title).toEqual('ui');
|
||||
});
|
||||
|
||||
it('should render title', () => {
|
||||
const fixture = TestBed.createComponent(AppComponent);
|
||||
fixture.detectChanges();
|
||||
const compiled = fixture.nativeElement as HTMLElement;
|
||||
expect(compiled.querySelector('.content span')?.textContent).toContain('ui app is running!');
|
||||
});
|
||||
});
|
||||
10
ui/src/app/app.component.ts
Normal file
10
ui/src/app/app.component.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import { Component } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-root',
|
||||
templateUrl: './app.component.html',
|
||||
styleUrls: ['./app.component.css']
|
||||
})
|
||||
export class AppComponent {
|
||||
title = 'ui';
|
||||
}
|
||||
31
ui/src/app/app.module.ts
Normal file
31
ui/src/app/app.module.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { BrowserModule } from '@angular/platform-browser';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import { HttpClientModule } from '@angular/common/http';
|
||||
import { MatSliderModule } from '@angular/material/slider'
|
||||
import { MatRadioModule } from '@angular/material/radio'
|
||||
|
||||
import { AppRoutingModule } from './app-routing.module';
|
||||
import { AppComponent } from './app.component';
|
||||
import { HomeComponent } from './home/home.component';
|
||||
import { BesucherComponent } from './besucher/besucher.component';
|
||||
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
AppComponent,
|
||||
HomeComponent,
|
||||
BesucherComponent
|
||||
],
|
||||
imports: [
|
||||
BrowserModule,
|
||||
AppRoutingModule,
|
||||
FormsModule,
|
||||
HttpClientModule,
|
||||
BrowserAnimationsModule,
|
||||
MatRadioModule
|
||||
],
|
||||
providers: [],
|
||||
bootstrap: [AppComponent]
|
||||
})
|
||||
export class AppModule { }
|
||||
16
ui/src/app/besucher.service.spec.ts
Normal file
16
ui/src/app/besucher.service.spec.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { BesucherService } from './besucher.service';
|
||||
|
||||
describe('BesucherService', () => {
|
||||
let service: BesucherService;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({});
|
||||
service = TestBed.inject(BesucherService);
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(service).toBeTruthy();
|
||||
});
|
||||
});
|
||||
33
ui/src/app/besucher.service.ts
Normal file
33
ui/src/app/besucher.service.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { HttpClient} from '@angular/common/http'
|
||||
import { environment } from 'src/environments/environment';
|
||||
import { Observable } from 'rxjs';
|
||||
import { Besucher } from 'src/besucher';
|
||||
|
||||
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class BesucherService {
|
||||
|
||||
constructor(private httpClient: HttpClient) { }
|
||||
|
||||
getBesucherList() : Observable<Besucher[]> {
|
||||
var result = this.httpClient.get<Besucher[]>(environment.gateway + '/besucher');
|
||||
return result;
|
||||
}
|
||||
|
||||
addBesucher(besucher: Besucher) {
|
||||
return this.httpClient.post(environment.gateway + "/besucher",besucher);
|
||||
}
|
||||
|
||||
comeBesucher(besucher: Besucher) {
|
||||
return this.httpClient.put(environment.gateway+ "/besucher", besucher);
|
||||
}
|
||||
|
||||
deleteBesucher(besucher: Besucher) {
|
||||
return this.httpClient.delete(environment.gateway + "/besucher/"+besucher.id);
|
||||
}
|
||||
|
||||
}
|
||||
0
ui/src/app/besucher/besucher.component.css
Normal file
0
ui/src/app/besucher/besucher.component.css
Normal file
26
ui/src/app/besucher/besucher.component.html
Normal file
26
ui/src/app/besucher/besucher.component.html
Normal file
@@ -0,0 +1,26 @@
|
||||
<h1>besucher works!</h1>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>Nachricht</th>
|
||||
<th>Kommt</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr *ngFor="let besucher of activeBesuchers">
|
||||
<td>{{besucher.id}}</td>
|
||||
<td>{{besucher.message}}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<input placeholder="Ihre Name..." [(ngModel)]="BesucherName">
|
||||
<input placeholder="Eventuell eine Nachricht" [(ngModel)]="BesucherMessage">
|
||||
<label id="zusage-radio-button-group-label">Kommen Sie</label>
|
||||
<mat-radio-group>
|
||||
<mat-radio-button value="1">Ja</mat-radio-button>
|
||||
<mat-radio-button value="0">Nein</mat-radio-button>
|
||||
</mat-radio-group>
|
||||
<button class="btn btn-primary" (click)="addBesucher()">Abschicken</button>
|
||||
|
||||
25
ui/src/app/besucher/besucher.component.spec.ts
Normal file
25
ui/src/app/besucher/besucher.component.spec.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { BesucherComponent } from './besucher.component';
|
||||
|
||||
describe('BesucherComponent', () => {
|
||||
let component: BesucherComponent;
|
||||
let fixture: ComponentFixture<BesucherComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ BesucherComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(BesucherComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
60
ui/src/app/besucher/besucher.component.ts
Normal file
60
ui/src/app/besucher/besucher.component.ts
Normal file
@@ -0,0 +1,60 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import { MatRadioModule } from '@angular/material/radio';
|
||||
import { filter } from 'rxjs';
|
||||
import { BesucherService } from '../besucher.service';
|
||||
import { Besucher } from 'src/besucher';
|
||||
|
||||
@Component({
|
||||
selector: 'app-besucher',
|
||||
templateUrl: './besucher.component.html',
|
||||
styleUrls: ['./besucher.component.css']
|
||||
})
|
||||
|
||||
export class BesucherComponent implements OnInit {
|
||||
|
||||
activeBesuchers: Besucher[] = [];
|
||||
kommendeBesuchers: Besucher[] = [];
|
||||
BesucherName: string = "";
|
||||
BesucherMessage: string = "";
|
||||
BesucherKommt: boolean = false;
|
||||
|
||||
constructor(private besucherService: BesucherService) { }
|
||||
|
||||
ngOnInit(): void {
|
||||
this.getAll();
|
||||
|
||||
}
|
||||
|
||||
getAll() {
|
||||
this.besucherService.getBesucherList().subscribe((data: Besucher[]) => {
|
||||
this.activeBesuchers = data;
|
||||
console.log(data);
|
||||
|
||||
});
|
||||
}
|
||||
/*getAll() {
|
||||
this.besucherService.getBesucherList()
|
||||
.pipe(
|
||||
filter((data): data is Besucher[] => data instanceof Besucher))
|
||||
.subscribe(data => {
|
||||
this.activeBesuchers = data.filter((a) => !a.come);
|
||||
this.kommendeBesuchers = data.filter((a) => a.come);
|
||||
});
|
||||
}*/
|
||||
|
||||
addBesucher() {
|
||||
var newBesucher : Besucher = {
|
||||
name : this.BesucherName,
|
||||
message : this.BesucherMessage,
|
||||
id: '',
|
||||
come : this.BesucherKommt
|
||||
};
|
||||
this.besucherService.addBesucher(newBesucher).subscribe(() => {
|
||||
this.getAll();
|
||||
this.BesucherMessage = '';
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
0
ui/src/app/home/home.component.css
Normal file
0
ui/src/app/home/home.component.css
Normal file
4
ui/src/app/home/home.component.html
Normal file
4
ui/src/app/home/home.component.html
Normal file
@@ -0,0 +1,4 @@
|
||||
<div class="c-block">
|
||||
<h2>Welcome Home!</h2>
|
||||
<a class="btn btn-primary" routerLink="/besucher">Zeige Besucher liste</a>
|
||||
</div>
|
||||
25
ui/src/app/home/home.component.spec.ts
Normal file
25
ui/src/app/home/home.component.spec.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { HomeComponent } from './home.component';
|
||||
|
||||
describe('HomeComponent', () => {
|
||||
let component: HomeComponent;
|
||||
let fixture: ComponentFixture<HomeComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ HomeComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(HomeComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
15
ui/src/app/home/home.component.ts
Normal file
15
ui/src/app/home/home.component.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-home',
|
||||
templateUrl: './home.component.html',
|
||||
styleUrls: ['./home.component.css']
|
||||
})
|
||||
export class HomeComponent implements OnInit {
|
||||
|
||||
constructor() { }
|
||||
|
||||
ngOnInit(): void {
|
||||
}
|
||||
|
||||
}
|
||||
0
ui/src/assets/.gitkeep
Normal file
0
ui/src/assets/.gitkeep
Normal file
6
ui/src/besucher.ts
Normal file
6
ui/src/besucher.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
export interface Besucher {
|
||||
id: string;
|
||||
name: string;
|
||||
message: string;
|
||||
come: boolean;
|
||||
}
|
||||
8
ui/src/environments/environment.prod.ts
Normal file
8
ui/src/environments/environment.prod.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
export const environment = {
|
||||
production: true,
|
||||
gateway: '',
|
||||
callback: 'http://localhost:4200/callback',
|
||||
domain: 'dev-uzlaiuax.eu.auth0.com',
|
||||
clientId: 'JLRuOGtkGQAESlcE6MADlOmLdowttvLo',
|
||||
audience: 'https://hochzeit-api'
|
||||
};
|
||||
22
ui/src/environments/environment.ts
Normal file
22
ui/src/environments/environment.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
// This file can be replaced during build by using the `fileReplacements` array.
|
||||
// `ng build` replaces `environment.ts` with `environment.prod.ts`.
|
||||
// The list of file replacements can be found in `angular.json`.
|
||||
|
||||
export const environment = {
|
||||
production: false,
|
||||
gateway: 'http://localhost:3000',
|
||||
callback: 'http://localhost:4200/callback',
|
||||
domain: 'dev-uzlaiuax.eu.auth0.com',
|
||||
clientId: 'JLRuOGtkGQAESlcE6MADlOmLdowttvLo',
|
||||
audience: 'https://hochzeit-api'
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* For easier debugging in development mode, you can import the following file
|
||||
* to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`.
|
||||
*
|
||||
* This import should be commented out in production mode because it will have a negative impact
|
||||
* on performance if an error is thrown.
|
||||
*/
|
||||
// import 'zone.js/plugins/zone-error'; // Included with Angular CLI.
|
||||
BIN
ui/src/favicon.ico
Normal file
BIN
ui/src/favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 948 B |
18
ui/src/index.html
Normal file
18
ui/src/index.html
Normal file
@@ -0,0 +1,18 @@
|
||||
<!doctype html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Ui</title>
|
||||
<base href="/">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="icon" type="image/x-icon" href="favicon.ico">
|
||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.1.0/css/all.css">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com">
|
||||
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500&display=swap" rel="stylesheet">
|
||||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
||||
</head>
|
||||
<body class="mat-typography">
|
||||
<app-root></app-root>
|
||||
</body>
|
||||
</html>
|
||||
12
ui/src/main.ts
Normal file
12
ui/src/main.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import { enableProdMode } from '@angular/core';
|
||||
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
||||
|
||||
import { AppModule } from './app/app.module';
|
||||
import { environment } from './environments/environment';
|
||||
|
||||
if (environment.production) {
|
||||
enableProdMode();
|
||||
}
|
||||
|
||||
platformBrowserDynamic().bootstrapModule(AppModule)
|
||||
.catch(err => console.error(err));
|
||||
53
ui/src/polyfills.ts
Normal file
53
ui/src/polyfills.ts
Normal file
@@ -0,0 +1,53 @@
|
||||
/**
|
||||
* This file includes polyfills needed by Angular and is loaded before the app.
|
||||
* You can add your own extra polyfills to this file.
|
||||
*
|
||||
* This file is divided into 2 sections:
|
||||
* 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers.
|
||||
* 2. Application imports. Files imported after ZoneJS that should be loaded before your main
|
||||
* file.
|
||||
*
|
||||
* The current setup is for so-called "evergreen" browsers; the last versions of browsers that
|
||||
* automatically update themselves. This includes recent versions of Safari, Chrome (including
|
||||
* Opera), Edge on the desktop, and iOS and Chrome on mobile.
|
||||
*
|
||||
* Learn more in https://angular.io/guide/browser-support
|
||||
*/
|
||||
|
||||
/***************************************************************************************************
|
||||
* BROWSER POLYFILLS
|
||||
*/
|
||||
|
||||
/**
|
||||
* By default, zone.js will patch all possible macroTask and DomEvents
|
||||
* user can disable parts of macroTask/DomEvents patch by setting following flags
|
||||
* because those flags need to be set before `zone.js` being loaded, and webpack
|
||||
* will put import in the top of bundle, so user need to create a separate file
|
||||
* in this directory (for example: zone-flags.ts), and put the following flags
|
||||
* into that file, and then add the following code before importing zone.js.
|
||||
* import './zone-flags';
|
||||
*
|
||||
* The flags allowed in zone-flags.ts are listed here.
|
||||
*
|
||||
* The following flags will work for all browsers.
|
||||
*
|
||||
* (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame
|
||||
* (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick
|
||||
* (window as any).__zone_symbol__UNPATCHED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames
|
||||
*
|
||||
* in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js
|
||||
* with the following flag, it will bypass `zone.js` patch for IE/Edge
|
||||
*
|
||||
* (window as any).__Zone_enable_cross_context_check = true;
|
||||
*
|
||||
*/
|
||||
|
||||
/***************************************************************************************************
|
||||
* Zone JS is required by default for Angular itself.
|
||||
*/
|
||||
import 'zone.js'; // Included with Angular CLI.
|
||||
|
||||
|
||||
/***************************************************************************************************
|
||||
* APPLICATION IMPORTS
|
||||
*/
|
||||
4
ui/src/styles.css
Normal file
4
ui/src/styles.css
Normal file
@@ -0,0 +1,4 @@
|
||||
/* You can add global styles to this file, and also import other style files */
|
||||
|
||||
html, body { height: 100%; }
|
||||
body { margin: 0; font-family: Roboto, "Helvetica Neue", sans-serif; }
|
||||
26
ui/src/test.ts
Normal file
26
ui/src/test.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
|
||||
|
||||
import 'zone.js/testing';
|
||||
import { getTestBed } from '@angular/core/testing';
|
||||
import {
|
||||
BrowserDynamicTestingModule,
|
||||
platformBrowserDynamicTesting
|
||||
} from '@angular/platform-browser-dynamic/testing';
|
||||
|
||||
declare const require: {
|
||||
context(path: string, deep?: boolean, filter?: RegExp): {
|
||||
<T>(id: string): T;
|
||||
keys(): string[];
|
||||
};
|
||||
};
|
||||
|
||||
// First, initialize the Angular testing environment.
|
||||
getTestBed().initTestEnvironment(
|
||||
BrowserDynamicTestingModule,
|
||||
platformBrowserDynamicTesting(),
|
||||
);
|
||||
|
||||
// Then we find all the tests.
|
||||
const context = require.context('./', true, /\.spec\.ts$/);
|
||||
// And load the modules.
|
||||
context.keys().map(context);
|
||||
Reference in New Issue
Block a user