Sonsino, Ofir (os0695) | ff76b5e | 2018-07-10 15:57:37 +0300 | [diff] [blame^] | 1 | import { Action, ActionCreator } from "redux"; |
| 2 | import { LcpRegionsAndTenants } from "./shared/models/lcpRegionsAndTenants"; |
| 3 | import { ServiceInstance } from "./shared/models/serviceInstance"; |
| 4 | import { SelectOptionInterface } from "./shared/models/selectOption"; |
| 5 | import { ServiceType } from "./shared/models/serviceType"; |
| 6 | import { VnfInstance } from "./shared/models/vnfInstance"; |
| 7 | |
| 8 | export const UPDATE_MODEL = "[MODEL] Update"; |
| 9 | export const UPDATE_SERVICE_INSTANCE = "[SERVICE INSTANCE] Update"; |
| 10 | export const UPDATE_VNF_INSTANCE = "[VNF INSTANCE] Update"; |
| 11 | export const UPDATE_VF_MODULE = "[VF MODULE] Update"; |
| 12 | export const CREATE_VF_MODULE = "[VF MODULE] Create"; |
| 13 | |
| 14 | export const UPDATE_LCP_REGIONS_AND_TENANTS = "[LCP_REGIONS_AND_TENANTS] Update"; |
| 15 | export const UPDATE_SUBSCRIBERS = "[SUBSCRIBERS] Update"; |
| 16 | export const UPDATE_PRODUCT_FAMILIES = "[PRODUCT_FAMILIES] Update"; |
| 17 | export const UPDATE_SERVICE_TYPES = "[SERVICE_TYPE] Update"; |
| 18 | export const UPDATE_AIC_ZONES = "[AIC_ZONES] Update"; |
| 19 | export const DELETE_SERVICE_INSTANCE = "[SERVICE_INSTANCE] Delete"; |
| 20 | export const DELETE_VNF_INSTANCE = "[VNF_INSTANCE] Delete"; |
| 21 | export const DELETE_VNF_MODULE_INSTANCE = "[VNF_MODULE_INSTANCE] Delete"; |
| 22 | export const UPDATE_CATEGORY_PARAMETERS = "[CATEGORY_PARAMETERS] Update"; |
| 23 | export const UPDATE_NETWORK_FUNCTION = "[UPDATE_NETWORK_FUNCTION] Update"; |
| 24 | export const UPDATE_USER_ID = "[UPDATE_USER_ID] Update"; |
| 25 | |
| 26 | |
| 27 | export interface UpdateServiceModelAction extends Action { |
| 28 | serviceHierarchy?: any; |
| 29 | } |
| 30 | |
| 31 | export interface UpdateNetworkCollectionFunction extends Action { |
| 32 | networksAccordingToNetworkCollection: any; |
| 33 | network_function: any; |
| 34 | } |
| 35 | |
| 36 | export interface UpdateServiceInstanceAction extends Action { |
| 37 | serviceUuid?: string; |
| 38 | serviceInstance?: ServiceInstance; |
| 39 | } |
| 40 | |
| 41 | export interface UpdateVFModuleInstanceAction extends Action { |
| 42 | vfInstance: any; |
| 43 | vfId: string; |
| 44 | serviceUuid: string; |
| 45 | } |
| 46 | |
| 47 | export interface CreateVFModuleInstanceAction extends Action { |
| 48 | vfInstance: any; |
| 49 | vfId: string; |
| 50 | serviceUuid: string; |
| 51 | index : number |
| 52 | } |
| 53 | |
| 54 | export interface UpdateUserIdAction extends Action { |
| 55 | userId: string; |
| 56 | } |
| 57 | |
| 58 | export interface UpdateVnfInstanceAction extends Action { |
| 59 | vnfInstance?: VnfInstance; |
| 60 | vnfModelName?: string; |
| 61 | serviceUuid?: string; |
| 62 | } |
| 63 | |
| 64 | export interface UpdateLcpRegionsAndTenantsAction extends Action { |
| 65 | lcpRegionsAndTenants?: LcpRegionsAndTenants; |
| 66 | } |
| 67 | |
| 68 | export interface UpdateSubscribersAction extends Action { |
| 69 | subscribers?: SelectOptionInterface[]; |
| 70 | } |
| 71 | |
| 72 | export interface UpdateProductFamiliesAction extends Action { |
| 73 | productFamilies?: SelectOptionInterface[]; |
| 74 | } |
| 75 | |
| 76 | export interface UpdateAicZonesAction extends Action { |
| 77 | aicZones?: SelectOptionInterface[]; |
| 78 | } |
| 79 | |
| 80 | export interface UpdateServiceTypesAction extends Action { |
| 81 | serviceTypes?: ServiceType[]; |
| 82 | subscriberId: string; |
| 83 | } |
| 84 | |
| 85 | export interface DeleteServiceInstanceAction extends Action { |
| 86 | serviceUuid?: string; |
| 87 | } |
| 88 | |
| 89 | export interface DeleteVnfInstanceAction extends Action { |
| 90 | modelName?: string; |
| 91 | serviceModelId: string; |
| 92 | } |
| 93 | |
| 94 | export interface DeleteVfModuleInstanceAction extends Action { |
| 95 | modelName?: string; |
| 96 | serviceModelId?: string; |
| 97 | vfName?: string; |
| 98 | } |
| 99 | |
| 100 | export interface UpdateCategoryParametersAction extends Action { |
| 101 | categoryParameters?: string; |
| 102 | } |
| 103 | |
| 104 | export const updateModel: ActionCreator<UpdateServiceModelAction> = serviceHierarchy => ({ |
| 105 | type: UPDATE_MODEL, |
| 106 | serviceHierarchy: serviceHierarchy |
| 107 | }); |
| 108 | |
| 109 | export const updateServiceInstance: ActionCreator<UpdateServiceInstanceAction> = (serviceInstance, serviceUuid) => ({ |
| 110 | type: UPDATE_SERVICE_INSTANCE, |
| 111 | serviceInstance: serviceInstance, |
| 112 | serviceUuid: serviceUuid |
| 113 | }); |
| 114 | |
| 115 | export const updateVFModuleInstance: ActionCreator<UpdateVFModuleInstanceAction> = (vfInstance, vfId, serviceUuid) => ({ |
| 116 | type: UPDATE_VF_MODULE, |
| 117 | vfInstance: vfInstance, |
| 118 | vfId: vfId, |
| 119 | serviceUuid: serviceUuid |
| 120 | }) |
| 121 | |
| 122 | export const createVFModuleInstance: ActionCreator<CreateVFModuleInstanceAction> = (vfInstance, vfId, serviceUuid, index) => ({ |
| 123 | type: CREATE_VF_MODULE, |
| 124 | vfInstance: vfInstance, |
| 125 | vfId: vfId, |
| 126 | serviceUuid: serviceUuid, |
| 127 | index : index |
| 128 | }) |
| 129 | |
| 130 | |
| 131 | |
| 132 | export const updateVNFInstance: ActionCreator<UpdateVnfInstanceAction> = (vnfInstance, vnfModelName, serviceUuid) => ({ |
| 133 | type: UPDATE_VNF_INSTANCE, |
| 134 | vnfInstance: vnfInstance, |
| 135 | vnfModelName: vnfModelName, |
| 136 | serviceUuid: serviceUuid |
| 137 | }); |
| 138 | |
| 139 | export const updateLcpRegionsAndTenants: ActionCreator<UpdateLcpRegionsAndTenantsAction> = lcpRegionsAndTenants => ({ |
| 140 | type: UPDATE_LCP_REGIONS_AND_TENANTS, |
| 141 | lcpRegionsAndTenants: lcpRegionsAndTenants |
| 142 | }); |
| 143 | |
| 144 | export const updateSubscribers: ActionCreator<UpdateSubscribersAction> = subscribers => ({ |
| 145 | type: UPDATE_SUBSCRIBERS, |
| 146 | subscribers: subscribers |
| 147 | }); |
| 148 | |
| 149 | export const updateProductFamilies: ActionCreator<UpdateProductFamiliesAction> = productFamilies => ({ |
| 150 | type: UPDATE_PRODUCT_FAMILIES, |
| 151 | productFamilies: productFamilies |
| 152 | }); |
| 153 | |
| 154 | export const updateAicZones: ActionCreator<UpdateAicZonesAction> = aicZones => ({ |
| 155 | type: UPDATE_AIC_ZONES, |
| 156 | aicZones: aicZones |
| 157 | }); |
| 158 | |
| 159 | export const updateUserId: ActionCreator<UpdateUserIdAction> = userId => ({ |
| 160 | type: UPDATE_USER_ID, |
| 161 | userId: userId |
| 162 | }); |
| 163 | |
| 164 | export const updateCategoryParameters: ActionCreator<UpdateCategoryParametersAction> = categoryParameters => ({ |
| 165 | type: UPDATE_CATEGORY_PARAMETERS, |
| 166 | categoryParameters: categoryParameters |
| 167 | }); |
| 168 | |
| 169 | export const updateServiceTypes: ActionCreator<UpdateServiceTypesAction> = (serviceTypes, subscriberId) => ({ |
| 170 | type: UPDATE_SERVICE_TYPES, |
| 171 | serviceTypes: serviceTypes, |
| 172 | subscriberId: subscriberId |
| 173 | }); |
| 174 | |
| 175 | export const updateNetworkCollectionFunction: ActionCreator<UpdateNetworkCollectionFunction> = (ncf, networksAccordingToNetworkCollection) => ({ |
| 176 | type: UPDATE_NETWORK_FUNCTION, |
| 177 | networksAccordingToNetworkCollection: networksAccordingToNetworkCollection["results"], |
| 178 | network_function: ncf |
| 179 | }); |
| 180 | |
| 181 | export const deleteServiceInstance: ActionCreator<DeleteServiceInstanceAction> = serviceUuid => ({ |
| 182 | type: DELETE_SERVICE_INSTANCE, |
| 183 | serviceUuid: serviceUuid |
| 184 | }); |
| 185 | |
| 186 | export const deleteVnfInstance: ActionCreator<DeleteVnfInstanceAction> = (modelName, serviceModelId) => ({ |
| 187 | type: DELETE_VNF_INSTANCE, |
| 188 | modelName: modelName, |
| 189 | serviceModelId: serviceModelId |
| 190 | }); |
| 191 | |
| 192 | export const deleteVfModuleInstance: ActionCreator<DeleteVfModuleInstanceAction> = (modelName, serviceModelId, vfName) => ({ |
| 193 | type: DELETE_VNF_MODULE_INSTANCE, |
| 194 | modelName: modelName, |
| 195 | serviceModelId: serviceModelId, |
| 196 | vfName: vfName |
| 197 | }); |