Add google maps

This commit is contained in:
David Eder 2021-06-03 20:43:06 +02:00
parent bd2ab0e6d3
commit 92cfc07166
17 changed files with 82 additions and 97 deletions

View File

@ -119,6 +119,10 @@
} }
} }
} }
}}, }
"defaultProject": "app-fe" },
"defaultProject": "app-fe",
"cli": {
"analytics": false
}
} }

View File

@ -1041,6 +1041,22 @@
"resolved": "https://registry.npmjs.org/@angular/forms/-/forms-9.1.12.tgz", "resolved": "https://registry.npmjs.org/@angular/forms/-/forms-9.1.12.tgz",
"integrity": "sha512-LhjnZlC4WEsEsAJfOZLte+Lks3WBAFVeRv2lzoQNFVr/IMzBNDVfjEaaSqKF1cei3cjY39Df2nYDMJM7HfqbJA==" "integrity": "sha512-LhjnZlC4WEsEsAJfOZLte+Lks3WBAFVeRv2lzoQNFVr/IMzBNDVfjEaaSqKF1cei3cjY39Df2nYDMJM7HfqbJA=="
}, },
"@angular/google-maps": {
"version": "12.0.2",
"resolved": "https://registry.npmjs.org/@angular/google-maps/-/google-maps-12.0.2.tgz",
"integrity": "sha512-wxE0i7ywHh+2DtVe2uJpRyupC7ciN5EOT3DPatcWjS9O32KjTlqU6kd49neKmnfhpUFFkMI584ZcwzBmc/CvRg==",
"requires": {
"@types/googlemaps": "^3.43.1",
"tslib": "^2.1.0"
},
"dependencies": {
"tslib": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.2.0.tgz",
"integrity": "sha512-gS9GVHRU+RGn5KQM2rllAlR3dU6m7AcpJKdtH8gFvQiC4Otgk98XnmMU+nZenHt/+VhnBPWwgrJsyrdcw6i23w=="
}
}
},
"@angular/language-service": { "@angular/language-service": {
"version": "9.1.12", "version": "9.1.12",
"resolved": "https://registry.npmjs.org/@angular/language-service/-/language-service-9.1.12.tgz", "resolved": "https://registry.npmjs.org/@angular/language-service/-/language-service-9.1.12.tgz",
@ -2935,6 +2951,11 @@
"@types/node": "*" "@types/node": "*"
} }
}, },
"@types/googlemaps": {
"version": "3.43.3",
"resolved": "https://registry.npmjs.org/@types/googlemaps/-/googlemaps-3.43.3.tgz",
"integrity": "sha512-ZWNoz/O8MPEpiajvj7QiqCY8tTLFNqNZ/a+s+zTV58wFVNAvvqV4bdGfnsjTb5Cs4V6wEsLrX8XRhmnyYJ2Tdg=="
},
"@types/jasmine": { "@types/jasmine": {
"version": "3.4.6", "version": "3.4.6",
"resolved": "https://registry.npmjs.org/@types/jasmine/-/jasmine-3.4.6.tgz", "resolved": "https://registry.npmjs.org/@types/jasmine/-/jasmine-3.4.6.tgz",

View File

@ -19,6 +19,7 @@
"@angular/compiler": "~9.1.9", "@angular/compiler": "~9.1.9",
"@angular/core": "~9.1.9", "@angular/core": "~9.1.9",
"@angular/forms": "~9.1.9", "@angular/forms": "~9.1.9",
"@angular/google-maps": "^12.0.2",
"@angular/localize": "~9.1.9", "@angular/localize": "~9.1.9",
"@angular/material": "9.2.4", "@angular/material": "9.2.4",
"@angular/platform-browser": "~9.1.9", "@angular/platform-browser": "~9.1.9",

View File

@ -9,7 +9,6 @@ import {InterceptorService} from './services/interceptor.service';
import {WebsocketService} from './services/websocket.service'; import {WebsocketService} from './services/websocket.service';
import {LoggerModule, NgxLoggerLevel} from 'ngx-logger'; import {LoggerModule, NgxLoggerLevel} from 'ngx-logger';
import {environment} from '../environments/environment'; import {environment} from '../environments/environment';
import {TestSubCompComponent} from './component/testsubcomp/test-sub-comp.component';
import {FormsModule, ReactiveFormsModule} from '@angular/forms'; import {FormsModule, ReactiveFormsModule} from '@angular/forms';
import {MatFormFieldModule} from '@angular/material/form-field'; import {MatFormFieldModule} from '@angular/material/form-field';
import {BrowserAnimationsModule} from '@angular/platform-browser/animations'; import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
@ -17,10 +16,12 @@ import {MatButtonModule} from '@angular/material/button';
import {MatInputModule} from '@angular/material/input'; import {MatInputModule} from '@angular/material/input';
import {MatSlideToggleModule} from '@angular/material/slide-toggle'; import {MatSlideToggleModule} from '@angular/material/slide-toggle';
import {MatSliderModule} from "@angular/material/slider"; import {MatSliderModule} from "@angular/material/slider";
import { GoogleMapsModule } from '@angular/google-maps';
@NgModule({ @NgModule({
declarations: [LandingComponent, TestSubCompComponent], declarations: [LandingComponent],
imports: [ imports: [
GoogleMapsModule,
ReactiveFormsModule, ReactiveFormsModule,
BrowserModule, BrowserModule,
BrowserAnimationsModule, BrowserAnimationsModule,

View File

@ -0,0 +1,5 @@
html, body {
height: 100%;
padding: 0;
margin: 0;
}

View File

@ -1,33 +1,6 @@
<h1>landing works!</h1> <google-map width="auto" height="100vh"
[zoom]="zoom"
<mat-slider min="1" max="5" step="0.5" [value]="myValue"></mat-slider> [center]="center"
[options]="options"
<h2>Two way data binding, passing data, triggering child event...</h2>
<mat-form-field *ngIf="true">
<input
type="text"
placeholder="Placeholder"
matInput
[(ngModel)]="exampleInputText"
> >
</mat-form-field> </google-map>
<app-test-sub-comp [message]="exampleInputText" (buttonClickedEvent)="alert()"
[anotherInput]=""
></app-test-sub-comp>
<h2>Hide display with *ngIf</h2>
<mat-slide-toggle [(ngModel)]="showPar">Show paragraph</mat-slide-toggle>
<p *ngIf="showPar">Toggle me</p>
<app-test-sub-comp *ngIf="showPar"
[message]="exampleInputText" (buttonClickedEvent)="alert()"
[anotherInput]=""
></app-test-sub-comp>
<h2>Display a test list with *ngFor</h2>
<span *ngFor="let dict of testList">{{dict.value}}; </span>

View File

@ -1,9 +1,9 @@
import {Component, OnInit} from '@angular/core'; import {Component, OnInit, ViewChild} from '@angular/core';
import {RestService} from '../../services/rest.service'; import {RestService} from '../../services/rest.service';
import {WebsocketService} from '../../services/websocket.service';
import {NGXLogger} from 'ngx-logger'; import {NGXLogger} from 'ngx-logger';
import {Subscription} from 'rxjs'; import {Subscription} from 'rxjs';
@Component({ @Component({
selector: 'app-landing', selector: 'app-landing',
templateUrl: './landing.component.html', templateUrl: './landing.component.html',
@ -11,17 +11,22 @@ import {Subscription} from 'rxjs';
}) })
export class LandingComponent implements OnInit { export class LandingComponent implements OnInit {
zoom = 12;
center: { lat: -33, lng: 151 };
options: google.maps.MapOptions = {
zoomControl: false,
scrollwheel: false,
maxZoom: 12,
minZoom: 12,
disableDefaultUI: true
};
private wsSubscription: Subscription; private wsSubscription: Subscription;
private wsMessageCounter: number; private wsMessageCounter: number;
exampleInputText: string;
showPar = false;
testList = [{'value': 1}, {'value': 2}, {'value': 3}];
myValue: any = 15;
constructor( constructor(
private logger: NGXLogger, private logger: NGXLogger,
private restService: RestService, private restService: RestService
private wsService: WebsocketService
) { ) {
} }
@ -33,10 +38,10 @@ export class LandingComponent implements OnInit {
this.promiseCall(); this.promiseCall();
// perform test ws send / receive // perform test ws send / receive
setTimeout(() => { /* setTimeout(() => {
this.wsCall(); this.wsCall();
}, },
1000); 1000);*/
} }
private observableCall(): void { private observableCall(): void {
@ -66,7 +71,7 @@ export class LandingComponent implements OnInit {
}); });
} }
private wsCall(): void { /* private wsCall(): void {
this.wsMessageCounter = 0; this.wsMessageCounter = 0;
this.wsSubscription = this.wsService.wsTestCall('Test message').message.subscribe( this.wsSubscription = this.wsService.wsTestCall('Test message').message.subscribe(
result => { result => {
@ -80,9 +85,6 @@ export class LandingComponent implements OnInit {
this.wsSubscription.unsubscribe(); this.wsSubscription.unsubscribe();
} }
); );
} }*/
alert() {
alert(this.exampleInputText);
}
} }

View File

@ -1 +0,0 @@
<p>{{message}} <button mat-raised-button (click)="buttonClickedEvent.emit()">Click me</button></p>

View File

@ -1,24 +0,0 @@
import {Component, EventEmitter, Input, OnInit, Output} from '@angular/core';
@Component({
selector: 'app-test-sub-comp',
templateUrl: './test-sub-comp.component.html',
styleUrls: ['./test-sub-comp.component.css']
})
export class TestSubCompComponent implements OnInit {
@Input()
message: string;
@Input()
anotherInput: string;
@Output()
buttonClickedEvent: EventEmitter<void> = new EventEmitter<void>();
constructor() {
}
ngOnInit(): void {
this.message;
}
}

View File

@ -15,7 +15,7 @@ export class RestService {
} }
testCall(i: number): Observable<string> { testCall(i: number): Observable<string> {
const url = this.currentLocation + 'test/'; const url = this.currentLocation + 'api1';
this.logger.debug('Performing ' + i + '. test rest call on', url); this.logger.debug('Performing ' + i + '. test rest call on', url);
return this.http.get<string>(url); return this.http.get<string>(url);
} }

View File

@ -3,7 +3,7 @@ import {NgxLoggerLevel} from 'ngx-logger';
export const environment = { export const environment = {
production: true, production: true,
location: window.location.hostname, location: window.location.hostname,
port: 8000, port: 5004,
ws_url_root: 'ws://' + window.location.hostname + ':' + window.location.port + '/', ws_url_root: 'ws://' + window.location.hostname + ':' + window.location.port + '/',
log_level: NgxLoggerLevel.WARN, log_level: NgxLoggerLevel.WARN,
}; };

View File

@ -7,7 +7,7 @@ import {NgxLoggerLevel} from 'ngx-logger';
export const environment = { export const environment = {
production: false, production: false,
location: 'localhost', location: 'localhost',
port: 8000, port: 5004,
ws_location: 'ws://127.0.0.1', ws_location: 'ws://127.0.0.1',
ws_port: 8000, ws_port: 8000,
log_level: NgxLoggerLevel.DEBUG, log_level: NgxLoggerLevel.DEBUG,

View File

@ -6,6 +6,7 @@
<base href="/"> <base href="/">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.ico"> <link rel="icon" type="image/x-icon" href="favicon.ico">
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyCXF-INAlIkG9uPBofGLUCyHthaLxN-3PY"></script>
</head> </head>
<body> <body>
<app-landing></app-landing> <app-landing></app-landing>

View File

@ -9,7 +9,7 @@
"moduleResolution": "node", "moduleResolution": "node",
"emitDecoratorMetadata": true, "emitDecoratorMetadata": true,
"experimentalDecorators": true, "experimentalDecorators": true,
"target": "es5", "target": "es2015",
"typeRoots": [ "typeRoots": [
"node_modules/@types" "node_modules/@types"
], ],

View File

@ -1 +1,2 @@
flask flask
Flask-Cors

View File

@ -1,7 +1,8 @@
from flask import Flask from flask import Flask
from flask_cors import CORS
app = Flask(__name__) app = Flask(__name__)
CORS(app)
@app.route('/') @app.route('/')
def hello_world(): def hello_world():