Add Semicolon at the end
[vid.git] / vid-webpack-master / src / app / shared / storeUtil / utils / service / service.actions.ts
1 import {ServiceInstance} from "../../../models/serviceInstance";
2 import {ServiceInstanceActions} from "../../../models/serviceInstanceActions";
3 import {Action, ActionCreator} from "redux";
4
5 export enum ServiceActions {
6   CREATE_SERVICE_INSTANCE = 'CREATE_SERVICE_INSTANCE',
7   UPDATE_SERVICE_INSTANCE = 'UPDATE_SERVICE_INSTANCE',
8   DELETE_ALL_SERVICE_INSTANCES = 'DELETE_ALL_SERVICE_INSTANCES',
9   UPDATE_MODEL  = 'UPDATE_MODEL',
10   ADD_SERVICE_ACTION = 'ADD_SERVICE_ACTION',
11   DELETE_ACTION_SERVICE_INSTANCE = "DELETE_ACTION_SERVICE_INSTANCE",
12   UNDO_DELETE_ACTION_SERVICE_INSTANCE = "UNDO_DELETE_ACTION_SERVICE_INSTANCE",
13   CHANGE_SERVICE_IS_DIRTY = "CHANGE_SERVICE_IS_DIRTY"
14 }
15
16 export interface CreateServiceInstanceAction extends Action {
17   serviceUuid?: string;
18   serviceInstance?: ServiceInstance;
19 }
20
21 export interface UpdateServiceInstanceAction extends Action {
22   serviceUuid?: string;
23   serviceInstance?: ServiceInstance;
24 }
25
26 export interface DeleteServiceInstanceAction extends Action {
27   serviceUuid?: string;
28 }
29
30 export interface DeleteServiceInstanceAction extends Action {
31   serviceUuid?: string;
32 }
33
34 export interface UpdateServiceModelAction extends Action {
35   serviceHierarchy?: any;
36 }
37
38 export interface AddServiceAction extends Action{
39   serviceUuid: string;
40   action: ServiceInstanceActions;
41 }
42
43
44 export interface DeleteActionServiceInstanceAction extends Action {
45   serviceId?: string;
46 }
47
48 export interface UndoDeleteActionServiceInstanceAction extends Action {
49   serviceId?: string;
50 }
51
52 export interface ChangeServiceDirty extends Action {
53   nodes: any[];
54   serviceId : string;
55 }
56
57 export const addServiceAction: ActionCreator<AddServiceAction> = (serviceUuid : string, actionName : ServiceInstanceActions) => ({
58   type: ServiceActions.ADD_SERVICE_ACTION,
59   serviceUuid: serviceUuid,
60   action : actionName
61 });
62
63
64 export const deleteAllServiceInstances: ActionCreator<DeleteServiceInstanceAction> = () => ({
65   type: ServiceActions.DELETE_ALL_SERVICE_INSTANCES
66 });
67
68 export const createServiceInstance: ActionCreator<CreateServiceInstanceAction> = (serviceInstance, serviceUuid) => ({
69   type: ServiceActions.CREATE_SERVICE_INSTANCE,
70   serviceInstance: serviceInstance,
71   serviceUuid: serviceUuid
72 });
73
74 export const updateServiceInstance: ActionCreator<UpdateServiceInstanceAction> = (serviceInstance, serviceUuid) => ({
75   type: ServiceActions.UPDATE_SERVICE_INSTANCE,
76   serviceInstance: serviceInstance,
77   serviceUuid: serviceUuid
78 });
79
80 export const updateModel: ActionCreator<UpdateServiceModelAction> = serviceHierarchy => ({
81   type: ServiceActions.UPDATE_MODEL,
82   serviceHierarchy: serviceHierarchy
83 });
84
85
86 export const deleteActionServiceInstance: ActionCreator<DeleteActionServiceInstanceAction> = (vnfStoreKey, serviceId) => ({
87   type: ServiceActions.DELETE_ACTION_SERVICE_INSTANCE,
88   serviceId: serviceId
89 });
90
91 export const undoDeleteActionServiceInstance: ActionCreator<UndoDeleteActionServiceInstanceAction> = (vnfStoreKey, serviceId) => ({
92   type: ServiceActions.UNDO_DELETE_ACTION_SERVICE_INSTANCE,
93   serviceId: serviceId
94 });
95
96 export const changeServiceIsDirty: ActionCreator<ChangeServiceDirty> = (nodes, serviceId) => ({
97   type: ServiceActions.CHANGE_SERVICE_IS_DIRTY,
98   nodes: nodes,
99   serviceId : serviceId
100 });
101
102