From 976bc36baa00f7c89d8cce6d3c76ef9a2efa8f6d Mon Sep 17 00:00:00 2001 From: Wolfgang Hottgenroth Date: Thu, 17 Jun 2021 13:51:55 +0200 Subject: [PATCH] initial --- Dockerfile | 4 + default.conf | 9 ++ hv2-ui/README.md | 27 ++++ hv2-ui/angular.json | 126 +++++++++++++++ hv2-ui/karma.conf.js | 44 +++++ hv2-ui/package.json | 47 ++++++ hv2-ui/src/app/app-routing.module.ts | 13 ++ hv2-ui/src/app/app.component.css | 0 hv2-ui/src/app/app.component.html | 3 + hv2-ui/src/app/app.component.spec.ts | 35 ++++ hv2-ui/src/app/app.component.ts | 10 ++ hv2-ui/src/app/app.module.ts | 58 +++++++ hv2-ui/src/app/config.ts | 1 + hv2-ui/src/app/message.service.spec.ts | 16 ++ hv2-ui/src/app/message.service.ts | 16 ++ .../src/app/messages/messages.component.css | 0 .../src/app/messages/messages.component.html | 11 ++ .../app/messages/messages.component.spec.ts | 25 +++ hv2-ui/src/app/messages/messages.component.ts | 16 ++ .../app/navigation/navigation.component.css | 17 ++ .../app/navigation/navigation.component.html | 29 ++++ .../navigation/navigation.component.spec.ts | 40 +++++ .../app/navigation/navigation.component.ts | 21 +++ hv2-ui/src/app/objekt.service.spec.ts | 16 ++ hv2-ui/src/app/objekt.service.ts | 24 +++ hv2-ui/src/app/objekt.ts | 5 + hv2-ui/src/app/objekte/objekte.component.css | 0 hv2-ui/src/app/objekte/objekte.component.html | 9 ++ .../src/app/objekte/objekte.component.spec.ts | 25 +++ hv2-ui/src/app/objekte/objekte.component.ts | 32 ++++ hv2-ui/src/assets/.gitkeep | 0 hv2-ui/src/environments/environment.prod.ts | 3 + hv2-ui/src/environments/environment.ts | 16 ++ hv2-ui/src/favicon.ico | Bin 0 -> 948 bytes hv2-ui/src/index.html | 15 ++ hv2-ui/src/main.ts | 12 ++ hv2-ui/src/polyfills.ts | 63 ++++++++ hv2-ui/src/styles.css | 8 + hv2-ui/src/test.ts | 25 +++ hv2-ui/tsconfig.app.json | 15 ++ hv2-ui/tsconfig.json | 20 +++ hv2-ui/tsconfig.spec.json | 18 +++ hv2-ui/tslint.json | 152 ++++++++++++++++++ 43 files changed, 1026 insertions(+) create mode 100644 Dockerfile create mode 100644 default.conf create mode 100644 hv2-ui/README.md create mode 100644 hv2-ui/angular.json create mode 100644 hv2-ui/karma.conf.js create mode 100644 hv2-ui/package.json create mode 100644 hv2-ui/src/app/app-routing.module.ts create mode 100644 hv2-ui/src/app/app.component.css create mode 100644 hv2-ui/src/app/app.component.html create mode 100644 hv2-ui/src/app/app.component.spec.ts create mode 100644 hv2-ui/src/app/app.component.ts create mode 100644 hv2-ui/src/app/app.module.ts create mode 100644 hv2-ui/src/app/config.ts create mode 100644 hv2-ui/src/app/message.service.spec.ts create mode 100644 hv2-ui/src/app/message.service.ts create mode 100644 hv2-ui/src/app/messages/messages.component.css create mode 100644 hv2-ui/src/app/messages/messages.component.html create mode 100644 hv2-ui/src/app/messages/messages.component.spec.ts create mode 100644 hv2-ui/src/app/messages/messages.component.ts create mode 100644 hv2-ui/src/app/navigation/navigation.component.css create mode 100644 hv2-ui/src/app/navigation/navigation.component.html create mode 100644 hv2-ui/src/app/navigation/navigation.component.spec.ts create mode 100644 hv2-ui/src/app/navigation/navigation.component.ts create mode 100644 hv2-ui/src/app/objekt.service.spec.ts create mode 100644 hv2-ui/src/app/objekt.service.ts create mode 100644 hv2-ui/src/app/objekt.ts create mode 100644 hv2-ui/src/app/objekte/objekte.component.css create mode 100644 hv2-ui/src/app/objekte/objekte.component.html create mode 100644 hv2-ui/src/app/objekte/objekte.component.spec.ts create mode 100644 hv2-ui/src/app/objekte/objekte.component.ts create mode 100644 hv2-ui/src/assets/.gitkeep create mode 100644 hv2-ui/src/environments/environment.prod.ts create mode 100644 hv2-ui/src/environments/environment.ts create mode 100644 hv2-ui/src/favicon.ico create mode 100644 hv2-ui/src/index.html create mode 100644 hv2-ui/src/main.ts create mode 100644 hv2-ui/src/polyfills.ts create mode 100644 hv2-ui/src/styles.css create mode 100644 hv2-ui/src/test.ts create mode 100644 hv2-ui/tsconfig.app.json create mode 100644 hv2-ui/tsconfig.json create mode 100644 hv2-ui/tsconfig.spec.json create mode 100644 hv2-ui/tslint.json diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..e64db21 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,4 @@ +FROM nginx:stable +COPY default.conf /etc/nginx/conf.d/ +COPY dist/hv2-ui/* /usr/share/nginx/html/ + diff --git a/default.conf b/default.conf new file mode 100644 index 0000000..7f9d3b8 --- /dev/null +++ b/default.conf @@ -0,0 +1,9 @@ +server { + listen 80; + server_name hv2-ui; + location / { + root /usr/share/nginx/html; + try_files $uri $uri/ /index.html; + } +} + diff --git a/hv2-ui/README.md b/hv2-ui/README.md new file mode 100644 index 0000000..57c867b --- /dev/null +++ b/hv2-ui/README.md @@ -0,0 +1,27 @@ +# HvUi + +This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 11.0.6. + +## Development server + +Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files. + +## Code scaffolding + +Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`. + +## Build + +Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `--prod` flag for a production build. + +## Running unit tests + +Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io). + +## Running end-to-end tests + +Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/). + +## Further help + +To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page. diff --git a/hv2-ui/angular.json b/hv2-ui/angular.json new file mode 100644 index 0000000..bcb80be --- /dev/null +++ b/hv2-ui/angular.json @@ -0,0 +1,126 @@ +{ + "$schema": "./node_modules/@angular/cli/lib/config/schema.json", + "version": 1, + "newProjectRoot": "projects", + "projects": { + "hv-ui": { + "projectType": "application", + "schematics": {}, + "root": "", + "sourceRoot": "src", + "prefix": "app", + "architect": { + "build": { + "builder": "@angular-devkit/build-angular:browser", + "options": { + "outputPath": "dist/hv2-ui", + "index": "src/index.html", + "main": "src/main.ts", + "polyfills": "src/polyfills.ts", + "tsConfig": "tsconfig.app.json", + "aot": true, + "assets": [ + "src/favicon.ico", + "src/assets" + ], + "styles": [ + "./node_modules/@angular/material/prebuilt-themes/purple-green.css", + "src/styles.css" + ], + "scripts": [] + }, + "configurations": { + "production": { + "fileReplacements": [ + { + "replace": "src/environments/environment.ts", + "with": "src/environments/environment.prod.ts" + } + ], + "optimization": true, + "outputHashing": "all", + "sourceMap": false, + "namedChunks": false, + "extractLicenses": true, + "vendorChunk": false, + "buildOptimizer": true, + "budgets": [ + { + "type": "initial", + "maximumWarning": "2mb", + "maximumError": "5mb" + }, + { + "type": "anyComponentStyle", + "maximumWarning": "6kb", + "maximumError": "10kb" + } + ] + } + } + }, + "serve": { + "builder": "@angular-devkit/build-angular:dev-server", + "options": { + "browserTarget": "hv2-ui:build" + }, + "configurations": { + "production": { + "browserTarget": "hv2-ui:build:production" + } + } + }, + "extract-i18n": { + "builder": "@angular-devkit/build-angular:extract-i18n", + "options": { + "browserTarget": "hv2-ui:build" + } + }, + "test": { + "builder": "@angular-devkit/build-angular:karma", + "options": { + "main": "src/test.ts", + "polyfills": "src/polyfills.ts", + "tsConfig": "tsconfig.spec.json", + "karmaConfig": "karma.conf.js", + "assets": [ + "src/favicon.ico", + "src/assets" + ], + "styles": [ + "./node_modules/@angular/material/prebuilt-themes/purple-green.css", + "src/styles.css" + ], + "scripts": [] + } + }, + "lint": { + "builder": "@angular-devkit/build-angular:tslint", + "options": { + "tsConfig": [ + "tsconfig.app.json", + "tsconfig.spec.json", + "e2e/tsconfig.json" + ], + "exclude": [ + "**/node_modules/**" + ] + } + }, + "e2e": { + "builder": "@angular-devkit/build-angular:protractor", + "options": { + "protractorConfig": "e2e/protractor.conf.js", + "devServerTarget": "hv2-ui:serve" + }, + "configurations": { + "production": { + "devServerTarget": "hv2-ui:serve:production" + } + } + } + } + } + }, + "defaultProject": "hv2-ui" +} diff --git a/hv2-ui/karma.conf.js b/hv2-ui/karma.conf.js new file mode 100644 index 0000000..9a18bd3 --- /dev/null +++ b/hv2-ui/karma.conf.js @@ -0,0 +1,44 @@ +// Karma configuration file, see link for more information +// https://karma-runner.github.io/1.0/config/configuration-file.html + +module.exports = function (config) { + config.set({ + basePath: '', + frameworks: ['jasmine', '@angular-devkit/build-angular'], + plugins: [ + require('karma-jasmine'), + require('karma-chrome-launcher'), + require('karma-jasmine-html-reporter'), + require('karma-coverage'), + require('@angular-devkit/build-angular/plugins/karma') + ], + client: { + jasmine: { + // you can add configuration options for Jasmine here + // the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html + // for example, you can disable the random execution with `random: false` + // or set a specific seed with `seed: 4321` + }, + clearContext: false // leave Jasmine Spec Runner output visible in browser + }, + jasmineHtmlReporter: { + suppressAll: true // removes the duplicated traces + }, + coverageReporter: { + dir: require('path').join(__dirname, './coverage/hv2-ui'), + subdir: '.', + reporters: [ + { type: 'html' }, + { type: 'text-summary' } + ] + }, + reporters: ['progress', 'kjhtml'], + port: 9876, + colors: true, + logLevel: config.LOG_INFO, + autoWatch: true, + browsers: ['Chrome'], + singleRun: false, + restartOnFileChange: true + }); +}; diff --git a/hv2-ui/package.json b/hv2-ui/package.json new file mode 100644 index 0000000..5e59434 --- /dev/null +++ b/hv2-ui/package.json @@ -0,0 +1,47 @@ +{ + "name": "hv2-ui", + "version": "0.0.0", + "scripts": { + "ng": "ng", + "start": "ng serve", + "build": "ng build", + "test": "ng test", + "lint": "ng lint", + "e2e": "ng e2e" + }, + "private": true, + "dependencies": { + "@angular/animations": "~11.0.6", + "@angular/cdk": "~11.0.3-sha-ce5d10a77", + "@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/platform-browser": "~11.0.6", + "@angular/platform-browser-dynamic": "~11.0.6", + "@angular/router": "~11.0.6", + "rxjs": "~6.6.0", + "tslib": "^2.0.0", + "zone.js": "~0.10.2" + }, + "devDependencies": { + "@angular-devkit/build-angular": "~0.1100.6", + "@angular/cli": "~11.0.6", + "@angular/compiler-cli": "~11.0.6", + "@types/jasmine": "~3.6.0", + "@types/node": "^12.11.1", + "codelyzer": "^6.0.0", + "jasmine-core": "~3.6.0", + "jasmine-spec-reporter": "~5.0.0", + "karma": "~5.1.0", + "karma-chrome-launcher": "~3.1.0", + "karma-coverage": "~2.0.3", + "karma-jasmine": "~4.0.0", + "karma-jasmine-html-reporter": "^1.5.0", + "protractor": "~7.0.0", + "ts-node": "~8.3.0", + "tslint": "~6.1.0", + "typescript": "~4.0.2" + } +} diff --git a/hv2-ui/src/app/app-routing.module.ts b/hv2-ui/src/app/app-routing.module.ts new file mode 100644 index 0000000..0fd33cd --- /dev/null +++ b/hv2-ui/src/app/app-routing.module.ts @@ -0,0 +1,13 @@ +import { NgModule } from '@angular/core'; +import { Routes, RouterModule } from '@angular/router'; +import { ObjekteComponent } from './objekte/objekte.component'; + +const routes: Routes = [ + { path: 'objekte', component: ObjekteComponent }, +]; + +@NgModule({ + imports: [RouterModule.forRoot(routes)], + exports: [RouterModule] +}) +export class AppRoutingModule { } diff --git a/hv2-ui/src/app/app.component.css b/hv2-ui/src/app/app.component.css new file mode 100644 index 0000000..e69de29 diff --git a/hv2-ui/src/app/app.component.html b/hv2-ui/src/app/app.component.html new file mode 100644 index 0000000..7ed031e --- /dev/null +++ b/hv2-ui/src/app/app.component.html @@ -0,0 +1,3 @@ +
+ +
\ No newline at end of file diff --git a/hv2-ui/src/app/app.component.spec.ts b/hv2-ui/src/app/app.component.spec.ts new file mode 100644 index 0000000..55947b7 --- /dev/null +++ b/hv2-ui/src/app/app.component.spec.ts @@ -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 'hv-ui'`, () => { + const fixture = TestBed.createComponent(AppComponent); + const app = fixture.componentInstance; + expect(app.title).toEqual('hv-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!'); + }); +}); diff --git a/hv2-ui/src/app/app.component.ts b/hv2-ui/src/app/app.component.ts new file mode 100644 index 0000000..fd9774f --- /dev/null +++ b/hv2-ui/src/app/app.component.ts @@ -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 = 'Nober Grundbesitz GbR Hausverwaltung'; +} diff --git a/hv2-ui/src/app/app.module.ts b/hv2-ui/src/app/app.module.ts new file mode 100644 index 0000000..e85ef0a --- /dev/null +++ b/hv2-ui/src/app/app.module.ts @@ -0,0 +1,58 @@ +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'; +import { MatToolbarModule } from '@angular/material/toolbar'; +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 { 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' + +@NgModule({ + declarations: [ + AppComponent, + MessagesComponent, + ObjekteComponent, + NavigationComponent + ], + imports: [ + BrowserModule, + FormsModule, + AppRoutingModule, + HttpClientModule, + BrowserAnimationsModule, + LayoutModule, + MatToolbarModule, + MatButtonModule, + MatSidenavModule, + MatIconModule, + MatListModule, + MatTableModule, + MatPaginatorModule, + MatSortModule, + MatCardModule, + MatGridListModule, + MatFormFieldModule, + MatDatepickerModule, + MatInputModule + ], + providers: [], + bootstrap: [AppComponent] +}) +export class AppModule { } diff --git a/hv2-ui/src/app/config.ts b/hv2-ui/src/app/config.ts new file mode 100644 index 0000000..f3b9396 --- /dev/null +++ b/hv2-ui/src/app/config.ts @@ -0,0 +1 @@ +export const serviceBaseUrl = "https://api.hv.nober.de"; diff --git a/hv2-ui/src/app/message.service.spec.ts b/hv2-ui/src/app/message.service.spec.ts new file mode 100644 index 0000000..1db761b --- /dev/null +++ b/hv2-ui/src/app/message.service.spec.ts @@ -0,0 +1,16 @@ +import { TestBed } from '@angular/core/testing'; + +import { MessageService } from './message.service'; + +describe('MessageService', () => { + let service: MessageService; + + beforeEach(() => { + TestBed.configureTestingModule({}); + service = TestBed.inject(MessageService); + }); + + it('should be created', () => { + expect(service).toBeTruthy(); + }); +}); diff --git a/hv2-ui/src/app/message.service.ts b/hv2-ui/src/app/message.service.ts new file mode 100644 index 0000000..045ebbe --- /dev/null +++ b/hv2-ui/src/app/message.service.ts @@ -0,0 +1,16 @@ +import { Injectable } from '@angular/core'; + +@Injectable({ + providedIn: 'root', +}) +export class MessageService { + messages: string[] = []; + + add(message: string) { + this.messages.push(message); + } + + clear() { + this.messages = []; + } +} \ No newline at end of file diff --git a/hv2-ui/src/app/messages/messages.component.css b/hv2-ui/src/app/messages/messages.component.css new file mode 100644 index 0000000..e69de29 diff --git a/hv2-ui/src/app/messages/messages.component.html b/hv2-ui/src/app/messages/messages.component.html new file mode 100644 index 0000000..7e4368a --- /dev/null +++ b/hv2-ui/src/app/messages/messages.component.html @@ -0,0 +1,11 @@ +
+ + + Messages + + + +
{{message}}
+
+
+
\ No newline at end of file diff --git a/hv2-ui/src/app/messages/messages.component.spec.ts b/hv2-ui/src/app/messages/messages.component.spec.ts new file mode 100644 index 0000000..69163f1 --- /dev/null +++ b/hv2-ui/src/app/messages/messages.component.spec.ts @@ -0,0 +1,25 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { MessagesComponent } from './messages.component'; + +describe('MessagesComponent', () => { + let component: MessagesComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [ MessagesComponent ] + }) + .compileComponents(); + }); + + beforeEach(() => { + fixture = TestBed.createComponent(MessagesComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/hv2-ui/src/app/messages/messages.component.ts b/hv2-ui/src/app/messages/messages.component.ts new file mode 100644 index 0000000..f83dc03 --- /dev/null +++ b/hv2-ui/src/app/messages/messages.component.ts @@ -0,0 +1,16 @@ +import { Component, OnInit } from '@angular/core'; +import { MessageService } from '../message.service'; + +@Component({ + selector: 'app-messages', + templateUrl: './messages.component.html', + styleUrls: ['./messages.component.css'] +}) +export class MessagesComponent implements OnInit { + + constructor(public messageService: MessageService) {} + + ngOnInit() { + } + +} \ No newline at end of file diff --git a/hv2-ui/src/app/navigation/navigation.component.css b/hv2-ui/src/app/navigation/navigation.component.css new file mode 100644 index 0000000..f4bad0f --- /dev/null +++ b/hv2-ui/src/app/navigation/navigation.component.css @@ -0,0 +1,17 @@ +.sidenav-container { + height: 100%; +} + +.sidenav { + width: 200px; +} + +.sidenav .mat-toolbar { + background: inherit; +} + +.mat-toolbar.mat-primary { + position: sticky; + top: 0; + z-index: 1; +} diff --git a/hv2-ui/src/app/navigation/navigation.component.html b/hv2-ui/src/app/navigation/navigation.component.html new file mode 100644 index 0000000..f083b53 --- /dev/null +++ b/hv2-ui/src/app/navigation/navigation.component.html @@ -0,0 +1,29 @@ +
+ + + Menu + + Meine Objekte + + + + + + Hausverwaltung + + + + + + +
\ No newline at end of file diff --git a/hv2-ui/src/app/navigation/navigation.component.spec.ts b/hv2-ui/src/app/navigation/navigation.component.spec.ts new file mode 100644 index 0000000..cf90c6e --- /dev/null +++ b/hv2-ui/src/app/navigation/navigation.component.spec.ts @@ -0,0 +1,40 @@ +import { LayoutModule } from '@angular/cdk/layout'; +import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing'; +import { NoopAnimationsModule } from '@angular/platform-browser/animations'; +import { MatButtonModule } from '@angular/material/button'; +import { MatIconModule } from '@angular/material/icon'; +import { MatListModule } from '@angular/material/list'; +import { MatSidenavModule } from '@angular/material/sidenav'; +import { MatToolbarModule } from '@angular/material/toolbar'; + +import { NavigationComponent } from './navigation.component'; + +describe('NavigationComponent', () => { + let component: NavigationComponent; + let fixture: ComponentFixture; + + beforeEach(waitForAsync(() => { + TestBed.configureTestingModule({ + declarations: [NavigationComponent], + imports: [ + NoopAnimationsModule, + LayoutModule, + MatButtonModule, + MatIconModule, + MatListModule, + MatSidenavModule, + MatToolbarModule, + ] + }).compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(NavigationComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should compile', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/hv2-ui/src/app/navigation/navigation.component.ts b/hv2-ui/src/app/navigation/navigation.component.ts new file mode 100644 index 0000000..6419fb0 --- /dev/null +++ b/hv2-ui/src/app/navigation/navigation.component.ts @@ -0,0 +1,21 @@ +import { Component } from '@angular/core'; +import { BreakpointObserver, Breakpoints } from '@angular/cdk/layout'; +import { Observable } from 'rxjs'; +import { map, shareReplay } from 'rxjs/operators'; + +@Component({ + selector: 'app-navigation', + templateUrl: './navigation.component.html', + styleUrls: ['./navigation.component.css'] +}) +export class NavigationComponent { + + isHandset$: Observable = this.breakpointObserver.observe(Breakpoints.Handset) + .pipe( + map(result => result.matches), + shareReplay() + ); + + constructor(private breakpointObserver: BreakpointObserver) {} + +} diff --git a/hv2-ui/src/app/objekt.service.spec.ts b/hv2-ui/src/app/objekt.service.spec.ts new file mode 100644 index 0000000..d2d6ce3 --- /dev/null +++ b/hv2-ui/src/app/objekt.service.spec.ts @@ -0,0 +1,16 @@ +import { TestBed } from '@angular/core/testing'; + +import { ObjektService } from './objekt.service'; + +describe('ObjektService', () => { + let service: ObjektService; + + beforeEach(() => { + TestBed.configureTestingModule({}); + service = TestBed.inject(ObjektService); + }); + + it('should be created', () => { + expect(service).toBeTruthy(); + }); +}); diff --git a/hv2-ui/src/app/objekt.service.ts b/hv2-ui/src/app/objekt.service.ts new file mode 100644 index 0000000..729cc19 --- /dev/null +++ b/hv2-ui/src/app/objekt.service.ts @@ -0,0 +1,24 @@ +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 { + this.messageService.add('ObjektService: fetched objekte'); + return this.http.get(`${serviceBaseUrl}/hv/objekte`).toPromise() + } + + getObjekt(id: number): Promise { + this.messageService.add(`ObjektService: fetch objekt id=${id}`); + return this.http.get(`${serviceBaseUrl}/hv/objekt/${id}`).toPromise() + } +} diff --git a/hv2-ui/src/app/objekt.ts b/hv2-ui/src/app/objekt.ts new file mode 100644 index 0000000..ebb9515 --- /dev/null +++ b/hv2-ui/src/app/objekt.ts @@ -0,0 +1,5 @@ +export interface Objekt { + id: number; + shortname: string; + flaeche: number; +} diff --git a/hv2-ui/src/app/objekte/objekte.component.css b/hv2-ui/src/app/objekte/objekte.component.css new file mode 100644 index 0000000..e69de29 diff --git a/hv2-ui/src/app/objekte/objekte.component.html b/hv2-ui/src/app/objekte/objekte.component.html new file mode 100644 index 0000000..fa7ddf3 --- /dev/null +++ b/hv2-ui/src/app/objekte/objekte.component.html @@ -0,0 +1,9 @@ +
+

Meine Objekte

+
    +
  • + {{objekt.shortname}} +
  • +
+
\ No newline at end of file diff --git a/hv2-ui/src/app/objekte/objekte.component.spec.ts b/hv2-ui/src/app/objekte/objekte.component.spec.ts new file mode 100644 index 0000000..b34c6cc --- /dev/null +++ b/hv2-ui/src/app/objekte/objekte.component.spec.ts @@ -0,0 +1,25 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { ObjekteComponent } from './objekte.component'; + +describe('ObjekteComponent', () => { + let component: ObjekteComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [ ObjekteComponent ] + }) + .compileComponents(); + }); + + beforeEach(() => { + fixture = TestBed.createComponent(ObjekteComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/hv2-ui/src/app/objekte/objekte.component.ts b/hv2-ui/src/app/objekte/objekte.component.ts new file mode 100644 index 0000000..e774f32 --- /dev/null +++ b/hv2-ui/src/app/objekte/objekte.component.ts @@ -0,0 +1,32 @@ +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(); + } +} diff --git a/hv2-ui/src/assets/.gitkeep b/hv2-ui/src/assets/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/hv2-ui/src/environments/environment.prod.ts b/hv2-ui/src/environments/environment.prod.ts new file mode 100644 index 0000000..3612073 --- /dev/null +++ b/hv2-ui/src/environments/environment.prod.ts @@ -0,0 +1,3 @@ +export const environment = { + production: true +}; diff --git a/hv2-ui/src/environments/environment.ts b/hv2-ui/src/environments/environment.ts new file mode 100644 index 0000000..7b4f817 --- /dev/null +++ b/hv2-ui/src/environments/environment.ts @@ -0,0 +1,16 @@ +// This file can be replaced during build by using the `fileReplacements` array. +// `ng build --prod` replaces `environment.ts` with `environment.prod.ts`. +// The list of file replacements can be found in `angular.json`. + +export const environment = { + production: false +}; + +/* + * 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/dist/zone-error'; // Included with Angular CLI. diff --git a/hv2-ui/src/favicon.ico b/hv2-ui/src/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..997406ad22c29aae95893fb3d666c30258a09537 GIT binary patch literal 948 zcmV;l155mgP)CBYU7IjCFmI-B}4sMJt3^s9NVg!P0 z6hDQy(L`XWMkB@zOLgN$4KYz;j0zZxq9KKdpZE#5@k0crP^5f9KO};h)ZDQ%ybhht z%t9#h|nu0K(bJ ztIkhEr!*UyrZWQ1k2+YkGqDi8Z<|mIN&$kzpKl{cNP=OQzXHz>vn+c)F)zO|Bou>E z2|-d_=qY#Y+yOu1a}XI?cU}%04)zz%anD(XZC{#~WreV!a$7k2Ug`?&CUEc0EtrkZ zL49MB)h!_K{H(*l_93D5tO0;BUnvYlo+;yss%n^&qjt6fZOa+}+FDO(~2>G z2dx@=JZ?DHP^;b7*Y1as5^uphBsh*s*z&MBd?e@I>-9kU>63PjP&^#5YTOb&x^6Cf z?674rmSHB5Fk!{Gv7rv!?qX#ei_L(XtwVqLX3L}$MI|kJ*w(rhx~tc&L&xP#?cQow zX_|gx$wMr3pRZIIr_;;O|8fAjd;1`nOeu5K(pCu7>^3E&D2OBBq?sYa(%S?GwG&_0-s%_v$L@R!5H_fc)lOb9ZoOO#p`Nn`KU z3LTTBtjwo`7(HA6 z7gmO$yTR!5L>Bsg!X8616{JUngg_@&85%>W=mChTR;x4`P=?PJ~oPuy5 zU-L`C@_!34D21{fD~Y8NVnR3t;aqZI3fIhmgmx}$oc-dKDC6Ap$Gy>a!`A*x2L1v0 WcZ@i?LyX}70000 + + + + HvUi + + + + + + + + + + diff --git a/hv2-ui/src/main.ts b/hv2-ui/src/main.ts new file mode 100644 index 0000000..c7b673c --- /dev/null +++ b/hv2-ui/src/main.ts @@ -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)); diff --git a/hv2-ui/src/polyfills.ts b/hv2-ui/src/polyfills.ts new file mode 100644 index 0000000..9b8f300 --- /dev/null +++ b/hv2-ui/src/polyfills.ts @@ -0,0 +1,63 @@ +/** + * 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 Safari >= 10, Chrome >= 55 (including Opera), + * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile. + * + * Learn more in https://angular.io/guide/browser-support + */ + +/*************************************************************************************************** + * BROWSER POLYFILLS + */ + +/** IE11 requires the following for NgClass support on SVG elements */ +// import 'classlist.js'; // Run `npm install --save classlist.js`. + +/** + * Web Animations `@angular/platform-browser/animations` + * Only required if AnimationBuilder is used within the application and using IE/Edge or Safari. + * Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0). + */ +// import 'web-animations-js'; // Run `npm install --save web-animations-js`. + +/** + * 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/dist/zone'; // Included with Angular CLI. + + +/*************************************************************************************************** + * APPLICATION IMPORTS + */ diff --git a/hv2-ui/src/styles.css b/hv2-ui/src/styles.css new file mode 100644 index 0000000..0d16c19 --- /dev/null +++ b/hv2-ui/src/styles.css @@ -0,0 +1,8 @@ +/* @import '@angular/material/prebuilt-themes/deeppurple-amber.css'; */ + +html, body { height: 100%; } +body { margin: 0; font-family: Roboto, "Helvetica Neue", sans-serif; } + +.defaultCard { + margin: 5px; +} \ No newline at end of file diff --git a/hv2-ui/src/test.ts b/hv2-ui/src/test.ts new file mode 100644 index 0000000..50193eb --- /dev/null +++ b/hv2-ui/src/test.ts @@ -0,0 +1,25 @@ +// This file is required by karma.conf.js and loads recursively all the .spec and framework files + +import 'zone.js/dist/zone-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): { + keys(): string[]; + (id: string): T; + }; +}; + +// 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); diff --git a/hv2-ui/tsconfig.app.json b/hv2-ui/tsconfig.app.json new file mode 100644 index 0000000..82d91dc --- /dev/null +++ b/hv2-ui/tsconfig.app.json @@ -0,0 +1,15 @@ +/* To learn more about this file see: https://angular.io/config/tsconfig. */ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "./out-tsc/app", + "types": [] + }, + "files": [ + "src/main.ts", + "src/polyfills.ts" + ], + "include": [ + "src/**/*.d.ts" + ] +} diff --git a/hv2-ui/tsconfig.json b/hv2-ui/tsconfig.json new file mode 100644 index 0000000..f69f654 --- /dev/null +++ b/hv2-ui/tsconfig.json @@ -0,0 +1,20 @@ +/* To learn more about this file see: https://angular.io/config/tsconfig. */ +{ + "compileOnSave": false, + "compilerOptions": { + "baseUrl": "./", + "outDir": "./dist/out-tsc", + "sourceMap": true, + "declaration": false, + "downlevelIteration": true, + "experimentalDecorators": true, + "moduleResolution": "node", + "importHelpers": true, + "target": "es2015", + "module": "es2020", + "lib": [ + "es2018", + "dom" + ] + } +} diff --git a/hv2-ui/tsconfig.spec.json b/hv2-ui/tsconfig.spec.json new file mode 100644 index 0000000..092345b --- /dev/null +++ b/hv2-ui/tsconfig.spec.json @@ -0,0 +1,18 @@ +/* To learn more about this file see: https://angular.io/config/tsconfig. */ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "./out-tsc/spec", + "types": [ + "jasmine" + ] + }, + "files": [ + "src/test.ts", + "src/polyfills.ts" + ], + "include": [ + "src/**/*.spec.ts", + "src/**/*.d.ts" + ] +} diff --git a/hv2-ui/tslint.json b/hv2-ui/tslint.json new file mode 100644 index 0000000..277c8eb --- /dev/null +++ b/hv2-ui/tslint.json @@ -0,0 +1,152 @@ +{ + "extends": "tslint:recommended", + "rulesDirectory": [ + "codelyzer" + ], + "rules": { + "align": { + "options": [ + "parameters", + "statements" + ] + }, + "array-type": false, + "arrow-return-shorthand": true, + "curly": true, + "deprecation": { + "severity": "warning" + }, + "eofline": true, + "import-blacklist": [ + true, + "rxjs/Rx" + ], + "import-spacing": true, + "indent": { + "options": [ + "spaces" + ] + }, + "max-classes-per-file": false, + "max-line-length": [ + true, + 140 + ], + "member-ordering": [ + true, + { + "order": [ + "static-field", + "instance-field", + "static-method", + "instance-method" + ] + } + ], + "no-console": [ + true, + "debug", + "info", + "time", + "timeEnd", + "trace" + ], + "no-empty": false, + "no-inferrable-types": [ + true, + "ignore-params" + ], + "no-non-null-assertion": true, + "no-redundant-jsdoc": true, + "no-switch-case-fall-through": true, + "no-var-requires": false, + "object-literal-key-quotes": [ + true, + "as-needed" + ], + "quotemark": [ + true, + "single" + ], + "semicolon": { + "options": [ + "always" + ] + }, + "space-before-function-paren": { + "options": { + "anonymous": "never", + "asyncArrow": "always", + "constructor": "never", + "method": "never", + "named": "never" + } + }, + "typedef": [ + true, + "call-signature" + ], + "typedef-whitespace": { + "options": [ + { + "call-signature": "nospace", + "index-signature": "nospace", + "parameter": "nospace", + "property-declaration": "nospace", + "variable-declaration": "nospace" + }, + { + "call-signature": "onespace", + "index-signature": "onespace", + "parameter": "onespace", + "property-declaration": "onespace", + "variable-declaration": "onespace" + } + ] + }, + "variable-name": { + "options": [ + "ban-keywords", + "check-format", + "allow-pascal-case" + ] + }, + "whitespace": { + "options": [ + "check-branch", + "check-decl", + "check-operator", + "check-separator", + "check-type", + "check-typecast" + ] + }, + "component-class-suffix": true, + "contextual-lifecycle": true, + "directive-class-suffix": true, + "no-conflicting-lifecycle": true, + "no-host-metadata-property": true, + "no-input-rename": true, + "no-inputs-metadata-property": true, + "no-output-native": true, + "no-output-on-prefix": true, + "no-output-rename": true, + "no-outputs-metadata-property": true, + "template-banana-in-box": true, + "template-no-negated-async": true, + "use-lifecycle-interface": true, + "use-pipe-transform-interface": true, + "directive-selector": [ + true, + "attribute", + "app", + "camelCase" + ], + "component-selector": [ + true, + "element", + "app", + "kebab-case" + ] + } +}