when there is no max instances for VfModule show Unlimited (default) in model info 40/99640/1
authorEylon Malin <eylon.malin@intl.att.com>
Sun, 15 Dec 2019 06:14:03 +0000 (08:14 +0200)
committerEylon Malin <eylon.malin@intl.att.com>
Sun, 15 Dec 2019 06:14:03 +0000 (08:14 +0200)
Issue-ID: VID-726
Signed-off-by: Eylon Malin <eylon.malin@intl.att.com>
Change-Id: I3718c0f89204d5272872dca18f3e953e05a94dfe

vid-webpack-master/cypress/integration/iFrames/drawingBoard.e2e.ts
vid-webpack-master/cypress/integration/iFrames/vnf.popup.e2e.ts
vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/basic.popup.service.spec.ts
vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/basic.popup.service.ts
vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/vfModule/vfModule.popuop.service.ts
vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/vnf/vnf.popup.service.spec.ts
vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/vnf/vnf.popup.service.ts

index 133dbe7..4eb5445 100644 (file)
@@ -257,6 +257,12 @@ describe('Drawing board', function () {
       cy.addMacroVfModule(vnfName, vfModuleName, 'module-3');
       cy.getElementByDataTestsId('node-d6557200-ecf2-4641-8094-5393ae3aae60-VF_vGeraldine 0').click();
       cy.getElementByDataTestsId('node-41708296-e443-4c71-953f-d9a010f059e1-vf_vgeraldine0..VfVgeraldine..vflorence_gpb..module-2').should('have.length', 3);
+
+      //make sure max instances in model info show Unlimited (default)
+      cy.drawingBoardTreeOpenContextMenuByElementDataTestId('node-41708296-e443-4c71-953f-d9a010f059e1-vf_vgeraldine0..VfVgeraldine..vflorence_gpb..module-2', 0)
+        .drawingBoardTreeClickOnContextMenuOptionByName('Edit')
+        .getElementByDataTestsId('model-item-value-max').contains('Unlimited (default)')
+        .getElementByDataTestsId("cancelButton").click();
     });
 
     it('when there is no max_instances for VNF, it can be added multiple times ', () => {
index 41ab833..74ce2a7 100644 (file)
@@ -49,10 +49,10 @@ describe('Vnf popup', function () {
         cy.setReduxState(<any>res);
         cy.openIframe('app/ui/#/servicePlanning?serviceModelId=2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd');
         cy.getElementByDataTestsId('node-2017-488_PASQUALE-vPE 0-add-btn').click({force : true});
-        cy.getElementByDataTestsId('model-item-label-vnf-min').contains('Minimum to instantiate');
-        cy.getElementByDataTestsId('model-item-value-vnf-min').contains('100');
-        cy.getElementByDataTestsId('model-item-label-vnf-max').contains('Maximum to instantiate');
-        cy.getElementByDataTestsId('model-item-value-vnf-max').contains('200');
+        cy.getElementByDataTestsId('model-item-label-min').contains('Minimum to instantiate');
+        cy.getElementByDataTestsId('model-item-value-min').contains('100');
+        cy.getElementByDataTestsId('model-item-label-max').contains('Maximum to instantiate');
+        cy.getElementByDataTestsId('model-item-value-max').contains('200');
       })
     });
 
@@ -63,10 +63,10 @@ describe('Vnf popup', function () {
         cy.setReduxState(<any>res);
         cy.openIframe('app/ui/#/servicePlanning?serviceModelId=2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd');
         cy.getElementByDataTestsId('node-2017-488_PASQUALE-vPE 0-add-btn').click({force : true});
-        cy.getElementByDataTestsId('model-item-label-vnf-min').contains('Minimum to instantiate');
-        cy.getElementByDataTestsId('model-item-value-vnf-min').contains('0');
-        cy.getElementByDataTestsId('model-item-label-vnf-max').contains('Maximum to instantiate');
-        cy.getElementByDataTestsId('model-item-value-vnf-max').contains('Unlimited (default)');
+        cy.getElementByDataTestsId('model-item-label-min').contains('Minimum to instantiate');
+        cy.getElementByDataTestsId('model-item-value-min').contains('0');
+        cy.getElementByDataTestsId('model-item-label-max').contains('Maximum to instantiate');
+        cy.getElementByDataTestsId('model-item-value-max').contains('Unlimited (default)');
       })
      });
 
index a3c8326..ebabc89 100644 (file)
@@ -2032,4 +2032,8 @@ describe('Basic popup service', () => {
     }, 'modelType', 'modelName');
     expect(result).toBeUndefined();
   });
+
+  test('when there is no max instances in model , shell return maximum item with Unlimited text', () =>{
+    expect(service.createMaximumToInstantiateModelInformationItem({}).values[0]).toEqual('Unlimited (default)');
+  });
 });
index 1d44a9e..f8b40dd 100644 (file)
@@ -11,6 +11,8 @@ import {VfModule} from "../../../models/vfModule";
 import {VNFModel} from "../../../models/vnfModel";
 import {VnfGroupModel} from "../../../models/vnfGroupModel";
 import {FeatureFlagsService} from "../../../services/featureFlag/feature-flags.service";
+import {ModelInformationItem} from "../../model-information/model-information.component";
+import {Constants} from "../../../utils/constants";
 
 @Injectable()
 export class BasicPopupService {
@@ -53,4 +55,14 @@ export class BasicPopupService {
     let dynamic = this._defaultDataGeneratorService.getArbitraryInputs(this._store.getState().service.serviceHierarchy[serviceId][type][modelName].inputs);
       return this._basicControlGenerator.getDynamicInputsByType(dynamic, serviceId, storeKey, type );
   }
+
+  createMaximumToInstantiateModelInformationItem(model): ModelInformationItem {
+    return new ModelInformationItem(
+      "Maximum to instantiate",
+      "max",
+      [!_.isNil(model.max) ? model.max.toString() : Constants.ModelInfo.UNLIMITED_DEFAULT],
+      "",
+      true
+    );
+  }
 }
index 20336e5..3119cc8 100644 (file)
@@ -81,7 +81,7 @@ export abstract class VfModulePopupServiceBase {
         new ModelInformationItem("Service type", "serviceType", [this.serviceModel.serviceType]),
         new ModelInformationItem("Service role", "serviceRole", [this.serviceModel.serviceRole]),
         new ModelInformationItem("Minimum to instantiate", "min", this.model.min == undefined ? ['0'] : [this.model.min.toString()], "", true),
-        new ModelInformationItem("Maximum to instantiate", "max", this.model.max == undefined ? ['1'] : [this.model.max.toString()], "", true),
+        this._basicPopupService.createMaximumToInstantiateModelInformationItem(this.model),
         new ModelInformationItem("Recommended to instantiate", "initial", [this.model.initial])
       ];
     });
index c4317f2..2f19044 100644 (file)
@@ -2334,10 +2334,6 @@ describe('vnf new popup service', () => {
     expect(service.modelInformations[13].values).toEqual(['5']);
   });
 
-  test('when there is no max instances in model , shell return maximum item with Unlimited text', () =>{
-    expect(service.createMaximumToInstantiateModelInformationItem({}).values[0]).toEqual('Unlimited (default)');
-  });
-
   test('getSubLeftTitle new vnf popup should return service model name', () => {
     service.uuidData = {
       serviceId: '6e59c5de-f052-46fa-aa7e-2fca9d674c44',
index 2836032..3e117ca 100644 (file)
@@ -96,22 +96,12 @@ export class VnfPopupService implements GenericPopupInterface{
         new ModelInformationItem("Invariant UUID", "invariantUuid", [this.model.invariantUuid], Constants.ServicePopup.TOOLTIP_INVARIANT_UUID, true),
         new ModelInformationItem("Service type", "serviceType", [this.serviceModel.serviceType]),
         new ModelInformationItem("Service role", "serviceRole", [this.serviceModel.serviceRole]),
-        new ModelInformationItem("Minimum to instantiate", "vnf-min", [!_.isNil(this.model.min) ? this.model.min.toString() : '0'], "", false),
-        (this.createMaximumToInstantiateModelInformationItem(this.model))
+        new ModelInformationItem("Minimum to instantiate", "min", [!_.isNil(this.model.min) ? this.model.min.toString() : '0'], "", false),
+        this._basicPopupService.createMaximumToInstantiateModelInformationItem(this.model)
         ];
     })
   }
 
-  createMaximumToInstantiateModelInformationItem(model) {
-    return new ModelInformationItem(
-      "Maximum to instantiate",
-      "vnf-max",
-      [!_.isNil(model.max) ? model.max.toString() : Constants.ModelInfo.UNLIMITED_DEFAULT],
-      "",
-      false
-    );
-  }
-
   getSubLeftTitle(): string {
     return "VNF MODEL: " + this._store.getState().service.serviceHierarchy[this.uuidData['serviceId']].vnfs[this.uuidData['modelName']].name;
   }