restart app

This commit is contained in:
2021-06-17 18:04:42 +02:00
parent 976bc36baa
commit 9547631c13
32 changed files with 13953 additions and 140 deletions

49
.gitignore vendored Normal file
View File

@ -0,0 +1,49 @@
# See http://help.github.com/ignore-files/ for more about ignoring files.
# compiled output
/dist
/tmp
/out-tsc
# Only exists if Bazel was run
/bazel-out
# dependencies
/node_modules
# profiling files
chrome-profiler-events*.json
speed-measure-plugin*.json
# IDEs and editors
/.idea
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace
# IDE - VSCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
.history/*
# misc
/.sass-cache
/connect.lock
/coverage
/libpeerconnection.log
npm-debug.log
yarn-error.log
testem.log
/typings
# System Files
.DS_Store
Thumbs.db
hv2-ui-old/

17
hv2-ui/.browserslistrc Normal file
View File

@ -0,0 +1,17 @@
# This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
# For additional information regarding the format and rule options, please see:
# https://github.com/browserslist/browserslist#queries
# For the full list of supported browsers by the Angular framework, please see:
# https://angular.io/guide/browser-support
# You can see what browsers were selected by your queries by running:
# npx browserslist
last 1 Chrome version
last 1 Firefox version
last 2 Edge major versions
last 2 Safari major versions
last 2 iOS major versions
Firefox ESR
not IE 11 # Angular supports IE 11 only as an opt-in. To opt-in, remove the 'not' prefix on this line.

16
hv2-ui/.editorconfig Normal file
View File

@ -0,0 +1,16 @@
# Editor configuration, see https://editorconfig.org
root = true
[*]
charset = utf-8
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true
[*.ts]
quote_type = single
[*.md]
max_line_length = off
trim_trailing_whitespace = false

46
hv2-ui/.gitignore vendored Normal file
View File

@ -0,0 +1,46 @@
# See http://help.github.com/ignore-files/ for more about ignoring files.
# compiled output
/dist
/tmp
/out-tsc
# Only exists if Bazel was run
/bazel-out
# dependencies
/node_modules
# profiling files
chrome-profiler-events*.json
speed-measure-plugin*.json
# IDEs and editors
/.idea
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace
# IDE - VSCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
.history/*
# misc
/.sass-cache
/connect.lock
/coverage
/libpeerconnection.log
npm-debug.log
yarn-error.log
testem.log
/typings
# System Files
.DS_Store
Thumbs.db

View File

@ -1,4 +1,4 @@
# HvUi
# Hv2Ui
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 11.0.6.

View File

@ -3,7 +3,7 @@
"version": 1,
"newProjectRoot": "projects",
"projects": {
"hv-ui": {
"hv2-ui": {
"projectType": "application",
"schematics": {},
"root": "",

View File

@ -0,0 +1,37 @@
// @ts-check
// Protractor configuration file, see link for more information
// https://github.com/angular/protractor/blob/master/lib/config.ts
const { SpecReporter, StacktraceOption } = require('jasmine-spec-reporter');
/**
* @type { import("protractor").Config }
*/
exports.config = {
allScriptsTimeout: 11000,
specs: [
'./src/**/*.e2e-spec.ts'
],
capabilities: {
browserName: 'chrome'
},
directConnect: true,
SELENIUM_PROMISE_MANAGER: false,
baseUrl: 'http://localhost:4200/',
framework: 'jasmine',
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 30000,
print: function() {}
},
onPrepare() {
require('ts-node').register({
project: require('path').join(__dirname, './tsconfig.json')
});
jasmine.getEnv().addReporter(new SpecReporter({
spec: {
displayStacktrace: StacktraceOption.PRETTY
}
}));
}
};

View File

@ -0,0 +1,23 @@
import { AppPage } from './app.po';
import { browser, logging } from 'protractor';
describe('workspace-project App', () => {
let page: AppPage;
beforeEach(() => {
page = new AppPage();
});
it('should display welcome message', async () => {
await page.navigateTo();
expect(await page.getTitleText()).toEqual('hv2-ui app is running!');
});
afterEach(async () => {
// Assert that there are no errors emitted from the browser
const logs = await browser.manage().logs().get(logging.Type.BROWSER);
expect(logs).not.toContain(jasmine.objectContaining({
level: logging.Level.SEVERE,
} as logging.Entry));
});
});

11
hv2-ui/e2e/src/app.po.ts Normal file
View File

@ -0,0 +1,11 @@
import { browser, by, element } from 'protractor';
export class AppPage {
async navigateTo(): Promise<unknown> {
return browser.get(browser.baseUrl);
}
async getTitleText(): Promise<string> {
return element(by.css('app-root .content span')).getText();
}
}

13
hv2-ui/e2e/tsconfig.json Normal file
View File

@ -0,0 +1,13 @@
/* To learn more about this file see: https://angular.io/config/tsconfig. */
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/e2e",
"module": "commonjs",
"target": "es2018",
"types": [
"jasmine",
"node"
]
}
}

13622
hv2-ui/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -12,12 +12,12 @@
"private": true,
"dependencies": {
"@angular/animations": "~11.0.6",
"@angular/cdk": "~11.0.3-sha-ce5d10a77",
"@angular/cdk": "^11.2.13",
"@angular/common": "~11.0.6",
"@angular/compiler": "~11.0.6",
"@angular/core": "~11.0.6",
"@angular/forms": "~11.0.6",
"@angular/material": "~11.0.3-sha-ce5d10a77",
"@angular/material": "^11.2.13",
"@angular/platform-browser": "~11.0.6",
"@angular/platform-browser-dynamic": "~11.0.6",
"@angular/router": "~11.0.6",

View File

@ -1,13 +1,16 @@
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { ObjekteComponent } from './objekte/objekte.component';
import { RouterModule, Routes } from '@angular/router';
import { TestOutputComponent } from './test-output/test-output.component';
const routes: Routes = [
{ path: 'objekte', component: ObjekteComponent },
];
{ path: 'test', component: TestOutputComponent }
]
@NgModule({
imports: [RouterModule.forRoot(routes)],
exports: [RouterModule]
})
export class AppRoutingModule { }

View File

@ -1,3 +1,3 @@
<section class="mat-typography">
<app-navigation></app-navigation>
<app-navigation></app-navigation>
</section>

View File

@ -1,13 +1,9 @@
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
],
@ -20,16 +16,16 @@ describe('AppComponent', () => {
expect(app).toBeTruthy();
});
it(`should have as title 'hv-ui'`, () => {
it(`should have as title 'hv2-ui'`, () => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.componentInstance;
expect(app.title).toEqual('hv-ui');
expect(app.title).toEqual('hv2-ui');
});
it('should render title', () => {
const fixture = TestBed.createComponent(AppComponent);
fixture.detectChanges();
const compiled = fixture.nativeElement;
expect(compiled.querySelector('.content span').textContent).toContain('hv-ui app is running!');
expect(compiled.querySelector('.content span').textContent).toContain('hv2-ui app is running!');
});
});

View File

@ -6,5 +6,5 @@ import { Component } from '@angular/core';
styleUrls: ['./app.component.css']
})
export class AppComponent {
title = 'Nober Grundbesitz GbR Hausverwaltung';
title = 'hv2-ui';
}

View File

@ -1,12 +1,7 @@
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { HttpClientModule } from '@angular/common/http'
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { MessagesComponent } from './messages/messages.component';
import { ObjekteComponent } from './objekte/objekte.component';
import { FormsModule } from '@angular/forms';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { NavigationComponent } from './navigation/navigation.component';
import { LayoutModule } from '@angular/cdk/layout';
@ -15,42 +10,31 @@ import { MatButtonModule } from '@angular/material/button';
import { MatSidenavModule } from '@angular/material/sidenav';
import { MatIconModule } from '@angular/material/icon';
import { MatListModule } from '@angular/material/list';
import { MatTableModule } from '@angular/material/table';
import { MatPaginatorModule } from '@angular/material/paginator';
import { MatSortModule } from '@angular/material/sort';
import { MessagesComponent } from './messages/messages.component';
import { AppRoutingModule } from './app-routing.module';
import { TestOutputComponent } from './test-output/test-output.component';
import { MatCardModule } from '@angular/material/card';
import { MatGridListModule } from '@angular/material/grid-list'
import { MatFormFieldModule } from '@angular/material/form-field'
import { MatDatepickerModule } from '@angular/material/datepicker'
import { MatInputModule } from '@angular/material/input'
import { HttpClientModule } from '@angular/common/http';
@NgModule({
declarations: [
AppComponent,
NavigationComponent,
MessagesComponent,
ObjekteComponent,
NavigationComponent
TestOutputComponent
],
imports: [
BrowserModule,
FormsModule,
AppRoutingModule,
HttpClientModule,
BrowserAnimationsModule,
LayoutModule,
HttpClientModule,
MatToolbarModule,
MatButtonModule,
MatSidenavModule,
MatIconModule,
MatListModule,
MatTableModule,
MatPaginatorModule,
MatSortModule,
MatCardModule,
MatGridListModule,
MatFormFieldModule,
MatDatepickerModule,
MatInputModule
AppRoutingModule
],
providers: [],
bootstrap: [AppComponent]

View File

@ -1,11 +1,11 @@
<section class="mat-typography">
<mat-card class="defaultCard" *ngIf="messageService.messages.length">
<mat-card-header>
<mat-card-title>Messages</mat-card-title>
</mat-card-header>
<mat-card-content>
<button (click)="messageService.clear()">clear</button>
<div *ngFor='let message of messageService.messages'> {{message}} </div>
</mat-card-content>
</mat-card>
<mat-card class="defaultCard" *ngIf="messageService.messages.length">
<mat-card-header>
<mat-card-title>Messages</mat-card-title>
</mat-card-header>
<mat-card-content>
<button (click)="messageService.clear()">clear</button>
<div *ngFor='let message of messageService.messages'> {{message}} </div>
</mat-card-content>
</mat-card>
</section>

View File

@ -8,9 +8,9 @@ import { MessageService } from '../message.service';
})
export class MessagesComponent implements OnInit {
constructor(public messageService: MessageService) {}
constructor(public messageService: MessageService) { }
ngOnInit() {
ngOnInit(): void {
}
}
}

View File

@ -1,4 +1,3 @@
<section class="mat-typography">
<mat-sidenav-container class="sidenav-container">
<mat-sidenav #drawer class="sidenav" fixedInViewport
[attr.role]="(isHandset$ | async) ? 'dialog' : 'navigation'"
@ -6,7 +5,7 @@
[opened]="(isHandset$ | async) === false">
<mat-toolbar>Menu</mat-toolbar>
<mat-nav-list>
<a mat-list-item href="/objekte">Meine Objekte</a>
<a mat-list-item href="/test">Mein Test</a>
</mat-nav-list>
</mat-sidenav>
<mat-sidenav-content>
@ -19,11 +18,12 @@
*ngIf="isHandset$ | async">
<mat-icon aria-label="Side nav toggle icon">menu</mat-icon>
</button>
<span>Hausverwaltung</span>
<span>Nober Grundbesitz GbR Hausverwaltung</span>
</mat-toolbar>
<!-- Add Content Here -->
<router-outlet></router-outlet>
<app-messages></app-messages>
</mat-sidenav-content>
</mat-sidenav-container>
</section>

View File

@ -1,24 +0,0 @@
import { Injectable } from '@angular/core';
import { Observable, of } from 'rxjs';
import { HttpClient, HttpHeaders } from '@angular/common/http';
import { Objekt } from './objekt';
import { MessageService } from './message.service';
import { serviceBaseUrl } from './config';
@Injectable({
providedIn: 'root'
})
export class ObjektService {
constructor(private messageService: MessageService, private http: HttpClient) { }
getObjekte(): Promise<Objekt[]> {
this.messageService.add('ObjektService: fetched objekte');
return this.http.get<Objekt[]>(`${serviceBaseUrl}/hv/objekte`).toPromise()
}
getObjekt(id: number): Promise<Objekt> {
this.messageService.add(`ObjektService: fetch objekt id=${id}`);
return this.http.get<Objekt>(`${serviceBaseUrl}/hv/objekt/${id}`).toPromise()
}
}

View File

@ -1,5 +0,0 @@
export interface Objekt {
id: number;
shortname: string;
flaeche: number;
}

View File

@ -1,9 +0,0 @@
<section class="mat-typography">
<h2>Meine Objekte</h2>
<ul>
<li *ngFor="let objekt of objekte"
routerLink="/wohnungen/{{objekt.id}}">
<span>{{objekt.shortname}}</span>
</li>
</ul>
</section>

View File

@ -1,32 +0,0 @@
import { Component, OnInit } from '@angular/core';
import { Objekt } from '../objekt';
import { ObjektService } from '../objekt.service';
import { MessageService } from '../message.service';
@Component({
selector: 'app-objekte',
templateUrl: './objekte.component.html',
styleUrls: ['./objekte.component.css']
})
export class ObjekteComponent implements OnInit {
objekte: Objekt[];
selectedObjekt : Objekt;
constructor(private objektService: ObjektService, private messageService: MessageService) { }
async getObjekte() {
try {
this.objekte = await this.objektService.getObjekte();
} catch (err) {
this.messageService.add(JSON.stringify(err, undefined, 4))
}
}
ngOnInit(): void {
this.getObjekte();
}
}

View File

@ -1,13 +1,13 @@
import { TestBed } from '@angular/core/testing';
import { ObjektService } from './objekt.service';
import { TestOutputService } from './test-output.service';
describe('ObjektService', () => {
let service: ObjektService;
describe('TestOutputService', () => {
let service: TestOutputService;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(ObjektService);
service = TestBed.inject(TestOutputService);
});
it('should be created', () => {

View File

@ -0,0 +1,18 @@
import { Injectable } from '@angular/core';
import { Observable, of } from 'rxjs';
import { HttpClient, HttpHeaders } from '@angular/common/http';
import { MessageService } from './message.service';
import { serviceBaseUrl } from './config';
@Injectable({
providedIn: 'root'
})
export class TestOutputService {
constructor(private messageService: MessageService, private http: HttpClient) { }
getTestOutput(): Promise<String> {
this.messageService.add(`TestOutputService: fetch test output`);
return this.http.get<String>(`${serviceBaseUrl}/v1/test`).toPromise()
}
}

View File

@ -0,0 +1,18 @@
<section class="mat-typography">
<mat-card class="defaultCard">
<mat-card-header>
<mat-card-title>
Mein Test
</mat-card-title>
</mat-card-header>
<mat-card-content>
<div>
<h2>Mein Test</h2>
<pre>{{testOutput}}</pre>
</div>
</mat-card-content>
</mat-card>
</section>

View File

@ -1,20 +1,20 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { ObjekteComponent } from './objekte.component';
import { TestOutputComponent } from './test-output.component';
describe('ObjekteComponent', () => {
let component: ObjekteComponent;
let fixture: ComponentFixture<ObjekteComponent>;
describe('TestOutputComponent', () => {
let component: TestOutputComponent;
let fixture: ComponentFixture<TestOutputComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ ObjekteComponent ]
declarations: [ TestOutputComponent ]
})
.compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(ObjekteComponent);
fixture = TestBed.createComponent(TestOutputComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

View File

@ -0,0 +1,28 @@
import { Component, OnInit } from '@angular/core';
import { MessageService } from '../message.service';
import { TestOutputService } from '../test-output.service';
@Component({
selector: 'app-test-output',
templateUrl: './test-output.component.html',
styleUrls: ['./test-output.component.css']
})
export class TestOutputComponent implements OnInit {
constructor(private testOutputService: TestOutputService, private messageService: MessageService) { }
testOutput : String
async getTestOutput() {
try {
this.testOutput = await this.testOutputService.getTestOutput();
} catch (err) {
this.messageService.add(JSON.stringify(err, undefined, 4))
}
}
ngOnInit(): void {
this.messageService.add("TestOutputComponent.ngOnInit")
this.getTestOutput();
}
}

View File

@ -2,11 +2,12 @@
<html lang="en">
<head>
<meta charset="utf-8">
<title>HvUi</title>
<title>Hv2Ui</title>
<base href="/">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.ico">
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500&display=swap" rel="stylesheet">
<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">

View File

@ -1,8 +1,9 @@
/* @import '@angular/material/prebuilt-themes/deeppurple-amber.css'; */
/* 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; }
.defaultCard {
margin: 5px;
}