Commit 5355db1f authored by Sebastian's avatar Sebastian

Update auf Angular 8 - & Kiste voll Fixes für Bugs die vorher keine waren..

parent 4a785ecc
......@@ -23,17 +23,20 @@
"@angular/router": "^8.2.14",
"@ng-bootstrap/ng-bootstrap": "^5.2.1",
"@types/openlayers": "^4.6.17",
"ajv": "^6.11.0",
"angular-font-awesome": "^3.1.2",
"boostrap": "^2.0.0",
"core-js": "^3.6.4",
"font-awesome": "^4.7.0",
"jquery": "^3.4.1",
"ng-bootstrap": "^1.6.3",
"ngx-markdown": "^8.2.2",
"npm": "^6.13.7",
"ol": "^6.1.1",
"rxjs": "^6.5.4",
"tooltip.js": "^1.3.3",
"tslib": "^1.10.0",
"zone.js": "~0.10.2"
"zone.js": "^0.9.1"
},
"devDependencies": {
"@angular-devkit/build-angular": "^0.803.24",
......@@ -58,7 +61,7 @@
"protractor": "^5.4.3",
"sass": "^1.25.0",
"ts-node": "~8.6.2",
"tslint": "~6.0.0",
"tslint": "^5.20.1",
"typescript": "^3.5.3"
}
}
import { BrowserModule,BrowserAnimationsModule } from '@angular/platform-browser';
import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { LOCALE_ID, NgModule, enableProdMode } from '@angular/core';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { MarkdownModule } from 'ngx-markdown';
......@@ -137,8 +138,7 @@ enableProdMode();
MenubarItemComponent,
BliIconComponent,
TagComponent,
ElementFilterComponent,
BrowserAnimationsModule
ElementFilterComponent
],
imports: [
BrowserModule,
......@@ -148,6 +148,7 @@ enableProdMode();
AppRoutingModule,
NgbModule,
NgxSpinnerModule,
BrowserAnimationsModule,
NotifierModule,
MarkdownModule.forRoot()
],
......
......@@ -63,7 +63,7 @@ export class AuthComponent implements OnInit {
this.authService.onLoggedIn.subscribe(
(isLoggedIn)=>{
if(isLoggedIn){
if(this.asModal){
if(true/*this.asModal*/){
setTimeout(
()=>{
console.log("params:"+JSON.stringify(this.routeParams,null,3));
......
......@@ -38,7 +38,7 @@ export class BliDimensionFactory{
return false;
}
console.log("Pushing to array: " +dim.name+"/"+dim.id);
//console.log("Pushing to array: " +dim.name+"/"+dim.id);
BliDimensionFactory.dimensions.push(dim);
return true;
}
......@@ -63,7 +63,7 @@ export class BliDimensionFactory{
let existing = BliDimensionFactory.get(data);
if(existing === undefined){
let newDim = new BliDimension(data);
console.log("Creating new dimension: "+JSON.stringify(data));
//console.log("Creating new dimension: "+JSON.stringify(data));
BliDimensionFactory.add(newDim);
return newDim;
}else{
......
......@@ -153,6 +153,7 @@ private handleTokenLoginResponse(response: any, saveLogin: boolean,token:string)
this.currentUser = new User(response);
this.currentUser.setOAuthToken(token);
this.apiService.setBearer(this.bearer);
this.apiService.saveBearer();
this.apiService.getCurrentUser().subscribe(
......@@ -163,7 +164,7 @@ private handleTokenLoginResponse(response: any, saveLogin: boolean,token:string)
);
}
private handleUserResponse(response: any){
console.log("Userdata:" + JSON.stringify(response, null, 3));
//console.log("Userdata:" + JSON.stringify(response, null, 3));
this.currentUser.setData(response);
this.logger.debug(this.currentUser.toString());
......
......@@ -11,7 +11,9 @@ export class CacheService {
expiration = 30;
useLocalStorage = true;
data : Array<CacheItem> = new Array<CacheItem>();
constructor() {
constructor(
private logger: LogService
) {
console.log("Constructing CacheService.");
let storageJSON = JSON.stringify([]);
......@@ -21,7 +23,9 @@ export class CacheService {
try{
storageJSON=localStorage.getItem('CacheService.data');
}catch(e){
console.log("Caught exception.");
console.warn("Caught exception. Disabling cache.");
setTimeout(()=>{this.logger.notify("error","localStorage not available. Cache will not be persistent.")},3500);
this.useLocalStorage = false;
}
}else{
......
......@@ -263,7 +263,7 @@ export class GeoportalApiService {
public searchGeoElements(pattern: string) {
let params = new HttpParams();
params.set('q', pattern);
console.log(params.toString());
console.log("Searching for: "+params.toString());
//?q='+encodeURI(pattern)
return this.http.get(this.apiURL + '/search/?q=' + encodeURI(pattern), this.httpOptions);
}
......
......@@ -33,7 +33,9 @@ export class ModalManagerService {
onClose = new Subject<boolean>();
onOpen = new Subject<boolean>();
registerViewContainer(view:any){
console.log("registering view container ref.");
if(!view){
console.warn("ViewContainer is null");
}
this.viewContainerRef = view;
}
......@@ -107,7 +109,7 @@ export class ModalManagerService {
open(_comp:any, dismissable?: boolean,options?: any,data?:any){
this.close();
let comp = this.configureComponent(this.resolveComponent(_comp));
if(comp === null){
comp=_comp;
......@@ -129,27 +131,32 @@ export class ModalManagerService {
this.modalConfig['keyboard']=true;
//this.modalConfig['beforeDismiss']=(){this.onDismiss.next(true);});
/*
this.modalConfig['beforeDismiss']=()=>{
this.onDismiss.next(true);
return new Promise<boolean>(
(resolve,reject)=>{return resolve(true);}
)
};
};*/
this.modalConfig['beforeDismiss']=()=>new Promise<boolean>((resolve,reject)=>{this.onDismiss.next(true);resolve(true);})
this.modalRef = this.modalService.open(comp,this.modalConfig);
this.modalRef.onDismiss
this.modalRef.componentInstance.asModal = true;
//this.modalRef.onDismiss
let ci = this.modalRef.componentInstance;
ci.asModal = true;
if(data){
for(let key in data){
this.modalRef.componentInstance[key]=data[key];
ci[key]=data[key];
}
}
if(typeof this.modalRef.componentInstance['close'] == "function" && isObservable(this.modalRef.componentInstance['close'])){
this.subscription$=this.modalRef.componentInstance['close'].subscribe(
(event)=>{
this.close();
}
)
if(typeof ci['close'] == "function" && isObservable(ci['close'])){
this.subscription$=ci['close'].subscribe(
(event)=>{
this.close();
}
)
}
this.onOpen.next(true);
}
subscription$:any;
......
......@@ -15,6 +15,7 @@ import { LogService } from '../../../services/log.service';
import { GeoportalApiService } from '../../../services/geoportal-api.service';
import { AuthService } from '../../../services/auth.service';
import { BliService } from '../../../services/bli.service';
import { MapService } from '../../../services/map.service';
import { Observable ,throwError } from 'rxjs';
import { OverpassService } from '../../../services/overpass.service';
import { CacheService } from '../../../services/cache.service';
......@@ -29,7 +30,7 @@ import { isArray } from 'util';
export class EditComponent implements OnInit {
sharingCollapsed = true;
descCollapsed = true;
descCollapsed = false;
node : OsmNode;
id:number;
form: FormGroup;
......@@ -41,7 +42,8 @@ export class EditComponent implements OnInit {
private api: GeoportalApiService,
private logger: LogService,
private authService: AuthService,
private formBuilder: FormBuilder
private formBuilder: FormBuilder,
private mapService: MapService
) {
}
......@@ -57,7 +59,7 @@ export class EditComponent implements OnInit {
description:[this.node.getDescription()],
}),
networkpartnerForm:this.formBuilder.group({
welfare:[this.node.getTagValue('_gpd:welfare')],
welfare:[this.node.getTagValue('_gpd:welfare')||''],
aktionsradius:[this.node.getTagValue('_gpd:aktionsradius')],
aktionsradiusQuelle:[this.node.getTagValue('_gpd:aktionsradiusQuelle')],
}),
......@@ -142,6 +144,7 @@ export class EditComponent implements OnInit {
this.logger.notify('success','Gespeichert: '+this.node.getId());
}else{
this.logger.notify('success','Gespeichert.');
this.mapService.rerender();
}
},
(error)=>{
......@@ -151,6 +154,7 @@ export class EditComponent implements OnInit {
}
ngOnInit() {
this.loadElement();
this.setupFormGroup();
}
loadElement(){
this.logger.debug("Loading element..."),
......@@ -173,7 +177,6 @@ export class EditComponent implements OnInit {
this.node = OsmNodeFactory.create(data);
this.overpass.getOsmTags(this.node);
this.logger.debug(this.node.debugString());
this.setupFormGroup();
},
(error)=>{
this.logger.debug("Error fetching node "+this.id);
......@@ -186,8 +189,6 @@ export class EditComponent implements OnInit {
this.logger.debug("Element:");
this.logger.debug(this.node.debugString());
this.overpass.getOsmTags(this.node);
this.setupFormGroup();
}
});
......
......@@ -44,20 +44,21 @@
<option>Ja</option>
<option>Nein</option>
</select>-->
<div class="form-check form-check-inline col">
<input class="form-check-input" formControlName="welfare" type="radio" value="Keine Angabe">
<label class="form-check-label" for="inlineRadio1">Keine Angabe</label>
</div>
<div class="form-check form-check-inline col" >
<input class="form-check-input" formControlName="welfare" type="radio" value="Ja">
<label class="form-check-label" for="inlineRadio2">Ja</label>
</div>
<div class="form-check form-check-inline col" formControlName="welfare">
<input class="form-check-input" formControlName="welfare" type="radio" value="Nein">
<label class="form-check-label" for="inlineRadio3">Nein</label>
</div>
</div>
<div class="form-check form-check-inline col">
<input class="form-check-input" formControlName="welfare" type="radio" value="Keine Angabe">
<label class="form-check-label" for="inlineRadio1">Keine Angabe</label>
</div>
<div class="form-check form-check-inline col" >
<input class="form-check-input" formControlName="welfare" type="radio" value="Ja">
<label class="form-check-label" for="inlineRadio2">Ja</label>
</div>
<div class="form-check form-check-inline col">
<input class="form-check-input" formControlName="welfare" type="radio" value="Nein">
<label class="form-check-label" for="inlineRadio3">Nein</label>
</div>
</div>
</div>
<div class="form-group">
......@@ -88,7 +89,7 @@
<i class="fa fa-map-marker"
aria-hidden="true">&nbsp;</i><span>{{partner.name}}</span>
<button type="submit" class="btn btn-secondary btn-sm create-entry-tag"
(click)="node.removePeer(partner)">Entfernen</button>
(click)="node.removePeer(partner);partner.removePeer(node);">Entfernen</button>
</div>
</div>
......
......@@ -18,9 +18,9 @@ export class NetworkpartnerComponent implements OnInit {
) { }
ngOnInit() {
}
logMe(){
console.log("yeeT");
if(this.form){
console.log("Have form in networkpartner.");
console.log(this.form.get('welfare'));
}
}
}
......@@ -10,7 +10,7 @@ export class OsminformationComponent implements OnInit {
@Input('node') node : OsmNode;
@Input('form') form : FormGroup;
public infoCollapsed:boolean=true;
public infoCollapsed:boolean=false ;
constructor() { }
ngOnInit() {
......
......@@ -25,7 +25,7 @@ export class LoginComponent implements OnInit {
) { }
ngOnInit() {
this.logger.notify("error","Login-Component onInit");
this.modalManager.open('AuthComponent');
}
......
......@@ -17,7 +17,7 @@ import { EditsourceComponent } from '../../../widgets/modals/editsource/editsour
styleUrls: ['./modal.component.css']
})
export class ModalComponent implements OnInit {
@ViewChild('content',{ read: ViewContainerRef,static:false} ) viewContainerRef: ViewContainerRef;
@ViewChild('content',{ read: ViewContainerRef,static:true} ) viewContainerRef: ViewContainerRef;
//@ViewChild('templateRef') templateRef: TemplateRef<any>;
modalOpened$:any;
......
......@@ -63,5 +63,5 @@
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" (click)="close.emit(true)">Auswahl hinzufügen</button>
<button type="button" class="btn btn-primary" (click)="this.close();">Auswahl hinzufügen</button>
</div>
\ No newline at end of file
......@@ -18,13 +18,14 @@ import { OsmNodeFactory } from '../../../models/OsmNodeFactory';
export class NetworkpartnersearchComponent implements OnInit {
@Input() node:OsmNode;
@Input() asModal: boolean;
@Output() close:EventEmitter<boolean> = new EventEmitter<boolean>();
@Output() closeModal:EventEmitter<boolean> = new EventEmitter<boolean>();
searchPattern:FormControl;
constructor(
private logger: LogService,
private nominatimService:NominatimService,
private apiService:GeoportalApiService,
private nodeService:OsmNodeService
private nodeService:OsmNodeService,
private modalService:ModalManagerService,
) {
this.searchPattern = new FormControl('');
}
......@@ -74,5 +75,7 @@ export class NetworkpartnersearchComponent implements OnInit {
ngOnInit() {
this.geoportalResultNodes= new Array<OsmNode>();
}
close(){
this.modalService.close('Cross click');
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment