-
+
Sign in
To app
diff --git a/projects/common/src/fm/components/app/app.component.ts b/projects/common/src/fm/components/app/app.component.ts
index cb19ca0..4b2f9b9 100644
--- a/projects/common/src/fm/components/app/app.component.ts
+++ b/projects/common/src/fm/components/app/app.component.ts
@@ -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,
diff --git a/projects/common/src/fm/reducers/app-common.reducer.ts b/projects/common/src/fm/reducers/app-common.reducer.ts
index 33f8dde..600b900 100644
--- a/projects/common/src/fm/reducers/app-common.reducer.ts
+++ b/projects/common/src/fm/reducers/app-common.reducer.ts
@@ -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
};
diff --git a/projects/common/src/fm/services/item.service.ts b/projects/common/src/fm/services/item.service.ts
index 38d852c..9f360fe 100644
--- a/projects/common/src/fm/services/item.service.ts
+++ b/projects/common/src/fm/services/item.service.ts
@@ -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
{
+ getFeatures(extent: number[], crs: string, searchText?: string, searchTags?:string,startDate?:Date,endDate?:Date,itemType?:string,parentCode?:string,dataFilter?:string,level?:number,indexed?:boolean): Observable {
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(`${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 {
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(`${this.ApiEndpoint()}/api/v1/items/`, { params: params });
@@ -127,11 +128,11 @@ export class ItemService {
else
return this.httpClient.get(`${this.ApiEndpoint()}/api/v1/items/${code}/features`, { params: params });
}
-
+
postItem(item:IItem): Observable {
return this.httpClient.post(`${this.ApiEndpoint()}/api/v1/items`,item);
}
-
+
putItem(item:IItem): Observable {
return this.httpClient.put(`${this.ApiEndpoint()}/api/v1/items/${item.code}`,item);
}
@@ -158,7 +159,7 @@ export class ItemService {
postItemTask(item: IItem, task: IItemTask): Observable {
return this.httpClient.post(`${this.ApiEndpoint()}/api/v1/items/${item.code}/tasks`, task);
}
-
+
getItemTaskList(itemcode: string, unfinishedOnly?: boolean): Observable {
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 {
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(`${this.ApiEndpoint()}/api/v1/items/userelationship`, { params: params });
}
@@ -177,4 +178,4 @@ export class ItemService {
return this.httpClient.get(`${this.ApiEndpoint()}/api/v1/items/${itemCode}/value/layer/${layerIndex}?c=${x},${y}&crs=${crs}`);
}
-}
\ No newline at end of file
+}
diff --git a/projects/common/src/fm/services/package.service.ts b/projects/common/src/fm/services/package.service.ts
index 588e49e..ef8552e 100644
--- a/projects/common/src/fm/services/package.service.ts
+++ b/projects/common/src/fm/services/package.service.ts
@@ -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);
+
}
diff --git a/projects/common/src/fm/services/typeahead.service.ts b/projects/common/src/fm/services/typeahead.service.ts
index a4e7495..3829aec 100644
--- a/projects/common/src/fm/services/typeahead.service.ts
+++ b/projects/common/src/fm/services/typeahead.service.ts
@@ -22,4 +22,8 @@ export class TypeaheadService {
getTagTypeaheadItems(searchText: string, skip: number = 0, take: number = 10): Observable {
return this.httpClient.get(`${this.ApiEndpoint()}/api/v1/typeahead/tag/?q=${searchText}&skip=${skip}&take=${take}`);
}
+
+ getCityTypeaheadItems(searchText: string, skip: number = 0, take: number = 10): Observable {
+ return this.httpClient.get(`${this.ApiEndpoint()}/api/v1/typeahead/city/?q=${searchText}&skip=${skip}&take=${take}`);
+ }
}
diff --git a/src/app/app.module.ts b/src/app/app.module.ts
index 55d62bb..3228a63 100644
--- a/src/app/app.module.ts
+++ b/src/app/app.module.ts
@@ -6,8 +6,7 @@ import {
} from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
-import { AppCommonModule,AppCommonServiceModule,AuthConfigFactory } from '@farmmaps/common';
-import { AppCommonMapModule} from '@farmmaps/common-map';
+import { AppCommonModule,AppCommonServiceModule,AuthConfigFactory,FM_COMMON_STARTPAGE } from '@farmmaps/common';
import {AppRootComponent} from './app.component';
@@ -90,7 +89,11 @@ export const metaReducers: MetaReducer[] = [debug];
{
provide:AuthConfigFactory,
useClass:Id4AuthconfigFactory
- }
+ },
+ {
+ provide: FM_COMMON_STARTPAGE,
+ useValue: '/map'
+ }
],
bootstrap: [AppRootComponent]
})