Merge branch 'develop' of https://git.akkerweb.nl/FarmMaps/FarmMapsLib into develop

This commit is contained in:
Willem Dantuma 2020-02-04 14:20:48 +01:00
commit 9433ef87b2
6 changed files with 47 additions and 2 deletions

View File

@ -15,6 +15,7 @@ import { ItemService } from './services/item.service';
import { EventService } from './services/event.service'; import { EventService } from './services/event.service';
import { TypeaheadService } from './services/typeahead.service'; import { TypeaheadService } from './services/typeahead.service';
import { UserService } from './services/user.service'; import { UserService } from './services/user.service';
import { WeatherService} from './services/weather.service';
import { AppConfig } from './shared/app.config'; import { AppConfig } from './shared/app.config';
import { AccessTokenInterceptor } from "./shared/accesstoken.interceptor"; import { AccessTokenInterceptor } from "./shared/accesstoken.interceptor";
import { appConfigFactory } from "./shared/app.config.factory"; import { appConfigFactory } from "./shared/app.config.factory";
@ -35,6 +36,7 @@ export {
EventService, EventService,
TypeaheadService, TypeaheadService,
UserService, UserService,
WeatherService,
CodeListItemService, CodeListItemService,
AppConfig, AppConfig,
AccessTokenInterceptor, AccessTokenInterceptor,

View File

@ -32,6 +32,7 @@ import { TagInputComponent } from './components/tag-input/tag-input.component';
import { MenuBackgroundComponent } from './components/menu-background/menu-background.component'; import { MenuBackgroundComponent } from './components/menu-background/menu-background.component';
import { IEventMessage } from './models/event.message'; import { IEventMessage } from './models/event.message';
import { IItem, Item } from './models/item'; import { IItem, Item } from './models/item';
import { WeatherCurrentObservation } from './models/weatherCurrentObservation';
import { IItemType } from './models/item.type'; import { IItemType } from './models/item.type';
import { IItemTypes } from './models/item.types'; import { IItemTypes } from './models/item.types';
import { IItemTask, ItemTask } from './models/itemTask'; import { IItemTask, ItemTask } from './models/itemTask';
@ -71,7 +72,8 @@ export {
IAuthconfigFactory, IAuthconfigFactory,
AuthConfigFactory, AuthConfigFactory,
MenuBackgroundComponent, MenuBackgroundComponent,
SecureOAuthStorage SecureOAuthStorage,
WeatherCurrentObservation
}; };
@NgModule({ @NgModule({

View File

@ -0,0 +1,13 @@
export interface WeatherCurrentObservation {
wspd: number;
obs_time_local: number;
decimal_temp: number;
rh: number;
precip_1hour: number;
precip_6hour: number;
precip_24hour: number;
uv_index: number;
icon_code: number;
wdir_cardinal: string;
wdir: number;
}

View File

@ -40,7 +40,6 @@ export class AuthGuard implements CanActivate, CanLoad, CanActivateChild {
checkLogin(url: string): boolean { checkLogin(url: string): boolean {
if (!this.oauthService.hasValidAccessToken()) { if (!this.oauthService.hasValidAccessToken()) {
debugger;
this.oauthService.responseType this.oauthService.responseType
if(this.oauthService.responseType == "code") if(this.oauthService.responseType == "code")
if(this.oauthService.getRefreshToken() != null ) { if(this.oauthService.getRefreshToken() != null ) {

View File

@ -78,6 +78,12 @@ export class ItemService {
return this.httpClient.get<IItem[]>(`${this.ApiEndpoint()}/api/v1/items/${parentcode}/children`, { params: params }).pipe(map(ia => ia.map(i => this.parseDates(i)))); return this.httpClient.get<IItem[]>(`${this.ApiEndpoint()}/api/v1/items/${parentcode}/children`, { params: params }).pipe(map(ia => ia.map(i => this.parseDates(i))));
} }
getChildItemListCount(parentcode: string, itemType: string): Observable<Number> {
var params = new HttpParams();
params = params.append("it", itemType);
return this.httpClient.get<Number>(`${this.ApiEndpoint()}/api/v1/items/${parentcode}/children/count`, { params: params });
}
getChildItemListByExtent(parentcode: string, itemType: string, extent: number[], crs: string, dataFilter?: any, level: number = 1): Observable<IItem[]> { getChildItemListByExtent(parentcode: string, itemType: string, extent: number[], crs: string, dataFilter?: any, level: number = 1): Observable<IItem[]> {
var params = new HttpParams(); var params = new HttpParams();
params = params.append("it", itemType); params = params.append("it", itemType);

View File

@ -0,0 +1,23 @@
import {Injectable} from '@angular/core';
import {HttpClient} from '@angular/common/http';
import {AppConfig} from '../shared/app.config';
import {Observable} from 'rxjs';
import {WeatherCurrentObservation} from '../models/weatherCurrentObservation';
@Injectable({
providedIn: 'root',
})
export class WeatherService {
private apiUrl = '/api/v1/weather/currentobservation';
private apiKey = '5f17ef36283b49e9b099a1f4064fbf3d';
constructor(public httpClient: HttpClient, public appConfig: AppConfig) {
}
public GetCurrentObservation(centroid: number[]): Observable<WeatherCurrentObservation> {
const endpoint = this.appConfig.getConfig('apiEndPoint');
const observationUrl = `${endpoint}${this.apiUrl}/?c=${centroid[0]},${centroid[1]}&key=${this.apiKey}`;
return this.httpClient.get<WeatherCurrentObservation>(observationUrl);
}
}