Merge branch 'develop' of https://git.akkerweb.nl/FarmMaps/FarmMapsLib into develop
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// angular modules
|
||||
import { NgModule, APP_INITIALIZER, ModuleWithProviders, Injector, Optional, SkipSelf } from '@angular/core';
|
||||
import { NgModule, APP_INITIALIZER, ModuleWithProviders, Injector, Optional, SkipSelf,InjectionToken } from '@angular/core';
|
||||
import { CommonModule, DatePipe } from '@angular/common';
|
||||
import { HttpClientModule, HttpClient, HTTP_INTERCEPTORS } from '@angular/common/http';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
@@ -66,6 +66,7 @@ import { AvatarComponent } from './components/avatar/avatar.component';
|
||||
import { AvatarModule } from 'ngx-avatar';
|
||||
import { ImageCropperModule } from 'ngx-image-cropper';
|
||||
|
||||
export const FM_COMMON_STARTPAGE = new InjectionToken<string>('fm-common-startpage');
|
||||
|
||||
export {
|
||||
SafePipe,
|
||||
|
@@ -4,7 +4,7 @@
|
||||
<button type="button" class="btn btn-outline-secondary apponly" (click)="handleToggleMenu($event)"><i class="fal fa-bars" aria-hidden="true"></i></button>
|
||||
<router-outlet name="menu" class="ml-4"></router-outlet>
|
||||
<div class="collapse navbar-collapse pageonly">
|
||||
<a class="btn btn-primary ml-auto" role="button" [routerLink]="['/map']">
|
||||
<a class="btn btn-primary ml-auto" role="button" [routerLink]="[ startPage == null?'/map':startPage]">
|
||||
<span *ngIf="(user|async)==null" i18n>Sign in</span>
|
||||
<span *ngIf="(user|async)!=null" i18n>To app</span>
|
||||
</a>
|
||||
|
@@ -1,4 +1,4 @@
|
||||
import { Component, OnInit, OnDestroy, Inject, ViewEncapsulation, RendererFactory2, PLATFORM_ID, ChangeDetectionStrategy, HostListener, Input } from '@angular/core';
|
||||
import { Component, OnInit, OnDestroy, Inject, Optional,ViewEncapsulation, RendererFactory2, PLATFORM_ID, ChangeDetectionStrategy, HostListener, Input } from '@angular/core';
|
||||
import { Router, NavigationStart, NavigationEnd, RouteConfigLoadStart, RouteConfigLoadEnd, ActivatedRoute, PRIMARY_OUTLET } from '@angular/router';
|
||||
import { Meta, Title, MetaDefinition } from '@angular/platform-browser'; import { DOCUMENT } from "@angular/common";
|
||||
import { Subscription, Observable } from 'rxjs';
|
||||
@@ -6,6 +6,7 @@ import { distinctUntilChanged } from 'rxjs/operators';
|
||||
import { Store, Action } from '@ngrx/store';
|
||||
import { IUser } from '../../models/user';
|
||||
import { OAuthService, OAuthErrorEvent } from 'angular-oauth2-oidc';
|
||||
import { FM_COMMON_STARTPAGE} from '../../common.module';
|
||||
|
||||
//AppCommon
|
||||
import { IEventMessage } from '../../models/event.message';
|
||||
@@ -51,6 +52,7 @@ export class AppComponent implements OnInit, OnDestroy {
|
||||
@Input() showUploadProgress: boolean = true;
|
||||
|
||||
constructor(
|
||||
@Optional() @Inject(FM_COMMON_STARTPAGE) public startPage: string,
|
||||
public router: Router,
|
||||
private activatedRoute$: ActivatedRoute,
|
||||
private title$: Title,
|
||||
|
@@ -58,13 +58,13 @@ export function reducer(state = initialState, action: appCommonActions.Actions )
|
||||
case appCommonActions.INITUSERSUCCESS: {
|
||||
let a = action as appCommonActions.InitUserSuccess;
|
||||
let claims = {}
|
||||
Object.getOwnPropertyNames(a.userinfo).forEach((k) => {
|
||||
Object.getOwnPropertyNames(a.userinfo.info).forEach((k) => {
|
||||
claims[k] = a.userinfo[k];
|
||||
});
|
||||
var user:IUser = {
|
||||
code:a.user.code,
|
||||
email:a.userinfo["email"],
|
||||
name:a.userinfo["name"],
|
||||
email:claims["email"]!== undefined ? claims["email"] : a.user.name,
|
||||
name:claims["name"]!== undefined?claims["name"] : a.user.email,
|
||||
claims:claims,
|
||||
searchable: false
|
||||
};
|
||||
|
@@ -24,7 +24,7 @@ export class ItemService {
|
||||
return this.httpClient.get<{ [id: string]: IItemType }>(`${this.ApiEndpoint()}/api/v1/itemtypes/`);
|
||||
}
|
||||
|
||||
getFeatures(extent: number[], crs: string, searchText?: string, searchTags?:string,startDate?:Date,endDate?:Date,itemType?:string,parentCode?:string,dataFilter?:string,level?:number): Observable<any> {
|
||||
getFeatures(extent: number[], crs: string, searchText?: string, searchTags?:string,startDate?:Date,endDate?:Date,itemType?:string,parentCode?:string,dataFilter?:string,level?:number,indexed?:boolean): Observable<any> {
|
||||
var params = new HttpParams();
|
||||
params = params.append("crs", crs);
|
||||
if (extent) params =params.append("bbox", extent.join(","));
|
||||
@@ -42,6 +42,7 @@ export class ItemService {
|
||||
if (parentCode) params = params.append("pc", parentCode);
|
||||
if (dataFilter) params = params.append("df", dataFilter);
|
||||
if (level) params = params.append("lvl", level.toString());
|
||||
params = params.append("ind", indexed ?? true);
|
||||
return this.httpClient.get<any>(`${this.ApiEndpoint()}/api/v1/items/features/`, {params:params});
|
||||
}
|
||||
|
||||
@@ -73,10 +74,10 @@ export class ItemService {
|
||||
|
||||
getItemList(itemType?: string, dataFilter?: any, level?: number, atItemLocationItemCode?: string, indexed?: boolean, validToday?: boolean): Observable<IItem[]> {
|
||||
var params = new HttpParams();
|
||||
if(itemType) params = params.append("it", itemType);
|
||||
if(dataFilter) params = params.append("df", JSON.stringify(dataFilter));
|
||||
if(atItemLocationItemCode) params = params.append("ail",atItemLocationItemCode);
|
||||
if(indexed) params = params.append("ind",indexed?"true":"false");
|
||||
if(itemType) params = params.append("it", itemType);
|
||||
if(dataFilter) params = params.append("df", JSON.stringify(dataFilter));
|
||||
if(atItemLocationItemCode) params = params.append("ail",atItemLocationItemCode);
|
||||
if(indexed) params = params.append("ind",indexed?"true":"false");
|
||||
if (level) params = params.append("lvl", level.toFixed());
|
||||
if (validToday) params = params.append("vt", validToday ? "true" : "false");
|
||||
return this.httpClient.get<IItem[]>(`${this.ApiEndpoint()}/api/v1/items/`, { params: params });
|
||||
@@ -127,11 +128,11 @@ export class ItemService {
|
||||
else
|
||||
return this.httpClient.get<any>(`${this.ApiEndpoint()}/api/v1/items/${code}/features`, { params: params });
|
||||
}
|
||||
|
||||
|
||||
postItem(item:IItem): Observable<IItem> {
|
||||
return this.httpClient.post<IItem>(`${this.ApiEndpoint()}/api/v1/items`,item);
|
||||
}
|
||||
|
||||
|
||||
putItem(item:IItem): Observable<IItem> {
|
||||
return this.httpClient.put<IItem>(`${this.ApiEndpoint()}/api/v1/items/${item.code}`,item);
|
||||
}
|
||||
@@ -158,7 +159,7 @@ export class ItemService {
|
||||
postItemTask(item: IItem, task: IItemTask): Observable<IItemTask> {
|
||||
return this.httpClient.post<IItemTask>(`${this.ApiEndpoint()}/api/v1/items/${item.code}/tasks`, task);
|
||||
}
|
||||
|
||||
|
||||
getItemTaskList(itemcode: string, unfinishedOnly?: boolean): Observable<IItemTask[]> {
|
||||
var params = new HttpParams();
|
||||
if (unfinishedOnly) params = params.append("unfinishedOnly", unfinishedOnly.toString());
|
||||
@@ -167,8 +168,8 @@ export class ItemService {
|
||||
|
||||
getItemListUsingRelationship(itemType: string, relationshipItemType: string, relationshipDataFilter: any): Observable<IItem[]> {
|
||||
var params = new HttpParams();
|
||||
params = params.append("it", itemType);
|
||||
params = params.append("rsit", relationshipItemType);
|
||||
params = params.append("it", itemType);
|
||||
params = params.append("rsit", relationshipItemType);
|
||||
params = params.append("rsdf", JSON.stringify(relationshipDataFilter));
|
||||
return this.httpClient.get<IItem[]>(`${this.ApiEndpoint()}/api/v1/items/userelationship`, { params: params });
|
||||
}
|
||||
@@ -177,4 +178,4 @@ export class ItemService {
|
||||
return this.httpClient.get<any>(`${this.ApiEndpoint()}/api/v1/items/${itemCode}/value/layer/${layerIndex}?c=${x},${y}&crs=${crs}`);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -51,7 +51,9 @@ export function getValidPackages(packageMap: IPackages): {[key: string]: IPackag
|
||||
}
|
||||
|
||||
export function isValidPackage(pack: IPackage): boolean {
|
||||
const today = new Date(new Date(Date.now()).toUTCString()).setHours(0, 0, 0, 0);
|
||||
return pack !== null && new Date(pack.dataDate).getTime() <= today
|
||||
&& (!pack.dataEndDate || new Date(pack.dataEndDate).getTime() >= today);
|
||||
const now = new Date(Date.now());
|
||||
const utcToday = Date.UTC(now.getUTCFullYear(),now.getUTCMonth(),now.getUTCDate());
|
||||
return pack !== null && new Date(pack.dataDate).getTime() <= utcToday
|
||||
&& (!pack.dataEndDate || new Date(pack.dataEndDate).getTime() >= utcToday);
|
||||
|
||||
}
|
||||
|
@@ -22,4 +22,8 @@ export class TypeaheadService {
|
||||
getTagTypeaheadItems(searchText: string, skip: number = 0, take: number = 10): Observable<ITypeaheadItem[]> {
|
||||
return this.httpClient.get<ITypeaheadItem[]>(`${this.ApiEndpoint()}/api/v1/typeahead/tag/?q=${searchText}&skip=${skip}&take=${take}`);
|
||||
}
|
||||
|
||||
getCityTypeaheadItems(searchText: string, skip: number = 0, take: number = 10): Observable<ITypeaheadItem[]> {
|
||||
return this.httpClient.get<ITypeaheadItem[]>(`${this.ApiEndpoint()}/api/v1/typeahead/city/?q=${searchText}&skip=${skip}&take=${take}`);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user