AW-1431 Add InitUserSettingsRoot
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:
parent
ad1d40cdd1
commit
4d67a656f5
@ -12,6 +12,9 @@ export const INITUSERSUCCESS = '[AppCommon] InitUserSuccess';
|
|||||||
export const INITUSERPACKAGES = '[AppCommon] InitUserPackages';
|
export const INITUSERPACKAGES = '[AppCommon] InitUserPackages';
|
||||||
export const INITUSERPACKAGESSUCCESS = '[AppCommon] InitUserPackagesSuccess';
|
export const INITUSERPACKAGESSUCCESS = '[AppCommon] InitUserPackagesSuccess';
|
||||||
|
|
||||||
|
export const INITUSERSETTINGSROOT = '[AppCommon] InitUserSettingsRoot';
|
||||||
|
export const INITUSERSETTINGSROOTSUCCESS = '[AppCommon] InitUserSettingsRootSuccess';
|
||||||
|
|
||||||
export const INITROOT = '[Explorer] InitRoot';
|
export const INITROOT = '[Explorer] InitRoot';
|
||||||
export const INITROOTSUCCESS = '[Explorer] InitRootSuccess';
|
export const INITROOTSUCCESS = '[Explorer] InitRootSuccess';
|
||||||
|
|
||||||
@ -87,6 +90,18 @@ export class InitUserPackagesSuccess implements Action {
|
|||||||
constructor(public items:IItem[] ) { }
|
constructor(public items:IItem[] ) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export class InitUserSettingsRoot implements Action {
|
||||||
|
readonly type = INITUSERSETTINGSROOT;
|
||||||
|
|
||||||
|
constructor() {}
|
||||||
|
}
|
||||||
|
|
||||||
|
export class InitUserSettingsRootSuccess implements Action {
|
||||||
|
readonly type = INITUSERSETTINGSROOTSUCCESS;
|
||||||
|
|
||||||
|
constructor(public item: IItem ) { }
|
||||||
|
}
|
||||||
|
|
||||||
export class InitRoot implements Action {
|
export class InitRoot implements Action {
|
||||||
readonly type = INITROOT;
|
readonly type = INITROOT;
|
||||||
|
|
||||||
@ -317,6 +332,8 @@ export type Actions = OpenModal
|
|||||||
| SetMenuVisible
|
| SetMenuVisible
|
||||||
| InitUserPackages
|
| InitUserPackages
|
||||||
| InitUserPackagesSuccess
|
| InitUserPackagesSuccess
|
||||||
|
| InitUserSettingsRoot
|
||||||
|
| InitUserSettingsRootSuccess
|
||||||
| ToggleAccountMenu
|
| ToggleAccountMenu
|
||||||
| CloseAll
|
| CloseAll
|
||||||
| Online
|
| Online
|
||||||
|
@ -82,11 +82,35 @@ export class AppCommonEffects {
|
|||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@Effect()
|
||||||
|
initUserSettingsRoot$:Observable<Action> = this.actions$.pipe(
|
||||||
|
ofType(appCommonActions.INITUSERSETTINGSROOT),
|
||||||
|
withLatestFrom(this.store$.select(appCommonReducers.SelectGetUser)),
|
||||||
|
switchMap(([, user]) => {
|
||||||
|
return this.itemService$.getItem(user.code + ':USER_SETTINGS').pipe(
|
||||||
|
switchMap((item) => of(new appCommonActions.InitUserSettingsRootSuccess(item))),
|
||||||
|
catchError(error => of(new appCommonActions.Fail(error)))
|
||||||
|
)
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
@Effect()
|
||||||
|
initUserSettingsRootChanged$:Observable<Action> = this.actions$.pipe(
|
||||||
|
ofType(appCommonActions.ITEMCHANGEDEVENT),
|
||||||
|
switchMap((action) => {
|
||||||
|
let a = action as appCommonActions.ItemChangedEvent;
|
||||||
|
if(a.itemCode.endsWith(":USER_SETTINGS"))
|
||||||
|
return of(new appCommonActions.InitUserSettingsRoot());
|
||||||
|
else
|
||||||
|
return [];
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
@Effect()
|
@Effect()
|
||||||
initUserSuccess$: Observable<Action> = this.actions$.pipe(
|
initUserSuccess$: Observable<Action> = this.actions$.pipe(
|
||||||
ofType(appCommonActions.INITUSERSUCCESS),
|
ofType(appCommonActions.INITUSERSUCCESS),
|
||||||
switchMap(() => {
|
switchMap(() => {
|
||||||
return [new appCommonActions.InitRoot(),new appCommonActions.InitUserPackages()];
|
return [new appCommonActions.InitRoot(),new appCommonActions.InitUserPackages(),new appCommonActions.InitUserSettingsRoot()];
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@ import * as appCommonActions from '../actions/app-common.actions';
|
|||||||
import { createSelector, createFeatureSelector, ActionReducerMap } from '@ngrx/store';
|
import { createSelector, createFeatureSelector, ActionReducerMap } from '@ngrx/store';
|
||||||
|
|
||||||
import { MODULE_NAME } from '../module-name';
|
import { MODULE_NAME } from '../module-name';
|
||||||
|
import { IItem } from '../models/item';
|
||||||
|
|
||||||
export interface State {
|
export interface State {
|
||||||
openedModalName: string,
|
openedModalName: string,
|
||||||
@ -18,6 +19,7 @@ export interface State {
|
|||||||
routeLoading:boolean,
|
routeLoading:boolean,
|
||||||
menuVisible: boolean,
|
menuVisible: boolean,
|
||||||
userPackages: IPackages,
|
userPackages: IPackages,
|
||||||
|
userSettingsRoot: IItem,
|
||||||
accountMenuVisible: boolean,
|
accountMenuVisible: boolean,
|
||||||
isOnline: boolean
|
isOnline: boolean
|
||||||
}
|
}
|
||||||
@ -32,6 +34,7 @@ export const initialState: State = {
|
|||||||
routeLoading: false,
|
routeLoading: false,
|
||||||
menuVisible: false,
|
menuVisible: false,
|
||||||
userPackages: {},
|
userPackages: {},
|
||||||
|
userSettingsRoot: null,
|
||||||
accountMenuVisible: false,
|
accountMenuVisible: false,
|
||||||
isOnline: true
|
isOnline: true
|
||||||
}
|
}
|
||||||
@ -111,6 +114,10 @@ export function reducer(state = initialState, action: appCommonActions.Actions )
|
|||||||
|
|
||||||
return tassign(state,{userPackages:packages});
|
return tassign(state,{userPackages:packages});
|
||||||
}
|
}
|
||||||
|
case appCommonActions.INITUSERSETTINGSROOTSUCCESS:{
|
||||||
|
let a = action as appCommonActions.InitUserSettingsRootSuccess;
|
||||||
|
return tassign(state, { userSettingsRoot : a.item });
|
||||||
|
}
|
||||||
case appCommonActions.LOGOUT:{
|
case appCommonActions.LOGOUT:{
|
||||||
return tassign(state,{user:null,initialized:false});
|
return tassign(state,{user:null,initialized:false});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user