Merge changes from topics "VID-11", "VID-10", "VID-9"
[vid.git] / vid-webpack-master / src / app / shared / storeUtil / utils / vnf / vnf.actions.ts
1 import {Action, ActionCreator} from "redux";
2 import {VnfInstance} from "../../../models/vnfInstance";
3 import {ActionOnFirstLevel} from "../firstLevel/firstLevel.actions";
4
5 export enum VNFActions {
6   CREATE_VNF_INSTANCE = "CREATE_VNF_INSTANCE",
7   UPDATE_VNF_INSTANCE = "UPDATE_VNF_INSTANCE",
8   REMOVE_VNF_INSTANCE = "REMOVE_VNF_INSTANCE",
9   DELETE_ACTION_VNF_INSTANCE = "DELETE_VNF_INSTANCE",
10   UNDO_DELETE_ACTION_VNF_INSTANCE = "UNDO_DELETE_VNF_INSTANCE",
11   UPDATE_VNF_POSITION = "UPDATE_VNF_POISTION",
12   UPGRADE_VNF_ACTION = "UPGRADE_VNF_ACTION",
13   UNDO_UPGRADE_VNF_ACTION = "UNDO_UPGRADE_VNF_ACTION"
14 }
15
16 export enum VNFMethods{
17   UPGRADE = "upgrade",
18   UNDO_UPGRADE = "undoUpgrade"
19 }
20
21
22 export interface CreateVnfInstanceAction extends Action {
23   vnfInstance?: VnfInstance;
24   vnfModelName?: string;
25   serviceUuid?: string;
26   vnfStoreKey?:string;
27 }
28
29 export interface UpdateVnfPosition extends Action {
30   node: any,
31   instanceId : string,
32   vnfStoreKey?: string;
33 }
34
35 export interface UpdateVnfInstanceAction extends Action {
36   vnfInstance?: VnfInstance;
37   vnfModelName?: string;
38   serviceUuid?: string;
39   vnfStoreKey?:string;
40 }
41
42 export interface UpgradeVnfAction extends Action {
43   serviceUuid: string;
44   vnfStoreKey:string;
45 }
46
47 export interface UndoUpgradeVnfAction extends Action {
48   serviceUuid: string;
49   vnfStoreKey:string;
50 }
51
52 export interface RemoveVnfInstanceAction extends Action {
53   vnfStoreKey: string;
54   serviceId?: string;
55 }
56
57 export const createVNFInstance: ActionCreator<CreateVnfInstanceAction> = (vnfInstance, vnfModelName, serviceUuid, vnfStoreKey) => ({
58   type: VNFActions.CREATE_VNF_INSTANCE,
59   vnfInstance: vnfInstance,
60   vnfModelName: vnfModelName,
61   serviceUuid: serviceUuid,
62   vnfStoreKey : vnfStoreKey
63 });
64
65
66 export const updateVNFInstance: ActionCreator<UpdateVnfInstanceAction> = (vnfInstance, vnfModelName, serviceUuid, vnfStoreKey) => ({
67   type: VNFActions.UPDATE_VNF_INSTANCE,
68   vnfInstance: vnfInstance,
69   vnfModelName: vnfModelName,
70   serviceUuid: serviceUuid,
71   vnfStoreKey : vnfStoreKey
72 });
73
74
75 export const deleteActionVnfInstance: ActionCreator<ActionOnFirstLevel> = (vnfStoreKey, serviceId) => ({
76   type: VNFActions.DELETE_ACTION_VNF_INSTANCE,
77   firstLevelName: 'vnfs',
78   storeKey: vnfStoreKey,
79   serviceId: serviceId
80 });
81
82 export const undoDeleteActionVnfInstance: ActionCreator<ActionOnFirstLevel> = (vnfStoreKey, serviceId) => ({
83   type: VNFActions.UNDO_DELETE_ACTION_VNF_INSTANCE,
84   firstLevelName: 'vnfs',
85   storeKey: vnfStoreKey,
86   serviceId: serviceId
87 });
88
89 export const removeVnfInstance: ActionCreator<RemoveVnfInstanceAction> = (vnfStoreKey, serviceId) => ({
90   type: VNFActions.REMOVE_VNF_INSTANCE,
91   vnfStoreKey: vnfStoreKey,
92   serviceId: serviceId
93 });
94
95 export const updateVnfPosition: ActionCreator<UpdateVnfPosition> = (node, instanceId, vnfStoreKey) => ({
96   type: VNFActions.UPDATE_VNF_POSITION,
97   node: node,
98   instanceId: instanceId,
99   vnfStoreKey : vnfStoreKey
100 });
101
102 export const upgradeVnf: ActionCreator<UpgradeVnfAction> = (vnfStoreKey, serviceUuid) => ({
103   type: VNFActions.UPGRADE_VNF_ACTION,
104   serviceUuid,
105   vnfStoreKey
106 });
107
108 export const undoUpgradeVnf: ActionCreator<UndoUpgradeVnfAction> = (vnfStoreKey, serviceUuid) => ({
109   type: VNFActions.UNDO_UPGRADE_VNF_ACTION,
110   serviceUuid,
111   vnfStoreKey
112 });