Merge branch 'develop'
Some checks failed
FarmMaps.Develop/FarmMapsLib/pipeline/head There was a failure building this commit
Some checks failed
FarmMaps.Develop/FarmMapsLib/pipeline/head There was a failure building this commit
# Conflicts: # package.json # projects/common-map/src/fm-map/common-map.module.ts # projects/common/src/fm/reducers/app-common.reducer.ts
This commit is contained in:
@@ -110,7 +110,9 @@ export {
|
||||
IGradientstop,
|
||||
BackButtonComponent,
|
||||
AvatarComponent,
|
||||
EditImageModalComponent
|
||||
EditImageModalComponent,
|
||||
GradientComponent,
|
||||
GradientSelectComponent
|
||||
};
|
||||
|
||||
@NgModule({
|
||||
|
@@ -40,6 +40,7 @@ export class AvatarComponent implements OnInit {
|
||||
|
||||
refresh(user: IUser) {
|
||||
if (!user) return null;
|
||||
debugger;
|
||||
const apiEndpoint = this.appConfig.getConfig("apiEndPoint");
|
||||
this.src = `${apiEndpoint}/api/v1/users/${user.code}/avatar`;
|
||||
this.name = user.firstName && user.lastName ?
|
||||
|
@@ -8,7 +8,7 @@ import { createSelector, createFeatureSelector, ActionReducerMap } from '@ngrx/s
|
||||
|
||||
import { MODULE_NAME } from '../module-name';
|
||||
import { IItem } from '../models/item';
|
||||
import {getValidPackages, isValidPackage} from '../services/package.service';
|
||||
import { userInfo } from 'os';
|
||||
|
||||
export interface State {
|
||||
openedModalName: string,
|
||||
@@ -58,16 +58,16 @@ 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:a.user?.name?a.user.name : claims["email"],
|
||||
name:a.user?.email?a.user.email : claims["name"],
|
||||
claims:claims,
|
||||
searchable: false
|
||||
};
|
||||
};
|
||||
return tassign(state, { user: user });
|
||||
}
|
||||
case appCommonActions.INITROOTSUCCESS: {
|
||||
@@ -76,10 +76,10 @@ export function reducer(state = initialState, action: appCommonActions.Actions )
|
||||
}
|
||||
case appCommonActions.OPENMODAL: {
|
||||
return tassign(state, { openedModalName: action.modalName });
|
||||
}
|
||||
}
|
||||
case appCommonActions.CLOSEMODAL: {
|
||||
return tassign(state, { openedModalName: null });
|
||||
}
|
||||
}
|
||||
case appCommonActions.LOADITEMTYPESSUCCESS: {
|
||||
let a = action as appCommonActions.LoadItemTypesSuccess;
|
||||
return tassign(state, { itemTypes: a.itemTypes });
|
||||
@@ -132,10 +132,7 @@ export function reducer(state = initialState, action: appCommonActions.Actions )
|
||||
a.items.forEach((item) => {
|
||||
item.data.dataDate = item.dataDate;
|
||||
item.data.dataEndDate = item.dataEndDate;
|
||||
if (!packages[item.data.id]) {
|
||||
packages[item.data.id] = [];
|
||||
}
|
||||
packages[item.data.id].push(item.data);
|
||||
packages[item.data.id]=item.data;
|
||||
});
|
||||
|
||||
return tassign(state,{userPackages:packages});
|
||||
@@ -207,9 +204,6 @@ export const selectGetRouteLoading = createSelector(selectAppCommonState, getRou
|
||||
export const SelectGetMenuVisible = createSelector(selectAppCommonState,getMenuVisible);
|
||||
export const SelectGetUser = createSelector(selectAppCommonState,getUser);
|
||||
export const SelectGetUserPackages = createSelector(selectAppCommonState,getUserPackages);
|
||||
export const SelectGetValidUserPackages = createSelector(SelectGetUserPackages, (packageMap) => {
|
||||
return getValidPackages(packageMap);
|
||||
});
|
||||
export const SelectGetUserSettingsRoot = createSelector(selectAppCommonState,getUserSettingsRoot);
|
||||
export const SelectGetAccountMenuVisible = createSelector(selectAppCommonState,getAccountMenuVisible);
|
||||
export const SelectGetAppMenuVisible = createSelector(selectAppCommonState,getAppMenuVisible);
|
||||
@@ -220,4 +214,3 @@ export const SelectgetUnreadNotifications = createSelector(selectAppCommonState,
|
||||
export const SelectGetIsOnline = createSelector(selectAppCommonState,getIsOnline);
|
||||
export const SelectGetIsPageMode = createSelector(selectAppCommonState,getIsPageMode);
|
||||
|
||||
|
||||
|
@@ -49,6 +49,22 @@ export class WeatherService {
|
||||
return this.getWeatherRange(centroid, startDateString, endDateString);
|
||||
}
|
||||
|
||||
public getDailyHistoricalObservations(centroid: number[], startDate: string, endDate: string): Observable<HourlyWeatherData[]> {
|
||||
const endpoint = this.appConfig.getConfig('weatherApiEndPoint');
|
||||
const apiKey = this.appConfig.getConfig('weatherApiKey');
|
||||
|
||||
// weather does not support UTC format, also remove Z
|
||||
const sd = encodeURIComponent(startDate);
|
||||
|
||||
const edHistoricalDate = new Date();
|
||||
edHistoricalDate.setHours(edHistoricalDate.getHours(), 0, 0, 0);
|
||||
const edHistorical = moment(edHistoricalDate).local().format('YYYY-MM-DD[T]HH:mm:ss');
|
||||
|
||||
const historical = `${endpoint}${this.apiObservation}/?c=${centroid[0]},${centroid[1]}&sd=${sd}&ed=${edHistorical}&t=cleanedobservation&interval=daily&key=${apiKey}`;
|
||||
|
||||
return this.httpClient.get<any[]>(historical);
|
||||
}
|
||||
|
||||
public getWeatherRange(centroid: number[], startDate: string, endDate: string): Observable<HourlyWeatherData[]> {
|
||||
const endpoint = this.appConfig.getConfig('weatherApiEndPoint');
|
||||
const apiKey = this.appConfig.getConfig('weatherApiKey');
|
||||
|
@@ -1,8 +1,8 @@
|
||||
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
|
||||
|
||||
import 'core-js/es7/reflect';
|
||||
import 'zone.js/dist/zone';
|
||||
import 'zone.js/dist/zone-testing';
|
||||
import 'zone.js';
|
||||
import 'zone.js/testing';
|
||||
import { getTestBed } from '@angular/core/testing';
|
||||
import {
|
||||
BrowserDynamicTestingModule,
|
||||
|
Reference in New Issue
Block a user