From c8a3cfffe97ec18a54f43e82c3d4f65a65d7eefb Mon Sep 17 00:00:00 2001 From: Alexey Sandler Date: Wed, 6 May 2020 18:58:14 +0300 Subject: Add to VFM context menu action "Add pause upon completion". Issue-ID: VID-821 Signed-off-by: Alexey Sandler Change-Id: I8b0ef7021fb7b74e8ad12ae92e581510491d9605 Signed-off-by: Alexey Sandler --- .../models/vfModule/vfModule.model.info.spec.ts | 21 +++++++++++++++++++++ .../models/vfModule/vfModule.model.info.ts | 9 +++++++++ .../objectsToTree/shared.tree.service.ts | 3 +++ 3 files changed, 33 insertions(+) (limited to 'vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree') diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vfModule/vfModule.model.info.spec.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vfModule/vfModule.model.info.spec.ts index c225687ea..42ee238d0 100644 --- a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vfModule/vfModule.model.info.spec.ts +++ b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vfModule/vfModule.model.info.spec.ts @@ -20,6 +20,7 @@ import {VfModuleUpgradePopupService} from "../../../../../shared/components/gene import {instance, mock, when} from "ts-mockito"; import each from "jest-each"; import {VfModule} from "../../../../../shared/models/vfModule"; +import {VfModuleTreeNode} from "../../../../../shared/models/vfModuleTreeNode"; class MockAppStore { getState() { @@ -127,6 +128,26 @@ describe('VFModule Model Info', () => { expect(nextLevel).toBeNull(); }); + each([ + ['afterCompletion', 'afterCompletion'], + ['undefined', undefined] + ]). + test('createNode should return pauseInstantiation status %s', (description, pauseInstantiationStatus) => { + const modelName: string = "vfModuleModelName"; + const vfModuleInstance = { + "vfModuleInstanceName": { + "pauseInstantiation": pauseInstantiationStatus, + } + }; + const currentModel = {}; + const parentModel = {}; + const serviceModelId = "serviceModelId"; + + let actual: VfModuleTreeNode = vfModuleModel.createNode(vfModuleInstance, currentModel, parentModel, modelName, 0, serviceModelId); + let expected: string = pauseInstantiationStatus; + expect(actual.pauseInstantiation).toEqual(expected); + }); + test('getModel should return Module model', () => { let model = vfModuleModel.getModel({ "uuid": "25284168-24bb-4698-8cb4-3f509146eca5", diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vfModule/vfModule.model.info.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vfModule/vfModule.model.info.ts index c7c4d3a56..607519ab3 100644 --- a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vfModule/vfModule.model.info.ts +++ b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vfModule/vfModule.model.info.ts @@ -22,6 +22,7 @@ import {IframeService} from "../../../../../shared/utils/iframe.service"; import { deleteActionVfModuleInstance, deleteVFModuleField, + pauseActionVFModuleInstance, removeVfModuleInstance, undoDeleteVfModuleInstance, undoUgradeVFModule, @@ -97,6 +98,7 @@ export class VFModuleModelInfo implements ILevelNodeInfo { newVfModule.menuActions = this.getMenuAction(newVfModule, serviceModelId); newVfModule.isFailed = _.isNil(instance.isFailed) ? false : instance.isFailed; newVfModule.statusMessage = !_.isNil(instance.statusMessage) ? instance.statusMessage : ""; + newVfModule.pauseInstantiation = instance.pauseInstantiation; newVfModule = this._sharedTreeService.addingStatusProperty(newVfModule); return newVfModule; @@ -387,6 +389,13 @@ export class VFModuleModelInfo implements ILevelNodeInfo { return this._sharedTreeService.shouldShowUndoUpgrade(node); } }, + pauseInstantiation: { + method: (node, serviceModelId) => { + this._store.dispatch(pauseActionVFModuleInstance(node.data.dynamicModelName, node.parent.data.vnfStoreKey, serviceModelId, node.data.modelName)); + }, + visible: () => this._sharedTreeService.shouldShowPauseInstantiation(), + enable: () => true, + } }; } diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/shared.tree.service.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/shared.tree.service.ts index 249f9ec85..98edb4161 100644 --- a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/shared.tree.service.ts +++ b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/shared.tree.service.ts @@ -222,6 +222,9 @@ export class SharedTreeService { } } + shouldShowPauseInstantiation(): boolean { + return (FeatureFlagsService.getFlagState(Features.FLAG_2006_PAUSE_VFMODULE_INSTANTIATION_CREATION, this._store)); + } /**************************************************** * should return true if customer can upgrade a VFM * ****************************************************/ -- cgit 1.2.3-korg