summaryrefslogtreecommitdiffstats
path: root/vid-webpack-master/src/app/shared/storeUtil/utils/general/general.actions.ts
blob: 7a10eba0af217bc5dce579c44f2905c2c399b127 (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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
import {Action, ActionCreator} from "redux";
import {LcpRegionsAndTenants} from "../../../models/lcpRegionsAndTenants";
import {SelectOptionInterface} from "../../../models/selectOption";
import {ServiceType} from "../../../models/serviceType";
import {ITreeNode} from "angular-tree-component/dist/defs/api";

export enum GeneralActions {
  UPDATE_LCP_REGIONS_AND_TENANTS = "UPDATE_LCP_REGIONS_AND_TENANTS",
  UPDATE_SUBSCRIBERS = "UPDATE_SUBSCRIBERS",
  UPDATE_PRODUCT_FAMILIES = "UPDATE_PRODUCT_FAMILIES",
  UPDATE_SERVICE_TYPES = "UPDATE_SERVICE_TYPES",
  UPDATE_AIC_ZONES = "UPDATE_AIC_ZONES",
  UPDATE_USER_ID = "UPDATE_USER_ID",
  UPDATE_NETWORK_FUNCTION = "UPDATE_NETWORK_FUNCTION",
  UPDATE_CATEGORY_PARAMETERS = "UPDATE_CATEGORY_PARAMETERS",
  REMOVE_INSTANCE = 'REMOVE_INSTANCE',
  CHANGE_INSTANCE_COUNTER = 'CHANGE_INSTANCE_COUNTER',
  DUPLICATE_BULK_INSTANCES = 'DUPLICATE_BULK_INSTANCES'
}
export interface UpdateLcpRegionsAndTenantsAction extends Action {
  lcpRegionsAndTenants?: LcpRegionsAndTenants;
}

export interface RemoveInstanceAction extends Action {
  modelName?: string;
  serviceModelId: string;
  storeKey : string;
  node : ITreeNode;
}

export interface UpdateSubscribersAction extends Action {
  subscribers?: SelectOptionInterface[];
}

export interface UpdateProductFamiliesAction extends Action {
  productFamilies?: SelectOptionInterface[];
}

export interface UpdateAicZonesAction extends Action {
  aicZones?: SelectOptionInterface[];
}

export interface UpdateServiceTypesAction extends Action {
  serviceTypes?: ServiceType[];
  subscriberId: string;
}
export interface UpdateUserIdAction extends Action {
  userId: string;
}

export interface UpdateNetworkCollectionFunction extends Action {
  networksAccordingToNetworkCollection: any;
  network_function: any;
}

export interface UpdateCategoryParametersAction extends Action {
  categoryParameters?: Object;
}

export interface ChangeInstanceCounterAction extends Action{
  serviceUUID : string;
  UUID : string;
  changeBy : number;
  node : ITreeNode;
}

export interface DuplicateBulkInstancesAction extends Action {
  serviceId?: string;
  modelName?: string;
  originalName? : string;
  objects? : {};
  existingNames: {[key: string] : any};
  node : ITreeNode;
}

export interface UpdateServiceTypesAction extends Action {
  serviceTypes?: ServiceType[];
  subscriberId: string;
}

export const updateLcpRegionsAndTenants: ActionCreator<UpdateLcpRegionsAndTenantsAction> = lcpRegionsAndTenants => ({
  type: GeneralActions.UPDATE_LCP_REGIONS_AND_TENANTS,
  lcpRegionsAndTenants: lcpRegionsAndTenants
});

export const updateSubscribers: ActionCreator<UpdateSubscribersAction> = subscribers => ({
  type: GeneralActions.UPDATE_SUBSCRIBERS,
  subscribers: subscribers
});

export const updateProductFamilies: ActionCreator<UpdateProductFamiliesAction> = productFamilies => ({
  type: GeneralActions.UPDATE_PRODUCT_FAMILIES,
  productFamilies: productFamilies
});

export const updateAicZones: ActionCreator<UpdateAicZonesAction> = aicZones => ({
  type: GeneralActions.UPDATE_AIC_ZONES,
  aicZones: aicZones
});

export const updateUserId: ActionCreator<UpdateUserIdAction> = userId => ({
  type: GeneralActions.UPDATE_USER_ID,
  userId: userId
});

export const updateNetworkCollectionFunction: ActionCreator<UpdateNetworkCollectionFunction> = (ncf, networksAccordingToNetworkCollection) => ({
  type: GeneralActions.UPDATE_NETWORK_FUNCTION,
  networksAccordingToNetworkCollection: networksAccordingToNetworkCollection["results"],
  network_function: ncf
});

export const updateCategoryParameters: ActionCreator<UpdateCategoryParametersAction> = categoryParameters => ({
  type: GeneralActions.UPDATE_CATEGORY_PARAMETERS,
  categoryParameters: categoryParameters
});

export const removeInstance: ActionCreator<RemoveInstanceAction> = (modelName, serviceModelId, storeKey, node : ITreeNode) => ({
  type: GeneralActions.REMOVE_INSTANCE,
  modelName: modelName,
  serviceModelId: serviceModelId,
  storeKey: storeKey,
  node : node
});


export const changeInstanceCounter: ActionCreator<ChangeInstanceCounterAction> = (UUID, serviceUUID , changeBy, node) => ({
  type: GeneralActions.CHANGE_INSTANCE_COUNTER,
  UUID: UUID,
  serviceUUID: serviceUUID,
  changeBy : changeBy || 1,
  node : node
});


export const duplicateBulkInstances: ActionCreator<DuplicateBulkInstancesAction> = (serviceId, objects, existingNames, node) => ({
  type: GeneralActions.DUPLICATE_BULK_INSTANCES,
  serviceId: serviceId,
  objects : objects,
  existingNames: existingNames,
  node : node
});


export const updateServiceTypes: ActionCreator<UpdateServiceTypesAction> = (serviceTypes, subscriberId) => ({
  type: GeneralActions.UPDATE_SERVICE_TYPES,
  serviceTypes: serviceTypes,
  subscriberId: subscriberId
});