Changeset 13cbe66 for src/mapservice-webclient
- Timestamp:
- May 25, 2019, 5:40:08 PM (8 years ago)
- Branches:
- debian/bullseye, master
- Children:
- 70f328b
- Parents:
- 28198a1
- git-author:
- Joachim Langenbach <joachim.langenbach@…> (05/22/19 18:20:13)
- git-committer:
- Joachim Langenbach <joachim.langenbach@…> (05/25/19 17:40:08)
- Location:
- src/mapservice-webclient
- Files:
-
- 12 added
- 18 edited
-
src-gen/gnuboat-mapservice/api/users.service.ts (modified) (3 diffs)
-
src-gen/gnuboat-mapservice/api/waters.service.ts (modified) (4 diffs)
-
src-gen/gnuboat-mapservice/model/gauge.ts (added)
-
src-gen/gnuboat-mapservice/model/gaugeCreation.ts (added)
-
src-gen/gnuboat-mapservice/model/gaugeGeoJson.ts (added)
-
src-gen/gnuboat-mapservice/model/gaugeGeoJsonProperties.ts (added)
-
src-gen/gnuboat-mapservice/model/geoJsonPoint.ts (added)
-
src-gen/gnuboat-mapservice/model/geoJsonType.ts (added)
-
src-gen/gnuboat-mapservice/model/models.ts (modified) (1 diff)
-
src-gen/gnuboat-mapservice/model/water.ts (modified) (2 diffs)
-
src/app/app.component.html (modified) (1 diff)
-
src/app/app.module.ts (modified) (2 diffs)
-
src/app/map/map.component.ts (modified) (5 diffs)
-
src/app/model/geopoint.ts (added)
-
src/app/model/index.ts (added)
-
src/app/mygnuboat/gaugeedit.component.html (added)
-
src/app/mygnuboat/gaugeedit.component.ts (added)
-
src/app/mygnuboat/index.ts (modified) (1 diff)
-
src/app/mygnuboat/wateradd.component.html (modified) (2 diffs)
-
src/app/mygnuboat/wateradd.component.ts (modified) (2 diffs)
-
src/app/water/gauges.component.html (added)
-
src/app/water/gauges.component.ts (added)
-
src/app/water/index.ts (modified) (1 diff)
-
src/app/water/water.component.html (modified) (1 diff)
-
src/app/water/water.component.ts (modified) (3 diffs)
-
src/app/water/waterdetails.component.html (modified) (1 diff)
-
src/app/water/waterdetails.component.ts (modified) (5 diffs)
-
src/app/water/waters.component.ts (modified) (2 diffs)
-
src/css/GnuBoat.Mapservice.Webclient.css (modified) (1 diff)
-
src/tsconfig.app.json (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
src/mapservice-webclient/src-gen/gnuboat-mapservice/api/users.service.ts
r28198a1 r13cbe66 148 148 let headers = this.defaultHeaders; 149 149 150 // authentication (apiKeyAuth) required151 if (this.configuration.apiKeys && this.configuration.apiKeys["X-API-KEY"]) {152 headers = headers.set('X-API-KEY', this.configuration.apiKeys["X-API-KEY"]);153 }154 155 150 // authentication (basicAuth) required 156 151 if (this.configuration.username || this.configuration.password) { … … 197 192 let headers = this.defaultHeaders; 198 193 199 // authentication (apiKeyAuth) required200 if (this.configuration.apiKeys && this.configuration.apiKeys["X-API-KEY"]) {201 headers = headers.set('X-API-KEY', this.configuration.apiKeys["X-API-KEY"]);202 }203 204 194 // authentication (basicAuth) required 205 195 if (this.configuration.username || this.configuration.password) { … … 231 221 /** 232 222 * Returns info of a user 233 * Returns information for auser223 * Returns information of current/authorized user 234 224 * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. 235 225 * @param reportProgress flag to report request and response progress. -
src/mapservice-webclient/src-gen/gnuboat-mapservice/api/waters.service.ts
r28198a1 r13cbe66 19 19 import { Observable } from 'rxjs/Observable'; 20 20 21 import { Gauge } from '../model/gauge'; 22 import { GaugeCreation } from '../model/gaugeCreation'; 21 23 import { HttpError } from '../model/httpError'; 22 24 import { Water } from '../model/water'; … … 61 63 62 64 /** 63 * Represents a water64 * Returns the water identified by id65 * @param id Item ID66 * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.67 * @param reportProgress flag to report request and response progress.68 */69 public waterGetById(id: number, observe?: 'body', reportProgress?: boolean): Observable<Water>;70 public waterGetById(id: number, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<Water>>;71 public waterGetById(id: number, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<Water>>;72 public waterGetById(id: number, observe: any = 'body', reportProgress: boolean = false ): Observable<any> {73 if (id === null || id === undefined) {74 throw new Error('Required parameter id was null or undefined when calling waterGetById.');75 }76 77 let headers = this.defaultHeaders;78 79 // to determine the Accept header80 const httpHeaderAccepts: string[] = [81 'application/json'82 ];83 const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);84 if (httpHeaderAcceptSelected !== undefined) {85 headers = headers.set('Accept', httpHeaderAcceptSelected);86 }87 88 // to determine the Content-Type header89 const consumes: string[] = [90 ];91 92 return this.httpClient.get<Water>(`${this.configuration.basePath}/waters/${encodeURIComponent(String(id))}`,93 {94 withCredentials: this.configuration.withCredentials,95 headers: headers,96 observe: observe,97 reportProgress: reportProgress98 }99 );100 }101 102 /**103 65 * Add a new water 104 66 * Adds a new water to the database … … 144 106 waterCreation, 145 107 { 108 withCredentials: this.configuration.withCredentials, 109 headers: headers, 110 observe: observe, 111 reportProgress: reportProgress 112 } 113 ); 114 } 115 116 /** 117 * Add a new water 118 * Adds a new gauge for water waterId to the database 119 * @param waterId Water ID 120 * @param gaugeCreation 121 * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. 122 * @param reportProgress flag to report request and response progress. 123 */ 124 public watersGaugeCreate(waterId: number, gaugeCreation?: GaugeCreation, observe?: 'body', reportProgress?: boolean): Observable<Gauge>; 125 public watersGaugeCreate(waterId: number, gaugeCreation?: GaugeCreation, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<Gauge>>; 126 public watersGaugeCreate(waterId: number, gaugeCreation?: GaugeCreation, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<Gauge>>; 127 public watersGaugeCreate(waterId: number, gaugeCreation?: GaugeCreation, observe: any = 'body', reportProgress: boolean = false ): Observable<any> { 128 if (waterId === null || waterId === undefined) { 129 throw new Error('Required parameter waterId was null or undefined when calling watersGaugeCreate.'); 130 } 131 132 let headers = this.defaultHeaders; 133 134 // authentication (apiKeyAuth) required 135 if (this.configuration.apiKeys && this.configuration.apiKeys["X-API-KEY"]) { 136 headers = headers.set('X-API-KEY', this.configuration.apiKeys["X-API-KEY"]); 137 } 138 139 // authentication (basicAuth) required 140 if (this.configuration.username || this.configuration.password) { 141 headers = headers.set('Authorization', 'Basic ' + btoa(this.configuration.username + ':' + this.configuration.password)); 142 } 143 // to determine the Accept header 144 const httpHeaderAccepts: string[] = [ 145 'application/json', 146 'application/geo+json' 147 ]; 148 const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); 149 if (httpHeaderAcceptSelected !== undefined) { 150 headers = headers.set('Accept', httpHeaderAcceptSelected); 151 } 152 153 // to determine the Content-Type header 154 const consumes: string[] = [ 155 'application/json' 156 ]; 157 const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); 158 if (httpContentTypeSelected !== undefined) { 159 headers = headers.set('Content-Type', httpContentTypeSelected); 160 } 161 162 return this.httpClient.post<Gauge>(`${this.configuration.basePath}/waters/${encodeURIComponent(String(waterId))}/gauges`, 163 gaugeCreation, 164 { 165 withCredentials: this.configuration.withCredentials, 166 headers: headers, 167 observe: observe, 168 reportProgress: reportProgress 169 } 170 ); 171 } 172 173 /** 174 * Represents a gauge 175 * Returns the gauge identified by id 176 * @param waterId Water ID 177 * @param gaugeId Gauge ID 178 * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. 179 * @param reportProgress flag to report request and response progress. 180 */ 181 public watersGaugeGetById(waterId: number, gaugeId: number, observe?: 'body', reportProgress?: boolean): Observable<Gauge>; 182 public watersGaugeGetById(waterId: number, gaugeId: number, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<Gauge>>; 183 public watersGaugeGetById(waterId: number, gaugeId: number, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<Gauge>>; 184 public watersGaugeGetById(waterId: number, gaugeId: number, observe: any = 'body', reportProgress: boolean = false ): Observable<any> { 185 if (waterId === null || waterId === undefined) { 186 throw new Error('Required parameter waterId was null or undefined when calling watersGaugeGetById.'); 187 } 188 if (gaugeId === null || gaugeId === undefined) { 189 throw new Error('Required parameter gaugeId was null or undefined when calling watersGaugeGetById.'); 190 } 191 192 let headers = this.defaultHeaders; 193 194 // to determine the Accept header 195 const httpHeaderAccepts: string[] = [ 196 'application/json', 197 'application/geo+json' 198 ]; 199 const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); 200 if (httpHeaderAcceptSelected !== undefined) { 201 headers = headers.set('Accept', httpHeaderAcceptSelected); 202 } 203 204 // to determine the Content-Type header 205 const consumes: string[] = [ 206 ]; 207 208 return this.httpClient.get<Gauge>(`${this.configuration.basePath}/waters/${encodeURIComponent(String(waterId))}/gauges/${encodeURIComponent(String(gaugeId))}`, 209 { 210 withCredentials: this.configuration.withCredentials, 211 headers: headers, 212 observe: observe, 213 reportProgress: reportProgress 214 } 215 ); 216 } 217 218 /** 219 * Find gauges of water waterId by gaugeId 220 * Returns all gauges of water waterId 221 * @param waterId Water ID 222 * @param name 223 * @param manager 224 * @param orderBy Order by field: name 225 * @param offset Skip over a number of elements by specifying an offset value for the query 226 * @param limit Limit the number of elements on the response 227 * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. 228 * @param reportProgress flag to report request and response progress. 229 */ 230 public watersGaugesGet(waterId: number, name?: string, manager?: string, orderBy?: string, offset?: number, limit?: number, observe?: 'body', reportProgress?: boolean): Observable<Array<Gauge>>; 231 public watersGaugesGet(waterId: number, name?: string, manager?: string, orderBy?: string, offset?: number, limit?: number, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<Array<Gauge>>>; 232 public watersGaugesGet(waterId: number, name?: string, manager?: string, orderBy?: string, offset?: number, limit?: number, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<Array<Gauge>>>; 233 public watersGaugesGet(waterId: number, name?: string, manager?: string, orderBy?: string, offset?: number, limit?: number, observe: any = 'body', reportProgress: boolean = false ): Observable<any> { 234 if (waterId === null || waterId === undefined) { 235 throw new Error('Required parameter waterId was null or undefined when calling watersGaugesGet.'); 236 } 237 238 let queryParameters = new HttpParams({encoder: new CustomHttpUrlEncodingCodec()}); 239 if (name !== undefined && name !== null) { 240 queryParameters = queryParameters.set('name', <any>name); 241 } 242 if (manager !== undefined && manager !== null) { 243 queryParameters = queryParameters.set('manager', <any>manager); 244 } 245 if (orderBy !== undefined && orderBy !== null) { 246 queryParameters = queryParameters.set('orderBy', <any>orderBy); 247 } 248 if (offset !== undefined && offset !== null) { 249 queryParameters = queryParameters.set('offset', <any>offset); 250 } 251 if (limit !== undefined && limit !== null) { 252 queryParameters = queryParameters.set('limit', <any>limit); 253 } 254 255 let headers = this.defaultHeaders; 256 257 // to determine the Accept header 258 const httpHeaderAccepts: string[] = [ 259 'application/json', 260 'application/geo+json' 261 ]; 262 const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); 263 if (httpHeaderAcceptSelected !== undefined) { 264 headers = headers.set('Accept', httpHeaderAcceptSelected); 265 } 266 267 // to determine the Content-Type header 268 const consumes: string[] = [ 269 ]; 270 271 return this.httpClient.get<Array<Gauge>>(`${this.configuration.basePath}/waters/${encodeURIComponent(String(waterId))}/gauges`, 272 { 273 params: queryParameters, 146 274 withCredentials: this.configuration.withCredentials, 147 275 headers: headers, … … 211 339 } 212 340 341 /** 342 * Represents a water 343 * Returns the water identified by id 344 * @param id Item ID 345 * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. 346 * @param reportProgress flag to report request and response progress. 347 */ 348 public watersGetById(id: number, observe?: 'body', reportProgress?: boolean): Observable<Water>; 349 public watersGetById(id: number, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<Water>>; 350 public watersGetById(id: number, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<Water>>; 351 public watersGetById(id: number, observe: any = 'body', reportProgress: boolean = false ): Observable<any> { 352 if (id === null || id === undefined) { 353 throw new Error('Required parameter id was null or undefined when calling watersGetById.'); 354 } 355 356 let headers = this.defaultHeaders; 357 358 // to determine the Accept header 359 const httpHeaderAccepts: string[] = [ 360 'application/json' 361 ]; 362 const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); 363 if (httpHeaderAcceptSelected !== undefined) { 364 headers = headers.set('Accept', httpHeaderAcceptSelected); 365 } 366 367 // to determine the Content-Type header 368 const consumes: string[] = [ 369 ]; 370 371 return this.httpClient.get<Water>(`${this.configuration.basePath}/waters/${encodeURIComponent(String(id))}`, 372 { 373 withCredentials: this.configuration.withCredentials, 374 headers: headers, 375 observe: observe, 376 reportProgress: reportProgress 377 } 378 ); 379 } 380 213 381 } -
src/mapservice-webclient/src-gen/gnuboat-mapservice/model/models.ts
r28198a1 r13cbe66 1 export * from './gauge'; 2 export * from './gaugeCreation'; 3 export * from './gaugeGeoJson'; 4 export * from './gaugeGeoJsonProperties'; 5 export * from './geoJsonPoint'; 6 export * from './geoJsonType'; 1 7 export * from './httpError'; 2 8 export * from './order'; -
src/mapservice-webclient/src-gen/gnuboat-mapservice/model/water.ts
r28198a1 r13cbe66 10 10 * Do not edit the class manually. 11 11 */ 12 import { Gauge } from './gauge'; 12 13 import { OsmType } from './osmType'; 13 14 … … 19 20 osmId?: number; 20 21 osmType?: OsmType; 22 gauges?: Array<Gauge>; 21 23 } 22 24 -
src/mapservice-webclient/src/app/app.component.html
r28198a1 r13cbe66 8 8 <li class="pure-menu-item"><a class="pure-menu-link" routerLink="water">Waters</a></li> 9 9 <li class="pure-menu-heading">My GNUBoat</li> 10 <li class="pure-menu-item"><a class="pure-menu-link" routerLink="mygnuboat" fragment="logfiles">Logfiles</a></li> 10 11 <li class="pure-menu-item"><a class="pure-menu-link" routerLink="mygnuboat" fragment="waters">Waters</a></li> 11 <li class="pure-menu-item"><a class="pure-menu-link" routerLink="mygnuboat" fragment="logfiles">Logfiles</a></li>12 12 <li class="pure-menu-item"><a class="pure-menu-link" routerLink="mygnuboat" fragment="profile">Profile</a></li> 13 13 <li class="pure-menu-item" *ngIf="currentUser"><a class="pure-menu-link" (click)="logout()">Logout</a></li> -
src/mapservice-webclient/src/app/app.module.ts
r28198a1 r13cbe66 14 14 import { HomeComponent } from './home/'; 15 15 import { LoginComponent, RegisterComponent } from './user'; 16 import { WatersComponent, WaterComponent, WaterDetailsComponent } from './water';16 import { WatersComponent, WaterComponent, WaterDetailsComponent, GaugesComponent } from './water'; 17 17 import { MapComponent } from './map'; 18 import { UserComponent, WaterAddComponent } from './mygnuboat';18 import { UserComponent, WaterAddComponent, GaugeEditComponent } from './mygnuboat'; 19 19 20 20 … … 37 37 WaterComponent, 38 38 WaterDetailsComponent, 39 GaugesComponent, 39 40 WaterAddComponent, 41 GaugeEditComponent, 40 42 MapComponent, 41 43 ], -
src/mapservice-webclient/src/app/map/map.component.ts
r28198a1 r13cbe66 1 import { Component, OnInit, OnDestroy, Input, ViewChild, Output, EventEmitter } from '@angular/core';1 import { Component, OnInit, OnDestroy, Input, ViewChild, Output, EventEmitter, OnChanges, SimpleChanges } from '@angular/core'; 2 2 3 3 declare let L; 4 4 5 import { OsmType } from '../../../src-gen/gnuboat-mapservice';5 import { OsmType, Water, Gauge, GaugeGeoJson, GeoJsonPoint, GaugeGeoJsonProperties } from '../../../src-gen/gnuboat-mapservice'; 6 6 import { OsmOverpassService } from '../services'; 7 7 import { GeoPoint } from '../model'; … … 12 12 providers: [OsmOverpassService], 13 13 }) 14 export class MapComponent implements OnInit, OnDestroy {14 export class MapComponent implements OnInit, OnDestroy, OnChanges { 15 15 private _mapViewportStyleClass:string; 16 16 private map; 17 17 private mapControl; 18 private geoJsonLayer; 18 private osmLayer; 19 private gaugesLayer; 20 @Input() water: Water = undefined; 19 21 @Input() controlsShow = true; 20 22 @ViewChild('mapElement') mapElement; 21 @Output() clicked = new EventEmitter<GeoPoint>();23 @Output() clickedRight = new EventEmitter<GeoPoint>(); 22 24 23 25 constructor(private osmOverpassService: OsmOverpassService) { … … 29 31 30 32 ngOnDestroy() { 33 } 34 35 ngOnChanges(changes: SimpleChanges): void { 36 if('water' in changes && this.water && this.map){ 37 this.addWaterToMap(this.water); 38 } 31 39 } 32 40 … … 51 59 }); 52 60 53 this.map.on('c lick', event => {61 this.map.on('contextmenu', event => { 54 62 var point = {} as GeoPoint; 55 63 point.latitude = event.latlng.lat; 56 64 point.longitude = event.latlng.lng; 57 this.clicked.emit(point); 65 this.clickedRight.emit(point); 66 return event; 58 67 }); 59 68 … … 95 104 L.control.scale().addTo(this.map); 96 105 } 106 107 if(this.water){ 108 this.addWaterToMap(this.water); 109 } 97 110 } 98 111 99 112 addOsmElement(id: number, osmType: OsmType){ 100 if(!this. geoJsonLayer){101 this. geoJsonLayer = L.geoJSON().addTo(this.map);113 if(!this.osmLayer){ 114 this.osmLayer = this.addGeoJsonLayer(); 102 115 } 116 this.osmLayer.clearLayers(); 103 117 this.osmOverpassService.getElement(id, osmType).subscribe(res => { 104 this. geoJsonLayer.addData(res);105 this.map.fitBounds(this. geoJsonLayer.getBounds());118 this.osmLayer.addData(res); 119 this.map.fitBounds(this.osmLayer.getBounds()); 106 120 }); 107 121 } 122 123 addGeoJsonLayer(options = {}){ 124 return L.geoJSON(undefined, options).addTo(this.map); 125 } 126 127 addWaterToMap(water:Water){ 128 this.addOsmElement(water.osmId, water.osmType); 129 if('gauges' in water){ 130 this.addGaugesToMap(water.gauges); 131 } 132 } 133 134 addGaugesToMap(gauges:Gauge[]){ 135 /* currently openapi-generators typescript-angular plugin isn't able to handle content types, which are not plain json 136 therefore we convert the gauges here and add them to the map. The API as defined, supports geo+json format already 137 */ 138 if(this.gaugesLayer){ 139 this.gaugesLayer.clearLayers(); 140 } 141 if(gauges && gauges.length < 1){ 142 return; 143 } 144 if(!this.gaugesLayer){ 145 this.gaugesLayer = this.addGeoJsonLayer({ 146 onEachFeature: this.gaugesMarkerPopup, 147 pointToLayer: this.gaugesMarker 148 }); 149 } 150 gauges.forEach(gauge => { 151 var gaugeGeoJson = {} as GaugeGeoJson; 152 gaugeGeoJson.type = "Feature"; 153 gaugeGeoJson.geometry = {} as GeoJsonPoint; 154 gaugeGeoJson.geometry.type = "Point"; 155 gaugeGeoJson.geometry.coordinates = []; 156 gaugeGeoJson.geometry.coordinates.push(gauge.location[0]); 157 gaugeGeoJson.geometry.coordinates.push(gauge.location[1]); 158 gaugeGeoJson.properties = {} as GaugeGeoJsonProperties; 159 gaugeGeoJson.properties.name = gauge.name; 160 gaugeGeoJson.properties.manager = gauge.manager; 161 gaugeGeoJson.properties.comment = gauge.comment; 162 this.gaugesLayer.addData(gaugeGeoJson); 163 }); 164 } 165 166 gaugesMarker(feature, latlng){ 167 var markerOptions = { 168 radius: 8, 169 fillColor: "#ff7800", 170 color: "#000", 171 weight: 1, 172 opacity: 1, 173 fillOpacity: 0.8 174 }; 175 return L.circleMarker(latlng, markerOptions); 176 } 177 178 gaugesMarkerPopup(feature, layer) { 179 if (feature.properties && feature.properties.name) { 180 layer.bindPopup(feature.properties.name); 181 } 182 } 108 183 } -
src/mapservice-webclient/src/app/mygnuboat/index.ts
r28198a1 r13cbe66 1 1 export * from './user.component'; 2 2 export * from './wateradd.component'; 3 export * from './gaugeedit.component'; -
src/mapservice-webclient/src/app/mygnuboat/wateradd.component.html
r28198a1 r13cbe66 1 1 <div class="header"> 2 <h1 >Add a new Water to GNUBoat</h1>2 <h1 i18n="@@wateraddTitle">Add a new Water to GNUBoat</h1> 3 3 <alert></alert> 4 4 </div> … … 9 9 <fieldset> 10 10 <div class="pure-control-group"> 11 <label for="name" >Name:</label>12 <input #waterNameInput id="waterNameAutocomplete" formControlName='name' type="text" placeholder="Name of Water" required>11 <label for="name" i18n="@@waterAddName">Name:</label> 12 <input #waterNameInput id="waterNameAutocomplete" formControlName='name' type="text" i18n-placeholder placeholder="Name of Water" required> 13 13 <img *ngIf="isProcessingGnuBoat || isProcessingOverpass" src="data:image/gif;base64,R0lGODlhEAAQAPIAAP///wAAAMLCwkJCQgAAAGJiYoKCgpKSkiH/C05FVFNDQVBFMi4wAwEAAAAh/hpDcmVhdGVkIHdpdGggYWpheGxvYWQuaW5mbwAh+QQJCgAAACwAAAAAEAAQAAADMwi63P4wyklrE2MIOggZnAdOmGYJRbExwroUmcG2LmDEwnHQLVsYOd2mBzkYDAdKa+dIAAAh+QQJCgAAACwAAAAAEAAQAAADNAi63P5OjCEgG4QMu7DmikRxQlFUYDEZIGBMRVsaqHwctXXf7WEYB4Ag1xjihkMZsiUkKhIAIfkECQoAAAAsAAAAABAAEAAAAzYIujIjK8pByJDMlFYvBoVjHA70GU7xSUJhmKtwHPAKzLO9HMaoKwJZ7Rf8AYPDDzKpZBqfvwQAIfkECQoAAAAsAAAAABAAEAAAAzMIumIlK8oyhpHsnFZfhYumCYUhDAQxRIdhHBGqRoKw0R8DYlJd8z0fMDgsGo/IpHI5TAAAIfkECQoAAAAsAAAAABAAEAAAAzIIunInK0rnZBTwGPNMgQwmdsNgXGJUlIWEuR5oWUIpz8pAEAMe6TwfwyYsGo/IpFKSAAAh+QQJCgAAACwAAAAAEAAQAAADMwi6IMKQORfjdOe82p4wGccc4CEuQradylesojEMBgsUc2G7sDX3lQGBMLAJibufbSlKAAAh+QQJCgAAACwAAAAAEAAQAAADMgi63P7wCRHZnFVdmgHu2nFwlWCI3WGc3TSWhUFGxTAUkGCbtgENBMJAEJsxgMLWzpEAACH5BAkKAAAALAAAAAAQABAAAAMyCLrc/jDKSatlQtScKdceCAjDII7HcQ4EMTCpyrCuUBjCYRgHVtqlAiB1YhiCnlsRkAAAOwAAAAAAAAAAAA==" /> 14 <span *ngIf="submitted && watersForm.name.errors" class="pure-form-message-inline" >Watername is required.</span>14 <span *ngIf="submitted && watersForm.name.errors" class="pure-form-message-inline" i18n="@@waterNameRequired">Watername is required.</span> 15 15 </div> 16 16 <div class="pure-controls"> 17 <button [disabled]="!waterChoosen || !currentUser" *ngIf="!waterChoosen || waterChoosen.origin!=Origin.GNUBOAT" class="pure-button pure-button-primary" >Add</button>18 <button [disabled]="!waterChoosen || !currentUser" *ngIf="waterChoosen && waterChoosen.origin==Origin.GNUBOAT" class="pure-button pure-button-primary" >Choose</button>17 <button [disabled]="!waterChoosen || !currentUser" *ngIf="!waterChoosen || waterChoosen.origin!=Origin.GNUBOAT" class="pure-button pure-button-primary" i18n="@@waterButtonAdd">Add</button> 18 <button [disabled]="!waterChoosen || !currentUser" *ngIf="waterChoosen && waterChoosen.origin==Origin.GNUBOAT" class="pure-button pure-button-primary" i18n="@@waterButtonChoose">Choose</button> 19 19 </div> 20 20 </fieldset> -
src/mapservice-webclient/src/app/mygnuboat/wateradd.component.ts
r28198a1 r13cbe66 201 201 } 202 202 if(this.waterChoosen.origin == Origin.OSM){ 203 console.log("GNUBOAT --> OSM");204 203 var water = {} as WaterCreation; 205 204 water.name = this.waterChoosen.value; … … 207 206 water.osmType = this.waterChoosen.osmType; 208 207 this.watersService.watersCreate(water).pipe(first()).subscribe(result => { 209 console.log([water.name, result.name]);210 208 if(water.name == result.name){ 211 209 this.router.navigate(['/water', result.waterId]); -
src/mapservice-webclient/src/app/water/index.ts
r28198a1 r13cbe66 2 2 export * from './water.component'; 3 3 export * from './waterdetails.component'; 4 export * from './gauges.component'; -
src/mapservice-webclient/src/app/water/water.component.html
r28198a1 r13cbe66 1 1 <div class="water"> 2 2 <div class="water-background"> 3 <gnuboat-map #mapComponent [viewportStyleClass]='mapViewportStyleClass' [controlsShow]='mapControlsShow' ></gnuboat-map>3 <gnuboat-map #mapComponent [viewportStyleClass]='mapViewportStyleClass' [controlsShow]='mapControlsShow' [water]='water'></gnuboat-map> 4 4 </div> 5 5 <div class="water-content"> 6 < h2>{{water.name}}</h2>6 <a [routerLink]="['/water', water.waterId]"><h2>{{water.name}}</h2></a> 7 7 <ul> 8 <li>Managed by {{water.manager}}</li> 8 <li *ngIf="water.gauges; else noGauges">{{water.gauges.length}} Gauges</li> 9 <ng-template #noGauges><li>No Gauges</li></ng-template> 9 10 <li><button class="button-add pure-button">Upload Logfile</button></li> 10 11 <li><a class="pure-button water-edit" [routerLink]="['/water', water.waterId]"><span *ngIf="user">Edit / </span>Details</a></li> -
src/mapservice-webclient/src/app/water/water.component.ts
r28198a1 r13cbe66 1 import { Component, OnInit, OnDestroy, AfterViewInit,Input, ViewChild } from '@angular/core';1 import { Component, OnInit, OnDestroy, Input, ViewChild } from '@angular/core'; 2 2 import { Subscription } from 'rxjs'; 3 3 import { first } from 'rxjs/operators'; … … 12 12 templateUrl: 'water.component.html', 13 13 }) 14 export class WaterComponent implements OnInit, OnDestroy , AfterViewInit{14 export class WaterComponent implements OnInit, OnDestroy { 15 15 @Input() water: Water; 16 16 @Input() user: User; … … 25 25 } 26 26 27 ngAfterViewInit() {28 this.mapComponent.addOsmElement(this.water.osmId, this.water.osmType);29 }30 31 27 ngOnDestroy() { 32 28 } -
src/mapservice-webclient/src/app/water/waterdetails.component.html
r28198a1 r13cbe66 4 4 </div> 5 5 <div class="content"> 6 <p *ngIf="currentUser"> Click on Map to add new Levels</p>7 <gnuboat-map #mapComponent [viewportStyleClass]='mapViewportStyleClass' [controlsShow]='mapControlsShow' (clicked )='mapClicked($event)'></gnuboat-map>8 < h2 class="content-subhead">Levels</h2>9 6 <p *ngIf="currentUser">Right click on Map to add new Gauges</p> 7 <gnuboat-map #mapComponent [viewportStyleClass]='mapViewportStyleClass' [controlsShow]='mapControlsShow' (clickedRight)='mapClicked($event)' [water]='water'></gnuboat-map> 8 <gnuboat-gauge-edit *ngIf="gaugeEditing" [water]="water" [gauge]="gaugeEditing" (cancel)='gaugeEditingCanceled()' (gaugeCreated)='gaugeCreated($event)'></gnuboat-gauge-edit> 9 <gnuboat-gauges [water]="water" [mapComponent]="mapComponent"></gnuboat-gauges> 10 10 </div> 11 11 -
src/mapservice-webclient/src/app/water/waterdetails.component.ts
r28198a1 r13cbe66 1 import { Component, OnInit, OnDestroy, AfterViewInit,Input, ViewChild } from '@angular/core';1 import { Component, OnInit, OnDestroy, Input, ViewChild } from '@angular/core'; 2 2 import { Router, ActivatedRoute, ParamMap } from '@angular/router'; 3 3 import { switchMap, first } from 'rxjs/operators'; 4 4 import { Observable, Subscription } from 'rxjs'; 5 5 6 import { User, Water, WatersService } from '../../../src-gen/gnuboat-mapservice';6 import { User, Water, Gauge, GaugeCreation, WatersService } from '../../../src-gen/gnuboat-mapservice'; 7 7 import { MapComponent } from '../map'; 8 8 import { GeoPoint } from '../model'; … … 12 12 templateUrl: 'waterdetails.component.html', 13 13 }) 14 export class WaterDetailsComponent implements OnInit, OnDestroy , AfterViewInit{14 export class WaterDetailsComponent implements OnInit, OnDestroy { 15 15 @Input() water: Water; 16 16 mapViewportStyleClass:string = "water-edit-map"; … … 18 18 @ViewChild('mapComponent') mapComponent: MapComponent; 19 19 currentUser: User = undefined; 20 gaugeEditing: GaugeCreation = undefined; 20 21 21 22 private currentUserSubscription: Subscription; … … 38 39 } 39 40 }); 40 }41 42 ngAfterViewInit() {43 41 const id = Number(this.route.snapshot.paramMap.get('id')); 44 this.watersService.water GetById(id).subscribe(water => {42 this.watersService.watersGetById(id).subscribe(water => { 45 43 this.water = water; 46 this.mapComponent.addOsmElement(water.osmId, water.osmType);47 44 }, 48 45 error => { … … 55 52 56 53 mapClicked(point: GeoPoint){ 57 console.log(point); 54 if(!this.currentUser){ 55 return; 56 } 57 if(this.gaugeEditing){ 58 this.alertService.error("Please finish or abort your currently edited gauge before creating a new one!"); 59 return; 60 } 61 this.gaugeEditing = {} as GaugeCreation; 62 this.gaugeEditing.location = []; 63 this.gaugeEditing.location.push(point.longitude); 64 this.gaugeEditing.location.push(point.latitude); 65 this.gaugeEditing.comment = ""; 66 } 67 68 gaugeEditingCanceled(){ 69 this.gaugeEditing = undefined; 70 } 71 72 gaugeCreated(gauge: Gauge){ 73 this.water.gauges.push(gauge); 74 this.water = Object.assign({}, this.water); 75 this.gaugeEditing = undefined; 58 76 } 59 77 } -
src/mapservice-webclient/src/app/water/waters.component.ts
r28198a1 r13cbe66 3 3 import { first } from 'rxjs/operators'; 4 4 5 import { WaterDetailsComponent } from './'; 5 6 import { User, UsersService, Water, WatersService } from '../../../src-gen/gnuboat-mapservice'; 6 7 import { AuthenticationService } from '../services'; … … 8 9 @Component({ 9 10 selector: 'gnuboat-waters', 10 templateUrl: 'waters.component.html' 11 templateUrl: 'waters.component.html', 11 12 }) 12 13 export class WatersComponent implements OnInit, OnDestroy { -
src/mapservice-webclient/src/css/GnuBoat.Mapservice.Webclient.css
r28198a1 r13cbe66 123 123 } 124 124 125 .water h2 { 125 .water a, .water a:link, .water a:visited, .water a:hover, .water a:active { 126 text-decoration: None; 127 color: inherit; 128 } 129 130 .water a h2 { 126 131 padding: 0.8em; 127 132 margin: 0; -
src/mapservice-webclient/src/tsconfig.app.json
r28198a1 r13cbe66 11 11 "app/*" 12 12 ] 13 } 13 }, 14 14 "outDir": "../out-tsc/app", 15 15 "types": []
Note:
See TracChangeset
for help on using the changeset viewer.
