diff --git a/projects/common/src/fm/actions/app-common.actions.ts b/projects/common/src/fm/actions/app-common.actions.ts index e145661..d3579f9 100644 --- a/projects/common/src/fm/actions/app-common.actions.ts +++ b/projects/common/src/fm/actions/app-common.actions.ts @@ -1,234 +1,243 @@ -import { Action } from '@ngrx/store'; - -import { IItemTypes } from '../models/item.types'; -import { IListItem } from '../models/list.item'; -import { IUser } from '../models/user'; - -export const INITUSER = '[AppCommon] InitUser'; -export const INITUSERSUCCESS = '[AppCommon] InitUserSuccess'; - -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 INITIALIZED = '[AppCommon] Initialized'; -export const ESCAPE = '[AppCommon] Escape'; - -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 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 class InitUser implements Action { - readonly type = INITUSER; - - constructor() { } -} - -export class InitUserSuccess implements Action { - readonly type = INITUSERSUCCESS; - - constructor(public user:IUser ) { } -} - -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 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 Initialized implements Action { - readonly type = INITIALIZED; - - 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 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 type Actions = OpenModal - | InitRoot - | InitRootSuccess - | CloseModal - | Login - | Initialized - | ItemChangedEvent - | ItemAddedEvent - | ItemDeletedEvent - | Escape - | LoadItemTypes - | LoadItemTypesSuccess - | DeleteItems - | DeleteItemsSuccess - | Fail - | EditItem - | ViewItem - | FullScreen - | ShowNavBar - | StartRouteLoading - | EndRouteLoading - | InitUser - | InitUserSuccess - | TaskStartEvent - | TaskEndEvent - | TaskErrorEvent; +import { Action } from '@ngrx/store'; + +import { IItemTypes } from '../models/item.types'; +import { IListItem } from '../models/list.item'; +import { IUser } from '../models/user'; + +export const INITUSER = '[AppCommon] InitUser'; +export const INITUSERSUCCESS = '[AppCommon] InitUserSuccess'; + +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 INITIALIZED = '[AppCommon] Initialized'; +export const ESCAPE = '[AppCommon] Escape'; + +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 class InitUser implements Action { + readonly type = INITUSER; + + constructor() { } +} + +export class InitUserSuccess implements Action { + readonly type = INITUSERSUCCESS; + + constructor(public user:IUser ) { } +} + +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 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 Initialized implements Action { + readonly type = INITIALIZED; + + 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 type Actions = OpenModal + | InitRoot + | InitRootSuccess + | CloseModal + | Login + | Initialized + | ItemChangedEvent + | ItemAddedEvent + | ItemDeletedEvent + | Escape + | LoadItemTypes + | LoadItemTypesSuccess + | DeleteItems + | DeleteItemsSuccess + | Fail + | EditItem + | ViewItem + | FullScreen + | ShowNavBar + | StartRouteLoading + | EndRouteLoading + | InitUser + | InitUserSuccess + | TaskStartEvent + | TaskEndEvent + | TaskErrorEvent + | DeviceUpdateEvent; diff --git a/projects/common/src/fm/components/app/app.component.ts b/projects/common/src/fm/components/app/app.component.ts index cd5a49f..b862849 100644 --- a/projects/common/src/fm/components/app/app.component.ts +++ b/projects/common/src/fm/components/app/app.component.ts @@ -77,6 +77,10 @@ export class AppComponent implements OnInit, OnDestroy { action = new commonActions.TaskErrorEvent(event.itemCode, event.attributes); break; } + case "deviceUpdate": { + action = new commonActions.DeviceUpdateEvent(event.itemCode, event.attributes); + break; + } } return action; }