Add Pause Functionality from Inside VF Module's Edit Dialog 24/110124/2
authorikram <ikram@research.att.com>
Sun, 12 Jul 2020 14:06:24 +0000 (10:06 -0400)
committerIttay Stern <ittay.stern@att.com>
Mon, 20 Jul 2020 06:53:18 +0000 (06:53 +0000)
Issue-ID: VID-858

Allow user to choose adding (and removing) Pause points from within the Edit Dialog of the VF Module. Currently, the support of adding is only from the vertical ellipsis menu. Also, there is currently no option of removing the pause point. This functionality will allow this to happen as well since inside the Edit dialog, the option is a checkbox which can now unchecked. Note: removing the pause point from within the vertical ellipse after being added will be covered in a separate user story. However, the desired functionality can still be reached using this commit as describe above.

Signed-off-by: ikram <ikram@research.att.com>
Change-Id: I90f9933ef445994d410c89e88f6d518a30ff3c60

vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/control.generator.util.service.ts
vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/sharedControlles/shared.controllers.service.ts
vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/vfModuleGenerator/vfModule.control.generator.spec.ts
vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/vfModuleGenerator/vfModule.control.generator.ts
vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/vfModule/vfModule.popup.service.ts

index 08575bc..bcbcefa 100644 (file)
@@ -24,6 +24,7 @@ import * as _ from 'lodash';
 
 export const SUPPLEMENTARY_FILE = 'supplementaryFile';
 export const SDN_C_PRE_LOAD = 'sdncPreLoad';
+export const PAUSE_INSTANTIATION = 'pauseInstantiation';
 
 @Injectable()
 export class ControlGeneratorUtil {
index b10ed9a..c238f90 100644 (file)
@@ -9,7 +9,7 @@ import {
 import {NgRedux} from "@angular-redux/store";
 import {AppState} from "../../../../store/reducers";
 import {AaiService} from "../../../../services/aaiService/aai.service";
-import {ControlGeneratorUtil, SDN_C_PRE_LOAD} from "../control.generator.util.service";
+import {ControlGeneratorUtil, PAUSE_INSTANTIATION, SDN_C_PRE_LOAD} from "../control.generator.util.service";
 import * as _ from "lodash";
 import {FormGroup} from "@angular/forms";
 import {Constants} from "../../../../utils/constants";
@@ -18,6 +18,7 @@ import {InputFormControl} from "../../../../models/formControlModels/inputFormCo
 import {NodeModel} from "../../../../models/nodeModel";
 import {MultiselectFormControl} from "../../../../models/formControlModels/multiselectFormControl.model";
 import {MultiSelectItem} from "../../../formControls/component/multiselect/multiselect.model";
+import {PauseStatus} from "../../../../models/serviceInstanceActions";
 
 @Injectable()
 export class SharedControllersService {
@@ -132,6 +133,15 @@ export class SharedControllersService {
     })
   };
 
+  getPauseInstantiation = (instance: any) : FormControlModel => {
+    return new CheckboxFormControl({
+      controlName: PAUSE_INSTANTIATION,
+      displayName: 'Pause upon Completion',
+      dataTestId: 'pauseInstantiation',
+      value: instance && instance.pauseInstantiation === PauseStatus.AFTER_COMPLETION
+    })
+  }
+
   getProductFamilyControl = (instance : any, controls : FormControlModel[], isMandatory?: boolean) : DropdownFormControl => {
     return new DropdownFormControl({
       type : FormControlType.DROPDOWN,
index 154c60f..bbfde30 100644 (file)
@@ -1080,8 +1080,8 @@ describe('VFModule Control Generator', () => {
   });
 
   each([
-    [true, 4, formControlsWithoutLcpRegionTenantLegacy],
-    [false, 7,formControlsWithLcpRegionTenantLegacy]
+    [true, 5, formControlsWithoutLcpRegionTenantLegacy],
+    [false, 8,formControlsWithLcpRegionTenantLegacy]
   ]).
   test('getAlaCarteFormControls should return the correct order of controls', (flag: boolean, controlAmount: number, orderedControls: string[]) => {
     when(mockFeatureFlagsService.getFlagState(Features.FLAG_2006_VFMODULE_TAKES_TENANT_AND_REGION_FROM_VNF)).thenReturn(flag);
index b7cf80b..8c6af89 100644 (file)
@@ -24,6 +24,7 @@ import {MessageModal} from "../../../messageModal/message-modal.service";
 import {ButtonType} from "../../../customModal/models/button.type";
 import {SharedTreeService} from "../../../../../drawingBoard/service-planning/objectsToTree/shared.tree.service";
 import {FeatureFlagsService, Features} from "../../../../services/featureFlag/feature-flags.service";
+import {PauseStatus} from "../../../../models/serviceInstanceActions";
 
 export enum FormControlNames {
   INSTANCE_NAME = 'instanceName',
@@ -122,7 +123,6 @@ export class VfModuleControlGenerator {
     }
     const vnf: VnfInstance = this.store.getState().service.serviceInstance[serviceId].vnfs[vnfStoreKey];
     const vnfModel = this.newVNFModel(serviceId, vnf);
-
     const vfModuleInstance = this._basicControlGenerator.retrieveInstanceIfUpdateMode(this.store, this.getVfModuleInstance(serviceId, vnfStoreKey, uuidData, isUpdateMode));
     let result: FormControlModel[] = [];
     this.pushInstanceAndVGToForm(result, vfModuleInstance, serviceId, vnfModel, true);
@@ -133,6 +133,7 @@ export class VfModuleControlGenerator {
     }
     result.push(this._sharedControllersService.getRollbackOnFailureControl(vfModuleInstance));
     result.push(this._sharedControllersService.getSDNCControl(vfModuleInstance, false, this.getSdncExtraContents()));
+    result.push(this._sharedControllersService.getPauseInstantiation(vfModuleInstance));
     if (this.store.getState().global.flags['FLAG_SUPPLEMENTARY_FILE']) {
       result = this._basicControlGenerator.concatSupplementaryFile(result, vfModuleInstance);
     }
index 6bf5934..70b23f2 100644 (file)
@@ -22,6 +22,7 @@ import * as _ from 'lodash';
 import {createVFModuleInstance, updateVFModuleInstance} from "../../../../storeUtil/utils/vfModule/vfModule.actions";
 import {SharedControllersService} from "../../../genericForm/formControlsServices/sharedControlles/shared.controllers.service";
 import {SharedTreeService} from "../../../../../drawingBoard/service-planning/objectsToTree/shared.tree.service";
+import {PauseStatus} from "../../../../models/serviceInstanceActions";
 
 export abstract class VfModulePopupServiceBase {
   dynamicInputs: any;
@@ -33,10 +34,11 @@ export abstract class VfModulePopupServiceBase {
   closeDialogEvent: Subject<any> = new Subject<any>();
   isUpdateMode: boolean;
   storeVFModule = (that, formValues: any): void => {
+    formValues.pauseInstantiation = (formValues.pauseInstantiation || formValues.pauseInstantiation === PauseStatus.AFTER_COMPLETION)
+      ? PauseStatus.AFTER_COMPLETION : null;
     formValues.modelInfo = new ModelInfo(that.model);
     formValues.uuid = formValues.modelInfo.uuid;
     formValues.isMissingData = false;
-
     if (!that.uuidData.vFModuleStoreKey) {
       this._store.dispatch(createVFModuleInstance(formValues, that.uuidData.modelName, that.uuidData.serviceId, 0, that.uuidData.vnfStoreKey));
     } else {
@@ -67,7 +69,6 @@ export abstract class VfModulePopupServiceBase {
   getModelInformation(serviceId: string, modelName: string, vfModuleModeNode:ITreeNode) {
     this._aaiService.getServiceModelById(serviceId).subscribe((result: any) => {
       this.serviceModel = new ServiceModel(result);
-
       this.model = this._basicPopupService.getModelFromResponse(result, 'vfModules', modelName);
       const serviceInstance = this._store.getState().service.serviceInstance[serviceId];
       this.modelInformations = [