aboutsummaryrefslogtreecommitdiffstats
path: root/vid-webpack-master/src/app/shared/storeUtil/utils/service/service.actions.ts
blob: 20c6dbe852dc0e22da881435355e2b168e789db6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
import {ServiceInstance} from "../../../models/serviceInstance";
import {ServiceInstanceActions} from "../../../models/serviceInstanceActions";
import {Action, ActionCreator} from "redux";

export enum ServiceActions {
  CREATE_SERVICE_INSTANCE = 'CREATE_SERVICE_INSTANCE',
  UPDATE_SERVICE_INSTANCE = 'UPDATE_SERVICE_INSTANCE',
  DELETE_ALL_SERVICE_INSTANCES = 'DELETE_ALL_SERVICE_INSTANCES',
  UPDATE_MODEL  = 'UPDATE_MODEL',
  ADD_SERVICE_ACTION = 'ADD_SERVICE_ACTION',
  DELETE_ACTION_SERVICE_INSTANCE = "DELETE_ACTION_SERVICE_INSTANCE",
  UNDO_DELETE_ACTION_SERVICE_INSTANCE = "UNDO_DELETE_ACTION_SERVICE_INSTANCE",
  CHANGE_SERVICE_IS_DIRTY = "CHANGE_SERVICE_IS_DIRTY",
  UPGRADE_SERVICE_ACTION = "UPGRADE_SERVICE_ACTION",
  UPDATE_SERVICE_INFO_MODEL = "UPDATE_SERVICE_INFO_MODEL",
  UNDO_UPGRADE_SERVICE_ACTION = "UNDO_UPGRADE_SERVICE_ACTION"
}

export interface CreateServiceInstanceAction extends Action {
  serviceUuid?: string;
  serviceInstance?: ServiceInstance;
}

export interface UpdateServiceInstanceAction extends Action {
  serviceUuid?: string;
  serviceInstance?: ServiceInstance;
}

export interface DeleteServiceInstanceAction extends Action {
  serviceUuid?: string;
}

export interface DeleteServiceInstanceAction extends Action {
  serviceUuid?: string;
}

export interface UpdateServiceModelAction extends Action {
  serviceHierarchy?: any;
}

export interface AddServiceAction extends Action{
  serviceUuid: string;
  action: ServiceInstanceActions;
}

export interface UpgradeServiceAction extends Action{
  serviceUuid: string;
}

export interface UndoUpgradeServiceAction extends Action{
  serviceUuid: string;
}

export interface DeleteActionServiceInstanceAction extends Action {
  serviceId?: string;
}

export interface UndoDeleteActionServiceInstanceAction extends Action {
  serviceId?: string;
}

export interface ChangeServiceDirty extends Action {
  nodes: any[];
  serviceId : string;
}

export interface UpdateServiceModelInfoAction extends  Action {
  serviceInfoModel?: any;
}

export const addServiceAction: ActionCreator<AddServiceAction> = (serviceUuid : string, actionName : ServiceInstanceActions) => ({
  type: ServiceActions.ADD_SERVICE_ACTION,
  serviceUuid: serviceUuid,
  action : actionName
});


export const deleteAllServiceInstances: ActionCreator<DeleteServiceInstanceAction> = () => ({
  type: ServiceActions.DELETE_ALL_SERVICE_INSTANCES
});

export const createServiceInstance: ActionCreator<CreateServiceInstanceAction> = (serviceInstance, serviceUuid) => ({
  type: ServiceActions.CREATE_SERVICE_INSTANCE,
  serviceInstance: serviceInstance,
  serviceUuid: serviceUuid
});

export const updateServiceInstance: ActionCreator<UpdateServiceInstanceAction> = (serviceInstance, serviceUuid) => ({
  type: ServiceActions.UPDATE_SERVICE_INSTANCE,
  serviceInstance: serviceInstance,
  serviceUuid: serviceUuid
});

export const updateModel: ActionCreator<UpdateServiceModelAction> = serviceHierarchy => ({
  type: ServiceActions.UPDATE_MODEL,
  serviceHierarchy: serviceHierarchy
});


export const deleteActionServiceInstance: ActionCreator<DeleteActionServiceInstanceAction> = (vnfStoreKey, serviceId) => ({
  type: ServiceActions.DELETE_ACTION_SERVICE_INSTANCE,
  serviceId: serviceId
});

export const undoDeleteActionServiceInstance: ActionCreator<UndoDeleteActionServiceInstanceAction> = (vnfStoreKey, serviceId) => ({
  type: ServiceActions.UNDO_DELETE_ACTION_SERVICE_INSTANCE,
  serviceId: serviceId
});

export const changeServiceIsDirty: ActionCreator<ChangeServiceDirty> = (nodes, serviceId) => ({
  type: ServiceActions.CHANGE_SERVICE_IS_DIRTY,
  nodes: nodes,
  serviceId : serviceId
});

export const upgradeService: ActionCreator<UpgradeServiceAction> = (serviceUuid : string) => ({
  type: ServiceActions.UPGRADE_SERVICE_ACTION,
  serviceUuid
});

export const undoUpgradeService: ActionCreator<UndoUpgradeServiceAction> = (serviceUuid : string) => ({
  type: ServiceActions.UNDO_UPGRADE_SERVICE_ACTION,
  serviceUuid
});

export const updateServiceInfoModel : ActionCreator<UpdateServiceModelInfoAction> = (serviceInfoModel : any) => ({
  type: ServiceActions.UPDATE_SERVICE_INFO_MODEL,
  serviceInfoModel
});