1 import {ServiceInstance} from "../../../models/serviceInstance";
2 import {ServiceInstanceActions} from "../../../models/serviceInstanceActions";
3 import {Action, ActionCreator} from "redux";
5 export enum ServiceActions {
6 CREATE_SERVICE_INSTANCE = 'CREATE_SERVICE_INSTANCE',
7 UPDATE_SERVICE_INSTANCE = 'UPDATE_SERVICE_INSTANCE',
8 DELETE_ALL_SERVICE_INSTANCES = 'DELETE_ALL_SERVICE_INSTANCES',
9 UPDATE_MODEL = 'UPDATE_MODEL',
10 ADD_SERVICE_ACTION = 'ADD_SERVICE_ACTION',
11 DELETE_ACTION_SERVICE_INSTANCE = "DELETE_ACTION_SERVICE_INSTANCE",
12 UNDO_DELETE_ACTION_SERVICE_INSTANCE = "UNDO_DELETE_ACTION_SERVICE_INSTANCE",
13 CHANGE_SERVICE_IS_DIRTY = "CHANGE_SERVICE_IS_DIRTY",
14 UPGRADE_SERVICE_ACTION = "UPGRADE_SERVICE_ACTION",
15 UNDO_UPGRADE_SERVICE_ACTION = "UNDO_UPGRADE_SERVICE_ACTION"
18 export interface CreateServiceInstanceAction extends Action {
20 serviceInstance?: ServiceInstance;
23 export interface UpdateServiceInstanceAction extends Action {
25 serviceInstance?: ServiceInstance;
28 export interface DeleteServiceInstanceAction extends Action {
32 export interface DeleteServiceInstanceAction extends Action {
36 export interface UpdateServiceModelAction extends Action {
37 serviceHierarchy?: any;
40 export interface AddServiceAction extends Action{
42 action: ServiceInstanceActions;
45 export interface UpgradeServiceAction extends Action{
49 export interface UndoUpgradeServiceAction extends Action{
53 export interface DeleteActionServiceInstanceAction extends Action {
57 export interface UndoDeleteActionServiceInstanceAction extends Action {
61 export interface ChangeServiceDirty extends Action {
66 export const addServiceAction: ActionCreator<AddServiceAction> = (serviceUuid : string, actionName : ServiceInstanceActions) => ({
67 type: ServiceActions.ADD_SERVICE_ACTION,
68 serviceUuid: serviceUuid,
73 export const deleteAllServiceInstances: ActionCreator<DeleteServiceInstanceAction> = () => ({
74 type: ServiceActions.DELETE_ALL_SERVICE_INSTANCES
77 export const createServiceInstance: ActionCreator<CreateServiceInstanceAction> = (serviceInstance, serviceUuid) => ({
78 type: ServiceActions.CREATE_SERVICE_INSTANCE,
79 serviceInstance: serviceInstance,
80 serviceUuid: serviceUuid
83 export const updateServiceInstance: ActionCreator<UpdateServiceInstanceAction> = (serviceInstance, serviceUuid) => ({
84 type: ServiceActions.UPDATE_SERVICE_INSTANCE,
85 serviceInstance: serviceInstance,
86 serviceUuid: serviceUuid
89 export const updateModel: ActionCreator<UpdateServiceModelAction> = serviceHierarchy => ({
90 type: ServiceActions.UPDATE_MODEL,
91 serviceHierarchy: serviceHierarchy
95 export const deleteActionServiceInstance: ActionCreator<DeleteActionServiceInstanceAction> = (vnfStoreKey, serviceId) => ({
96 type: ServiceActions.DELETE_ACTION_SERVICE_INSTANCE,
100 export const undoDeleteActionServiceInstance: ActionCreator<UndoDeleteActionServiceInstanceAction> = (vnfStoreKey, serviceId) => ({
101 type: ServiceActions.UNDO_DELETE_ACTION_SERVICE_INSTANCE,
105 export const changeServiceIsDirty: ActionCreator<ChangeServiceDirty> = (nodes, serviceId) => ({
106 type: ServiceActions.CHANGE_SERVICE_IS_DIRTY,
108 serviceId : serviceId
111 export const upgradeService: ActionCreator<UpgradeServiceAction> = (serviceUuid : string) => ({
112 type: ServiceActions.UPGRADE_SERVICE_ACTION,
116 export const undoUpgradeService: ActionCreator<UndoUpgradeServiceAction> = (serviceUuid : string) => ({
117 type: ServiceActions.UNDO_UPGRADE_SERVICE_ACTION,