Add Pause Functionality from Inside VF Module's Edit Dialog
[vid.git] / vid-webpack-master / src / app / shared / components / genericForm / formControlsServices / vfModuleGenerator / vfModule.control.generator.ts
index 5189af0..2deb5d9 100644 (file)
@@ -23,6 +23,8 @@ import {SharedControllersService} from "../sharedControlles/shared.controllers.s
 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',
@@ -47,7 +49,8 @@ export class VfModuleControlGenerator {
               private store: NgRedux<AppState>,
               private http: HttpClient,
               private _aaiService: AaiService,
-              private _logService: LogService) {
+              private _logService: LogService,
+              private _featureFlagsService:FeatureFlagsService) {
     this.aaiService = _aaiService;
   }
 
@@ -94,10 +97,10 @@ export class VfModuleControlGenerator {
   }
 
   private newVNFModel(serviceId: string, vnf: VnfInstance) {
-    const vnfModelName: string = vnf.originalName;
+    const vnfModelName: string = this._sharedTreeService.modelUniqueNameOrId(vnf);
 
     const serviceModelFromHierarchy = this.store.getState().service.serviceHierarchy[serviceId];
-    const model = this._sharedTreeService.modelByIdentifier(serviceModelFromHierarchy, "vnfs", vnfModelName);
+    const model = this._sharedTreeService.modelByIdentifiers(serviceModelFromHierarchy, "vnfs", vnfModelName);
     return new VNFModel(model);
   }
 
@@ -120,15 +123,21 @@ 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);
-    result.push(this._sharedControllersService.getLcpRegionControl(serviceId, vfModuleInstance, result));
-    result.push(this._sharedControllersService.getLegacyRegion(vfModuleInstance));
-    result.push(this._sharedControllersService.getTenantControl(serviceId, vfModuleInstance));
+    if( !this._featureFlagsService.getFlagState(Features.FLAG_2006_VFMODULE_TAKES_TENANT_AND_REGION_FROM_VNF)) {
+      result.push(this._sharedControllersService.getLcpRegionControl(serviceId, vfModuleInstance, result));
+      result.push(this._sharedControllersService.getLegacyRegion(vfModuleInstance));
+      result.push(this._sharedControllersService.getTenantControl(serviceId, vfModuleInstance));
+    }
     result.push(this._sharedControllersService.getRollbackOnFailureControl(vfModuleInstance));
-    result.push(this._sharedControllersService.getSDNCControl(vfModuleInstance, this.getSdncExtraContents()));
+    result.push(this._sharedControllersService.getSDNCControl(vfModuleInstance, false, this.getSdncExtraContents()));
+
+    if(this._featureFlagsService.getFlagState(Features.FLAG_2008_PAUSE_INSTANTIATION_ON_VFMODULE_POPUP)){
+      console.log(Features.FLAG_2008_PAUSE_INSTANTIATION_ON_VFMODULE_POPUP);
+      result.push(this._sharedControllersService.getPauseInstantiation(vfModuleInstance));
+    }
     if (this.store.getState().global.flags['FLAG_SUPPLEMENTARY_FILE']) {
       result = this._basicControlGenerator.concatSupplementaryFile(result, vfModuleInstance);
     }