import {Action, ActionCreator} from "redux"; import {VnfInstance} from "../../../models/vnfInstance"; import {ActionOnFirstLevel} from "../firstLevel/firstLevel.actions"; export enum VNFActions { CREATE_VNF_INSTANCE = "CREATE_VNF_INSTANCE", UPDATE_VNF_INSTANCE = "UPDATE_VNF_INSTANCE", REMOVE_VNF_INSTANCE = "REMOVE_VNF_INSTANCE", DELETE_ACTION_VNF_INSTANCE = "DELETE_VNF_INSTANCE", UNDO_DELETE_ACTION_VNF_INSTANCE = "UNDO_DELETE_VNF_INSTANCE", UPDATE_VNF_POSITION = "UPDATE_VNF_POISTION" } export interface CreateVnfInstanceAction extends Action { vnfInstance?: VnfInstance; vnfModelName?: string; serviceUuid?: string; vnfStoreKey?:string; } export interface UpdateVnfPosition extends Action { node: any, instanceId : string, vnfStoreKey?: string; } export interface UpdateVnfInstanceAction extends Action { vnfInstance?: VnfInstance; vnfModelName?: string; serviceUuid?: string; vnfStoreKey?:string; } export interface RemoveVnfInstanceAction extends Action { vnfStoreKey: string; serviceId?: string; } export const createVNFInstance: ActionCreator = (vnfInstance, vnfModelName, serviceUuid, vnfStoreKey) => ({ type: VNFActions.CREATE_VNF_INSTANCE, vnfInstance: vnfInstance, vnfModelName: vnfModelName, serviceUuid: serviceUuid, vnfStoreKey : vnfStoreKey }); export const updateVNFInstance: ActionCreator = (vnfInstance, vnfModelName, serviceUuid, vnfStoreKey) => ({ type: VNFActions.UPDATE_VNF_INSTANCE, vnfInstance: vnfInstance, vnfModelName: vnfModelName, serviceUuid: serviceUuid, vnfStoreKey : vnfStoreKey }); export const deleteActionVnfInstance: ActionCreator = (vnfStoreKey, serviceId) => ({ type: VNFActions.DELETE_ACTION_VNF_INSTANCE, firstLevelName: 'vnfs', storeKey: vnfStoreKey, serviceId: serviceId }); export const undoDeleteActionVnfInstance: ActionCreator = (vnfStoreKey, serviceId) => ({ type: VNFActions.UNDO_DELETE_ACTION_VNF_INSTANCE, firstLevelName: 'vnfs', storeKey: vnfStoreKey, serviceId: serviceId }); export const removeVnfInstance: ActionCreator = (vnfStoreKey, serviceId) => ({ type: VNFActions.REMOVE_VNF_INSTANCE, vnfStoreKey: vnfStoreKey, serviceId: serviceId }); export const updateVnfPosition: ActionCreator = (node, instanceId, vnfStoreKey) => ({ type: VNFActions.UPDATE_VNF_POSITION, node: node, instanceId: instanceId, vnfStoreKey : vnfStoreKey });