FarmMapsLib/projects/common/src/fm/actions/app-common.actions.ts

293 lines
7.0 KiB
TypeScript

import { Action } from '@ngrx/store';
import { IItemTypes } from '../models/item.types';
import { IListItem } from '../models/list.item';
import { IUser } from '../models/user';
import { IItem } from '../models/item';
import { UserInfo } from 'angular-oauth2-oidc';
export const INITUSER = '[AppCommon] InitUser';
export const INITUSERSUCCESS = '[AppCommon] InitUserSuccess';
export const INITUSERPACKAGES = '[AppCommon] InitUserPackages';
export const INITUSERPACKAGESSUCCESS = '[AppCommon] InitUserPackagesSuccess';
export const INITROOT = '[Explorer] InitRoot';
export const INITROOTSUCCESS = '[Explorer] InitRootSuccess';
export const OPENMODAL = '[AppCommon] OpenModal';
export const CLOSEMODAL = '[AppCommon] CloseModal';
export const LOGIN = '[AppCommon] Login';
export const LOGOUT = '[AppCommon] Logout';
export const ESCAPE = '[AppCommon] Escape';
export const CLOSEALL = '[AppCommon] CloseAll';
export const LOADITEMTYPES = '[AppCommon] LoadItemTypes';
export const LOADITEMTYPESSUCCESS = '[AppCommon] LoadItemTypesSuccess';
export const ITEMCHANGEDEVENT = '[AppCommon] ItemChangedEvent';
export const ITEMADDEDEVENT = '[AppCommon] ItemAddedEvent';
export const ITEMDELETEDEVENT = '[AppCommon] ItemDeletedEvent';
export const TASKSTARTEVENT = '[AppCommon] TaskStartEvent';
export const TASKENDEVENT = '[AppCommon] TaskEndEvent';
export const TASKERRORTEVENT = '[AppCommon] TaskErrorEvent';
export const DEVICEUPDATEEVENT = '[AppCommon] DeviceUpdateEvent';
export const DELETEITEMS = '[AppCommon] DeleteItems';
export const DELETEITEMSSUCCESS = '[AppCommon] DeleteItemsSuccess';
export const STARTROUTELOADING = '[AppCommon] StartRouteLoading';
export const ENDROUTELOADING = '[AppCommon] EndRouteLoading';
export const FULLSCREEN = '[AppCommon] FullScreen';
export const SHOWNAVBAR = '[AppCommon] ShowNavBar';
export const EDITITEM = "[AppCommon] EditItem";
export const VIEWITEM = "[AppCommon] ViewItem";
export const FAIL = '[AppCommon] Fail';
export const UPLOADEDFILECLICK = '[AppCommon] UploadedFileClick';
export const TOGGLEMENU = '[AppCommon] ToggleMenu';
export const TOGGLEACCOUNTMENU = '[AppCommon] ToggleAccountMenu';
export const SETMENUVISIBLE = '[AppCommon] SetMenuVisible';
export class InitUser implements Action {
readonly type = INITUSER;
constructor() { }
}
export class InitUserSuccess implements Action {
readonly type = INITUSERSUCCESS;
constructor(public user:IUser,public userinfo:UserInfo ) { }
}
export class InitUserPackagesSuccess implements Action {
readonly type = INITUSERPACKAGESSUCCESS;
constructor(public items:IItem[] ) { }
}
export class InitRoot implements Action {
readonly type = INITROOT;
constructor() { }
}
export class InitRootSuccess implements Action {
readonly type = INITROOTSUCCESS;
constructor(public items:IListItem[]) { }
}
export class OpenModal implements Action {
readonly type = OPENMODAL;
constructor(public modalName: string) { }
}
export class CloseModal implements Action {
readonly type = CLOSEMODAL;
constructor() { }
}
export class CloseAll implements Action {
readonly type = CLOSEALL;
constructor() { }
}
export class StartRouteLoading implements Action {
readonly type = STARTROUTELOADING;
constructor() { }
}
export class EndRouteLoading implements Action {
readonly type = ENDROUTELOADING;
constructor() { }
}
export class Login implements Action {
readonly type = LOGIN;
constructor(public url: string) { }
}
export class Logout implements Action {
readonly type = LOGOUT;
constructor() { }
}
export class Escape implements Action {
readonly type = ESCAPE;
constructor(public escapeKey:boolean, public click:boolean) { }
}
export class LoadItemTypes implements Action {
readonly type = LOADITEMTYPES;
constructor() { }
}
export class LoadItemTypesSuccess implements Action {
readonly type = LOADITEMTYPESSUCCESS;
constructor(public itemTypes: IItemTypes) { }
}
export class Fail implements Action {
readonly type = FAIL;
constructor(public payload: string) { }
}
export class ItemChangedEvent implements Action {
readonly type = ITEMCHANGEDEVENT;
constructor(public itemCode: string, public attributes: any) { }
}
export class ItemAddedEvent implements Action {
readonly type = ITEMADDEDEVENT;
constructor(public itemCode: string, public attributes: any) { }
}
export class ItemDeletedEvent implements Action {
readonly type = ITEMDELETEDEVENT;
constructor(public itemCode: string, public attributes: any) { }
}
export class TaskStartEvent implements Action {
readonly type = TASKSTARTEVENT;
constructor(public itemCode: string, public attributes: any) { }
}
export class TaskEndEvent implements Action {
readonly type = TASKENDEVENT;
constructor(public itemCode: string, public attributes: any) { }
}
export class TaskErrorEvent implements Action {
readonly type = TASKERRORTEVENT;
constructor(public itemCode: string, public attributes: any) { }
}
export class DeviceUpdateEvent implements Action {
readonly type = DEVICEUPDATEEVENT;
constructor(public itemCode: string, public attributes: any) { }
}
export class DeleteItems implements Action {
readonly type = DELETEITEMS;
constructor(public itemCodes: string[]) { }
}
export class DeleteItemsSuccess implements Action {
readonly type = DELETEITEMSSUCCESS;
constructor(public deletedItemCodes: string[]) { }
}
export class EditItem implements Action {
readonly type = EDITITEM;
constructor(public item: IListItem) { }
}
export class ViewItem implements Action {
readonly type = VIEWITEM;
constructor(public item: IListItem) { }
}
export class FullScreen implements Action {
readonly type = FULLSCREEN;
constructor() { }
}
export class ShowNavBar implements Action {
readonly type = SHOWNAVBAR;
constructor() { }
}
export class UploadedFileClick implements Action {
readonly type = UPLOADEDFILECLICK;
constructor(public itemCode:string) { }
}
export class ToggleMenu implements Action {
readonly type = TOGGLEMENU;
constructor() { }
}
export class ToggleAccountMenu implements Action {
readonly type = TOGGLEACCOUNTMENU;
constructor() { }
}
export class SetMenuVisible implements Action {
readonly type = SETMENUVISIBLE;
constructor(public visible:boolean) { }
}
export type Actions = OpenModal
| InitRoot
| InitRootSuccess
| CloseModal
| Login
| Logout
| ItemChangedEvent
| ItemAddedEvent
| ItemDeletedEvent
| Escape
| LoadItemTypes
| LoadItemTypesSuccess
| DeleteItems
| DeleteItemsSuccess
| Fail
| EditItem
| ViewItem
| FullScreen
| ShowNavBar
| StartRouteLoading
| EndRouteLoading
| InitUser
| InitUserSuccess
| TaskStartEvent
| TaskEndEvent
| TaskErrorEvent
| DeviceUpdateEvent
| ToggleMenu
| SetMenuVisible
| InitUserPackagesSuccess
| ToggleAccountMenu
| CloseAll;