aboutsummaryrefslogtreecommitdiffstats
path: root/vid-webpack-master/src/app/shared/storeUtil/utils/service/service.actions.ts
blob: 069ef82e8d7281b3a9cea8250f98eda2b85c43a8 (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
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",
  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 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
});