diff options
15 files changed, 398 insertions, 12 deletions
diff --git a/vid-automation/src/main/java/vid/automation/test/infra/Features.java b/vid-automation/src/main/java/vid/automation/test/infra/Features.java index 02b841fbe..3e96fa199 100644 --- a/vid-automation/src/main/java/vid/automation/test/infra/Features.java +++ b/vid-automation/src/main/java/vid/automation/test/infra/Features.java @@ -65,7 +65,8 @@ public enum Features implements Feature { FLAG_EXP_USE_FORMAT_PARAMETER_FOR_CM_DASHBOARD, FLAG_2006_NETWORK_LOB_MULTI_SELECT, FLAG_2006_VNF_LOB_MULTI_SELECT, - FLAG_2006_PORT_MIRRORING_LET_SELECTING_SOURCE_SUBSCRIBER + FLAG_2006_PORT_MIRRORING_LET_SELECTING_SOURCE_SUBSCRIBER, + FLAG_2006_PAUSE_VFMODULE_INSTANTIATION_CREATION, ; public boolean isActive() { diff --git a/vid-webpack-master/cypress/integration/iFrames/pauseInstantiationOnVfModule.e2e.ts b/vid-webpack-master/cypress/integration/iFrames/pauseInstantiationOnVfModule.e2e.ts new file mode 100644 index 000000000..c725e33fc --- /dev/null +++ b/vid-webpack-master/cypress/integration/iFrames/pauseInstantiationOnVfModule.e2e.ts @@ -0,0 +1,97 @@ +///<reference path="../../../node_modules/cypress/types/index.d.ts"/> / <reference types="Cypress" /> + +describe('Create Instance page: Pause after vfModule instantiation ', () => { + + beforeEach(() => { + cy.clearSessionStorage(); + cy.setTestApiParamToGR(); + cy.initVidMock(); + cy.permissionVidMock(); + cy.login(); + + }); + + afterEach(() => { + cy.screenshot(); + }); + + it(`Pause on VFModule instantiation: create two vfmodules and pause after a first vfmodule`, function () { + cy.readFile('cypress/support/jsonBuilders/mocks/jsons/flags.cypress.json').then((flags) => { + cy.server() + .route({ + method: 'GET', + delay: 0, + status: 200, + url: Cypress.config('baseUrl') + "/flags**", + response: flags + }).as('initFlags'); + }); + + cy.readFile('cypress/support/jsonBuilders/mocks/jsons/reduxModelOneVnfAndTwoVfmodulesInstanceOneVnf.json').then((reduxState) => { + + cy.setReduxState(<any>reduxState); + cy.openIframe('app/ui/#/servicePlanning?serviceModelId=f3862254-8df2-4a0a-8137-0a9fe985860c'); + const vnfName = "vOCG_1804_VF 0"; + let vfModulesNames: Array<string> = [ + 'vocg_1804_vf0..Vocg1804Vf..base_ocg..module-0', + 'vocg_1804_vf0..Vocg1804Vf..ocgapp_004..module-11' + ]; + const uuidAndVfModuleNames: Array<string> = [ + '815db6e5-bdfd-4cb6-9575-82c36df8747a-vocg_1804_vf0..Vocg1804Vf..base_ocg..module-0', + 'da10c7fe-cf81-441c-9694-4e9ddf2054d8-vocg_1804_vf0..Vocg1804Vf..ocgapp_004..module-11' + ]; + + addALaCarteVfModuleEcompGeneratedNamingTrue(vnfName, vfModulesNames[0], uuidAndVfModuleNames[0]); + addALaCarteVfModuleEcompGeneratedNamingTrue(vnfName, vfModulesNames[1], uuidAndVfModuleNames[1]); + pauseOnVfModuleInstantiation('node-' + uuidAndVfModuleNames[1], 0) + mockAsyncBulkResponse(); + cy.getDrawingBoardDeployBtn().click(); + + cy.wait('@expectedPostAsyncInstantiation') + .then(xhr => { + let vfModules = bodyOf(xhr).vnfs['vOCG_1804_VF 0'].vfModules; + + let unPausedVModule = vfModules[vfModulesNames[0]]; + const unPausedVModuleObject = unPausedVModule[Object.keys(unPausedVModule)[0]]; + expect(unPausedVModuleObject.pauseInstantiation).equals(undefined); + + let pausedVModule = vfModules[vfModulesNames[1]]; + const pausedVModuleObject = pausedVModule[Object.keys(pausedVModule)[0]]; + expect(pausedVModuleObject.pauseInstantiation).equals("afterCompletion"); + }); + }); + }); + + function addALaCarteVfModuleEcompGeneratedNamingTrue(vnfName: string, vfModulesName: string, uuidAndVfModuleName: string): Chainable<any> { + return cy.getElementByDataTestsId('node-' + vnfName).click({force: true}).then(() => { + cy.getElementByDataTestsId('node-' + vfModulesName + '-add-btn').click({force: true}).then(() => { + cy.getElementByDataTestsId('node-' + uuidAndVfModuleName + '-menu-btn') + .click({force: true}).then(() => { + cy.getElementByDataTestsId('context-menu-edit').click().then(() => { + cy.getElementByDataTestsId('form-set').click(); + }) + }) + }) + }) + } + + function bodyOf(xhr: Cypress.WaitXHR) { + return JSON.parse(JSON.stringify(xhr.request.body)); + } + + function mockAsyncBulkResponse() { + cy.server().route({ + url: Cypress.config('baseUrl') + '/asyncInstantiation/bulk', + method: 'POST', + status: 200, + response: "[]", + }).as("expectedPostAsyncInstantiation"); + } + + + function pauseOnVfModuleInstantiation(nodeId: string, index: number) { + cy.drawingBoardTreeOpenContextMenuByElementDataTestId(`${nodeId}`, index) + .getElementByDataTestsId('context-menu-pause').click({force: true}); + } + +}); diff --git a/vid-webpack-master/cypress/support/jsonBuilders/mocks/jsons/flags.cypress.json b/vid-webpack-master/cypress/support/jsonBuilders/mocks/jsons/flags.cypress.json index d60b37563..9c597c513 100644 --- a/vid-webpack-master/cypress/support/jsonBuilders/mocks/jsons/flags.cypress.json +++ b/vid-webpack-master/cypress/support/jsonBuilders/mocks/jsons/flags.cypress.json @@ -27,5 +27,6 @@ "FLAG_2006_VFMODULE_TAKES_TENANT_AND_REGION_FROM_VNF": true, "FLAG_2006_NETWORK_PLATFORM_MULTI_SELECT" :true, "FLAG_2006_NETWORK_LOB_MULTI_SELECT" : true, - "FLAG_2006_NEW_VIEW_EDIT_BUTTON_IN_INSTANTIATION_STATUS" : true + "FLAG_2006_NEW_VIEW_EDIT_BUTTON_IN_INSTANTIATION_STATUS" : true, + "FLAG_2006_PAUSE_VFMODULE_INSTANTIATION_CREATION" : true } diff --git a/vid-webpack-master/cypress/support/jsonBuilders/mocks/jsons/reduxModelOneVnfAndTwoVfmodulesInstanceOneVnf.json b/vid-webpack-master/cypress/support/jsonBuilders/mocks/jsons/reduxModelOneVnfAndTwoVfmodulesInstanceOneVnf.json new file mode 100644 index 000000000..0dba319df --- /dev/null +++ b/vid-webpack-master/cypress/support/jsonBuilders/mocks/jsons/reduxModelOneVnfAndTwoVfmodulesInstanceOneVnf.json @@ -0,0 +1,235 @@ +{ + "global": { + "name": null, + "drawingBoardStatus": "CREATE", + "genericModalCriteria": { + "roles": [] + }, + "genericModalHelper": {}, + "type": "UPDATE_DRAWING_BOARD_STATUS" + }, + "service": { + "serviceHierarchy": { + "f3862254-8df2-4a0a-8137-0a9fe985860c": { + "service": { + "uuid": "f3862254-8df2-4a0a-8137-0a9fe985860c", + "invariantUuid": "d1068db8-b933-4919-8972-8bc1aed366c8", + "name": "vOCG_1804_SVC", + "version": "4.0", + "toscaModelURL": null, + "category": "Mobility", + "serviceType": "", + "serviceRole": "", + "description": "updated HEAT", + "serviceEcompNaming": "true", + "instantiationType": "ClientConfig", + "inputs": {}, + "vidNotions": { + "instantiationUI": "anyAlacarteWhichNotExcluded", + "modelCategory": "other", + "viewEditUI": "legacy", + "instantiationType": "ALaCarte" + } + }, + "vnfs": { + "vOCG_1804_VF 0": { + "uuid": "aca3f7b1-15f9-45a5-b182-b8b5aca84a76", + "invariantUuid": "db23d71a-4cb4-4030-9c9b-e3f886c2b35c", + "description": "vOCG redesigned one App VM per module", + "name": "vOCG_1804_VF", + "version": "4.0", + "customizationUuid": "e9ed1da0-c078-426a-8e84-6f4e85eace59", + "properties": { + "ecomp_generated_naming": "true" + }, + "type": "VF", + "modelCustomizationName": "vOCG_1804_VF 0", + "vfModules": { + "vocg_1804_vf0..Vocg1804Vf..base_ocg..module-0": { + "uuid": "815db6e5-bdfd-4cb6-9575-82c36df8747a", + "invariantUuid": "e9c795c8-6b98-4db3-bd90-a84b8ca5181b", + "customizationUuid": "a7b333d7-7633-4197-b40d-80fcfcadee94", + "description": null, + "name": "Vocg1804Vf..base_ocg..module-0", + "version": "4", + "modelCustomizationName": "Vocg1804Vf..base_ocg..module-0", + "properties": { + "minCountInstances": 1, + "maxCountInstances": 1, + "initialCount": 1, + "vfModuleLabel": "base_ocg", + "baseModule": true + }, + "inputs": {}, + "volumeGroupAllowed": false + }, + "vocg_1804_vf0..Vocg1804Vf..ocgapp_004..module-11": { + "uuid": "da10c7fe-cf81-441c-9694-4e9ddf2054d8", + "invariantUuid": "d4a5d266-e867-4171-8e2b-8fc99223d938", + "customizationUuid": "e4feeba0-1d6f-49e3-ae7c-cba83d479b51", + "description": null, + "name": "Vocg1804Vf..ocgapp_004..module-11", + "version": "2", + "modelCustomizationName": "Vocg1804Vf..ocgapp_004..module-11", + "properties": { + "minCountInstances": 0, + "maxCountInstances": null, + "initialCount": 0, + "vfModuleLabel": "ocgapp_004", + "baseModule": false + }, + "inputs": {}, + "volumeGroupAllowed": true + } + } + } + }, + "vfModules": { + "vocg_1804_vf0..Vocg1804Vf..base_ocg..module-0": { + "uuid": "815db6e5-bdfd-4cb6-9575-82c36df8747a", + "invariantUuid": "e9c795c8-6b98-4db3-bd90-a84b8ca5181b", + "customizationUuid": "a7b333d7-7633-4197-b40d-80fcfcadee94", + "description": null, + "name": "Vocg1804Vf..base_ocg..module-0", + "version": "4", + "modelCustomizationName": "Vocg1804Vf..base_ocg..module-0", + "properties": { + "minCountInstances": 1, + "maxCountInstances": 1, + "initialCount": 1, + "vfModuleLabel": "base_ocg", + "baseModule": true + }, + "inputs": {}, + "volumeGroupAllowed": false + }, + "vocg_1804_vf0..Vocg1804Vf..ocgapp_004..module-11": { + "uuid": "da10c7fe-cf81-441c-9694-4e9ddf2054d8", + "invariantUuid": "d4a5d266-e867-4171-8e2b-8fc99223d938", + "customizationUuid": "e4feeba0-1d6f-49e3-ae7c-cba83d479b51", + "description": null, + "name": "Vocg1804Vf..ocgapp_004..module-11", + "version": "2", + "modelCustomizationName": "Vocg1804Vf..ocgapp_004..module-11", + "properties": { + "minCountInstances": 0, + "maxCountInstances": null, + "initialCount": 0, + "vfModuleLabel": "ocgapp_004", + "baseModule": false + }, + "inputs": {}, + "volumeGroupAllowed": true + } + } + } + }, + "serviceInstance": { + "f3862254-8df2-4a0a-8137-0a9fe985860c": { + "action": "Create", + "isDirty": true, + "vnfs": { + "vOCG_1804_VF 0": { + "action": "Create", + "inMaint": false, + "rollbackOnFailure": "true", + "originalName": "vOCG_1804_VF 0", + "isMissingData": false, + "trackById": "v0c2si90m5", + "vfModules":{}, + "vnfStoreKey": "vOCG_1804_VF 0", + "upgradedVFMSonsCounter": 0, + "uuid": "aca3f7b1-15f9-45a5-b182-b8b5aca84a76", + "lcpCloudRegionId": "dpa2a", + "tenantId": "99ac518f94b6481faccedc32f86f4115", + "lineOfBusiness": "ADI", + "platformName": "3rdPartyCloud", + "modelInfo": { + "modelInvariantId": "db23d71a-4cb4-4030-9c9b-e3f886c2b35c", + "modelVersionId": "aca3f7b1-15f9-45a5-b182-b8b5aca84a76", + "modelName": "vOCG_1804_VF", + "modelVersion": "4.0", + "modelCustomizationId": "e9ed1da0-c078-426a-8e84-6f4e85eace59", + "modelCustomizationName": "vOCG_1804_VF 0", + "uuid": "aca3f7b1-15f9-45a5-b182-b8b5aca84a76", + "modelUniqueId": "e9ed1da0-c078-426a-8e84-6f4e85eace59" + }, + "instanceName": "vOCG_1804_SVC-VNF", + "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "instanceParams": [ + {} + ] + } + }, + "vrfs": {}, + "instanceParams": [ + {} + ], + "validationCounter": 0, + "existingNames": { + "vocg_1804_svc-instance": "", + "vocg_1804_svc-vnf": "", + "vocg_1804_svc-vfmodule-base": "", + "vocg_1804_svc-vfmodule-1": "", + "vocg_1804_svc-vfmodule-1_vol": "", + "vocg_1804_svc-vfmodule-2": "", + "vocg_1804_svc-vfmodule-2_vol": "" + }, + "existingVNFCounterMap": { + "e9ed1da0-c078-426a-8e84-6f4e85eace59": 1 + }, + "existingVRFCounterMap": {}, + "existingVnfGroupCounterMap": {}, + "existingNetworksCounterMap": {}, + "optionalGroupMembersMap": {}, + "networks": {}, + "vnfGroups": {}, + "bulkSize": 1, + "isUpgraded": false, + "upgradedVFMSonsCounter": 0, + "instanceName": "vOCG_1804_SVC-instance", + "globalSubscriberId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "subscriptionServiceType": "Mobility", + "owningEntityId": "10c645f5-9924-4b89-bec0-b17cf49d3cad", + "projectName": null, + "rollbackOnFailure": "true", + "aicZoneName": null, + "owningEntityName": "MOBILITY-CORE", + "testApi": "GR_API", + "tenantName": null, + "modelInfo": { + "modelInvariantId": "d1068db8-b933-4919-8972-8bc1aed366c8", + "modelVersionId": "f3862254-8df2-4a0a-8137-0a9fe985860c", + "modelName": "vOCG_1804_SVC", + "modelVersion": "4.0", + "uuid": "f3862254-8df2-4a0a-8137-0a9fe985860c", + "modelUniqueId": "f3862254-8df2-4a0a-8137-0a9fe985860c" + }, + "isALaCarte": true, + "name": "vOCG_1804_SVC", + "version": "4.0", + "description": "updated HEAT", + "category": "Mobility", + "uuid": "f3862254-8df2-4a0a-8137-0a9fe985860c", + "invariantUuid": "d1068db8-b933-4919-8972-8bc1aed366c8", + "serviceType": "", + "serviceRole": "", + "vidNotions": { + "instantiationUI": "anyAlacarteWhichNotExcluded", + "modelCategory": "other", + "viewEditUI": "legacy", + "instantiationType": "ALaCarte" + }, + "isEcompGeneratedNaming": true, + "isMultiStepDesign": false + } + }, + "subscribers": [ + { + "id": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "name": "Mobility", + "isPermitted": true + } + ] + } +} diff --git a/vid-webpack-master/package.json b/vid-webpack-master/package.json index fdaf3e3d5..5b3ff021c 100755 --- a/vid-webpack-master/package.json +++ b/vid-webpack-master/package.json @@ -102,8 +102,8 @@ "jest-sonar-reporter": "2.0.0", "ngx-wallaby-jest": "0.0.1", "npm-run-all": "^4.1.5", - "onap-ui-angular": "5.2.7", - "onap-ui-common": "1.0.105", + "onap-ui-angular": "5.4.1", + "onap-ui-common": "1.0.115", "prettier": "1.16.4", "pretty-quick": "^1.10.0", "redux-observable-es6-compat": "^1.2.1", diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-tree/drawing-board-tree.component.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-tree/drawing-board-tree.component.ts index 18c3f72de..837471395 100644 --- a/vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-tree/drawing-board-tree.component.ts +++ b/vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-tree/drawing-board-tree.component.ts @@ -213,6 +213,11 @@ export class DrawingBoardTreeComponent implements OnInit, AfterViewInit { return this.isLabeledAsAction(node, "Delete"); } + isPaused(node: ITreeNode): boolean { + let isPaused = node.data.pauseInstantiation; + return !_.isNil(isPaused); + } + private isLabeledAsAction(node: ITreeNode, action) { let nodeAction = node.data.action.split('_').pop(); if (!_.isNil(nodeAction)) { diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-tree/drawing-board-tree.html b/vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-tree/drawing-board-tree.html index 610986279..0ebee903c 100644 --- a/vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-tree/drawing-board-tree.html +++ b/vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-tree/drawing-board-tree.html @@ -66,7 +66,14 @@ <div class="scaling invalid" *ngIf="node?.data?.errors?.scalingError" [attr.data-tests-id]="'scaling-policy'"> <span>Limit</span><span>{{node?.data?.limitMembers}}</span> </div> - <div class="model-actions notShowOnViewMode "> + <div class="model-actions notShowOnViewMode" *ngIf="isPaused(node)" style="border-right: none;"> + <custom-icon + [size]="'large'" + [name]="'pause-upon-completion'" + [testId]="'pause-upon-completion'"> + </custom-icon> + </div> + <div class="model-actions notShowOnViewMode"> <span class="icon-browse" [ngClass]="{'isLinked' : isLinkedInstance(node?.data)}" [attr.data-tests-id]="'node-'+node.data.modelId +'-' +node.data.modelName+'-menu-btn'" diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-tree/drawing-board-tree.scss b/vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-tree/drawing-board-tree.scss index b774e03b6..95e7ba9ff 100644 --- a/vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-tree/drawing-board-tree.scss +++ b/vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-tree/drawing-board-tree.scss @@ -408,7 +408,7 @@ drawing-board-tree { } } - .model-actions { + .model-actions{ :hover { background: transparent !important; } @@ -496,7 +496,7 @@ drawing-board-tree { .cdk-overlay-pane.ngx-contextmenu { ul.dropdown-menu { - width: 200px; + width: 250px; box-shadow: none; padding: 0; padding-top: 10px; diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-tree/drawing-board-tree.service.spec.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-tree/drawing-board-tree.service.spec.ts index e5979f7ed..90ecb8565 100644 --- a/vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-tree/drawing-board-tree.service.spec.ts +++ b/vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-tree/drawing-board-tree.service.spec.ts @@ -74,9 +74,10 @@ describe('Drawing board tree Service', () => { new TreeNodeContextMenuModel('upgrade', 'context-menu-upgrade', 'Upgrade', 'upgrade'), new TreeNodeContextMenuModel('undoDelete', 'context-menu-undoDelete', 'Undo Delete', 'undo-delete'), new TreeNodeContextMenuModel('undoUpgrade', 'context-menu-undoUpgrade', 'Undo Upgrade', 'undo-delete'), - new TreeNodeContextMenuModel('changeAssociations', 'context-menu-changeAssociations', 'Change Associations', 'edit-file-o') + new TreeNodeContextMenuModel('changeAssociations', 'context-menu-changeAssociations', 'Change Associations', 'edit-file-o'), + new TreeNodeContextMenuModel('pauseInstantiation', 'context-menu-pause', 'Add pause upon completion', 'pause-upon-completion') ]; - expect(options.length).toEqual(10); + expect(options.length).toEqual(11); expect(options).toEqual(expected); }); diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-tree/drawing-board-tree.service.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-tree/drawing-board-tree.service.ts index dfd89ca79..3fc5c531c 100644 --- a/vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-tree/drawing-board-tree.service.ts +++ b/vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-tree/drawing-board-tree.service.ts @@ -35,6 +35,10 @@ export class DrawingBoardTreeService { return FeatureFlagsService.getFlagState(Features.FLAG_1902_NEW_VIEW_EDIT, this.store); } + isPauseVFMInstantiationCreationFlagTrue() { + return FeatureFlagsService.getFlagState(Features.FLAG_2006_PAUSE_VFMODULE_INSTANTIATION_CREATION, this.store); + } + /********************************************** return all drawing board context menu options ***********************************************/ @@ -49,7 +53,8 @@ export class DrawingBoardTreeService { new TreeNodeContextMenuModel('upgrade', 'context-menu-upgrade', 'Upgrade', 'upgrade'), new TreeNodeContextMenuModel('undoDelete', 'context-menu-undoDelete', 'Undo Delete', 'undo-delete'), new TreeNodeContextMenuModel('undoUpgrade', 'context-menu-undoUpgrade', 'Undo Upgrade', 'undo-delete'), - new TreeNodeContextMenuModel('changeAssociations', 'context-menu-changeAssociations', 'Change Associations', 'edit-file-o') + new TreeNodeContextMenuModel('changeAssociations', 'context-menu-changeAssociations', 'Change Associations', 'edit-file-o'), + new TreeNodeContextMenuModel('pauseInstantiation', 'context-menu-pause', 'Add pause upon completion', 'pause-upon-completion') ]; } 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<T> { 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(<any>vfModuleInstance, <any>currentModel, <any>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(<any>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 * ****************************************************/ diff --git a/vid-webpack-master/src/app/shared/models/treeNodeModel.ts b/vid-webpack-master/src/app/shared/models/treeNodeModel.ts index d25850dbb..a6c933ac0 100644 --- a/vid-webpack-master/src/app/shared/models/treeNodeModel.ts +++ b/vid-webpack-master/src/app/shared/models/treeNodeModel.ts @@ -2,7 +2,7 @@ import {ChildNodeInstance} from "./nodeInstance"; import {NodeModel} from "./nodeModel"; import {ServiceNodeTypes} from "./ServiceNodeTypes"; import * as _ from 'lodash'; -import {ServiceInstanceActions} from "./serviceInstanceActions"; +import {PauseStatus, ServiceInstanceActions} from "./serviceInstanceActions"; import {ModelInfo} from "./modelInfo"; export enum TreeLevel { @@ -34,6 +34,7 @@ export class TreeNodeModel { instanceId?: string; instanceType?: string; instanceName?: string; + pauseInstantiation?: PauseStatus; constructor(instance: ChildNodeInstance, nodeModel: NodeModel){ diff --git a/vid-webpack-master/src/app/shared/services/featureFlag/feature-flags.service.ts b/vid-webpack-master/src/app/shared/services/featureFlag/feature-flags.service.ts index 0ab175808..50840d194 100644 --- a/vid-webpack-master/src/app/shared/services/featureFlag/feature-flags.service.ts +++ b/vid-webpack-master/src/app/shared/services/featureFlag/feature-flags.service.ts @@ -22,7 +22,7 @@ export enum Features { FLAG_2006_VFMODULE_TAKES_TENANT_AND_REGION_FROM_VNF = 'FLAG_2006_VFMODULE_TAKES_TENANT_AND_REGION_FROM_VNF', FLAG_2006_VNF_LOB_MULTI_SELECT= 'FLAG_2006_VNF_LOB_MULTI_SELECT', FLAG_2006_NEW_VIEW_EDIT_BUTTON_IN_INSTANTIATION_STATUS= 'FLAG_2006_NEW_VIEW_EDIT_BUTTON_IN_INSTANTIATION_STATUS', - FLAG_2006_PAUSE_VFMODULE_INSTANTIATION_CREATION= 'FLAG_2006_PAUSE_VFMODULE_INSTANTIATION_CREATION', + FLAG_2006_PAUSE_VFMODULE_INSTANTIATION_CREATION = 'FLAG_2006_PAUSE_VFMODULE_INSTANTIATION_CREATION', } @Injectable() |