summaryrefslogtreecommitdiffstats
path: root/vid-webpack-master/src/app/shared/storeUtil/utils/cr/cr.reducer.ts
diff options
context:
space:
mode:
Diffstat (limited to 'vid-webpack-master/src/app/shared/storeUtil/utils/cr/cr.reducer.ts')
-rw-r--r--vid-webpack-master/src/app/shared/storeUtil/utils/cr/cr.reducer.ts23
1 files changed, 23 insertions, 0 deletions
diff --git a/vid-webpack-master/src/app/shared/storeUtil/utils/cr/cr.reducer.ts b/vid-webpack-master/src/app/shared/storeUtil/utils/cr/cr.reducer.ts
new file mode 100644
index 000000000..72894e6f0
--- /dev/null
+++ b/vid-webpack-master/src/app/shared/storeUtil/utils/cr/cr.reducer.ts
@@ -0,0 +1,23 @@
+import {ServiceState} from "../main.reducer";
+import {Action} from "redux";
+import * as _ from "lodash";
+import {ServiceInstanceActions} from "../../../models/serviceInstanceActions";
+import {CrActions} from "./cr.actions";
+import {ActionOnFirstLevel} from "../firstLevel/firstLevel.actions";
+import {deleteFirstLevel} from "../reducersHelper";
+
+export function crReducer(state: ServiceState, action: Action): ServiceState {
+ switch (action.type) {
+ case CrActions.DELETE_ACTION_CR_INSTANCE : {
+ return deleteFirstLevel(state, <ActionOnFirstLevel>action, false);
+ }
+
+ case CrActions.UNDO_DELETE_ACTION_CR_INSTANCE : {
+ let newState = _.cloneDeep(state);
+ let vnf = newState.serviceInstance[(<ActionOnFirstLevel>action).serviceId]['collectionResources'][(<ActionOnFirstLevel>action).storeKey];
+ let oldState = vnf.action;
+ newState.serviceInstance[(<ActionOnFirstLevel>action).serviceId]['collectionResources'][(<ActionOnFirstLevel>action).storeKey].action = (oldState.split('_')[0]) as ServiceInstanceActions;
+ return newState;
+ }
+ }
+ }