aboutsummaryrefslogtreecommitdiffstats
path: root/vid-webpack-master/src/app/shared/storeUtil/utils/pnf/pnf.actions.ts
blob: 82ab59fb5e2000a206df7e6e3d4cf07de3ad36dc (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
import {Action, ActionCreator} from "redux";
import {PnfInstance} from "../../../models/pnfInstance";
import {ActionOnFirstLevel} from "../firstLevel/firstLevel.actions";

export enum PNFActions {
  CREATE_PNF_INSTANCE = "CREATE_PNF_INSTANCE",
  UPDATE_PNF_INSTANCE = "UPDATE_PNF_INSTANCE",
  REMOVE_PNF_INSTANCE = "REMOVE_PNF_INSTANCE",
  DELETE_ACTION_PNF_INSTANCE = "DELETE_PNF_INSTANCE",
  UNDO_DELETE_ACTION_PNF_INSTANCE = "UNDO_DELETE_PNF_INSTANCE",
  UPDATE_PNF_POSITION = "UPDATE_PNF_POISTION"
}

export enum PNFMethods{
  UPGRADE = "upgrade",
  UNDO_UPGRADE = "undoUpgrade"
}


export interface CreatePnfInstanceAction extends Action {
  pnfInstance?: PnfInstance;
  pnfModelName?: string;
  serviceUuid?: string;
  pnfStoreKey?:string;
}

export interface UpdatePnfPosition extends Action {
  node: any,
  instanceId : string,
  pnfStoreKey?: string;
}

export interface UpdatePnfInstanceAction extends Action {
  pnfInstance?: PnfInstance;
  pnfModelName?: string;
  serviceUuid?: string;
  pnfStoreKey?:string;
}

export interface RemovePnfInstanceAction extends Action {
  pnfStoreKey: string;
  serviceId?: string;
}

export const createPNFInstance: ActionCreator<CreatePnfInstanceAction> = (pnfInstance, pnfModelName, serviceUuid, pnfStoreKey) => ({
  type: PNFActions.CREATE_PNF_INSTANCE,
  pnfInstance: pnfInstance,
  pnfModelName: pnfModelName,
  serviceUuid: serviceUuid,
  pnfStoreKey : pnfStoreKey
});


export const updatePNFInstance: ActionCreator<UpdatePnfInstanceAction> = (pnfInstance, pnfModelName, serviceUuid, pnfStoreKey) => ({
  type: PNFActions.UPDATE_PNF_INSTANCE,
  pnfInstance: pnfInstance,
  pnfModelName: pnfModelName,
  serviceUuid: serviceUuid,
  pnfStoreKey : pnfStoreKey
});


export const deleteActionPnfInstance: ActionCreator<ActionOnFirstLevel> = (pnfStoreKey, serviceId) => ({
  type: PNFActions.DELETE_ACTION_PNF_INSTANCE,
  firstLevelName: 'pnfs',
  storeKey: pnfStoreKey,
  serviceId: serviceId
});

export const undoDeleteActionPnfInstance: ActionCreator<ActionOnFirstLevel> = (pnfStoreKey, serviceId) => ({
  type: PNFActions.UNDO_DELETE_ACTION_PNF_INSTANCE,
  firstLevelName: 'pnfs',
  storeKey: pnfStoreKey,
  serviceId: serviceId
});

export const removePnfInstance: ActionCreator<RemovePnfInstanceAction> = (pnfStoreKey, serviceId) => ({
  type: PNFActions.REMOVE_PNF_INSTANCE,
  pnfStoreKey: pnfStoreKey,
  serviceId: serviceId
});

export const updatePnfPosition: ActionCreator<UpdatePnfPosition> = (node, instanceId, pnfStoreKey) => ({
  type: PNFActions.UPDATE_PNF_POSITION,
  node: node,
  instanceId: instanceId,
  pnfStoreKey : pnfStoreKey
});