summaryrefslogtreecommitdiffstats
path: root/vid-webpack-master/src/app/shared/components/genericForm
diff options
context:
space:
mode:
authorIttay Stern <ittay.stern@att.com>2020-01-21 12:20:37 +0200
committerIttay Stern <ittay.stern@att.com>2020-01-21 15:48:40 +0200
commit6b1e53d593a958254481f2043f6da8c6c96d4a0b (patch)
tree69f66ce6d3961c66fec2fc55618a426776715604 /vid-webpack-master/src/app/shared/components/genericForm
parentb96cada06214d609d32a38ca89d71cc53169324c (diff)
originalName may be model's "entry name", customizationId or invariantId
The classic originalName is the "entry name". So two more options were added through SharedTreeService::modelByIdentifier() function. Issue-ID: VID-724 Change-Id: I9f192d2b24c9c1659a95baabd21252bed392e9da Signed-off-by: Ittay Stern <ittay.stern@att.com>
Diffstat (limited to 'vid-webpack-master/src/app/shared/components/genericForm')
-rw-r--r--vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/vfModuleGenerator/vfModule.control.generator.spec.ts8
-rw-r--r--vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/vfModuleGenerator/vfModule.control.generator.ts16
2 files changed, 19 insertions, 5 deletions
diff --git a/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/vfModuleGenerator/vfModule.control.generator.spec.ts b/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/vfModuleGenerator/vfModule.control.generator.spec.ts
index f3d32b9bb..b3bb1fe54 100644
--- a/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/vfModuleGenerator/vfModule.control.generator.spec.ts
+++ b/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/vfModuleGenerator/vfModule.control.generator.spec.ts
@@ -6,12 +6,17 @@ import {AaiService} from "../../../../services/aaiService/aai.service";
import {GenericFormService} from "../../generic-form.service";
import {FormBuilder} from "@angular/forms";
import {LogService} from "../../../../utils/log/log.service";
-import {FormControlModel, ValidatorModel, ValidatorOptions} from "../../../../models/formControlModels/formControl.model";
+import {
+ FormControlModel,
+ ValidatorModel,
+ ValidatorOptions
+} from "../../../../models/formControlModels/formControl.model";
import {FormControlNames, VfModuleControlGenerator} from "./vfModule.control.generator";
import {FeatureFlagsService} from "../../../../services/featureFlag/feature-flags.service";
import {VfModuleInstance} from "../../../../models/vfModuleInstance";
import {VfModule} from "../../../../models/vfModule";
import {SharedControllersService} from "../sharedControlles/shared.controllers.service";
+import {SharedTreeService} from "../../../../../drawingBoard/service-planning/objectsToTree/shared.tree.service";
class MockAppStore<T> {
getState() {
@@ -925,6 +930,7 @@ describe('VFModule Control Generator', () => {
AaiService,
FormBuilder,
LogService,
+ SharedTreeService,
{provide:FeatureFlagsService, useClass: MockFeatureFlagsService},
{provide: NgRedux, useClass: MockAppStore}]
});
diff --git a/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/vfModuleGenerator/vfModule.control.generator.ts b/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/vfModuleGenerator/vfModule.control.generator.ts
index 60ffc3e96..b00312d5f 100644
--- a/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/vfModuleGenerator/vfModule.control.generator.ts
+++ b/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/vfModuleGenerator/vfModule.control.generator.ts
@@ -20,6 +20,7 @@ import {VNFModel} from "../../../../models/vnfModel";
import {VnfInstance} from "../../../../models/vnfInstance";
import * as _ from 'lodash';
import {SharedControllersService} from "../sharedControlles/shared.controllers.service";
+import {SharedTreeService} from "../../../../../drawingBoard/service-planning/objectsToTree/shared.tree.service";
export enum FormControlNames {
INSTANCE_NAME = 'instanceName',
@@ -40,6 +41,7 @@ export class VfModuleControlGenerator {
constructor(private genericFormService: GenericFormService,
private _basicControlGenerator: ControlGeneratorUtil,
private _sharedControllersService: SharedControllersService,
+ private _sharedTreeService: SharedTreeService,
private store: NgRedux<AppState>,
private http: HttpClient,
private _aaiService: AaiService,
@@ -76,8 +78,7 @@ export class VfModuleControlGenerator {
const vfModuleInstance = this._basicControlGenerator.retrieveInstanceIfUpdateMode(this.store, this.getVfModuleInstance(serviceId, vnfStoreKey, uuidData, isUpdateMode));
const vfModuleModel = this.vfModuleModel;
const vnf: VnfInstance = this.store.getState().service.serviceInstance[serviceId].vnfs[vnfStoreKey];
- const vnfModelName: string = vnf.originalName;
- const vnfModel = new VNFModel(this.store.getState().service.serviceHierarchy[serviceId].vnfs[vnfModelName]);
+ const vnfModel = this.newVNFModel(serviceId, vnf);
let result: FormControlModel[] = [];
@@ -90,6 +91,14 @@ export class VfModuleControlGenerator {
return result;
}
+ private newVNFModel(serviceId: string, vnf: VnfInstance) {
+ const vnfModelName: string = vnf.originalName;
+
+ const serviceModelFromHierarchy = this.store.getState().service.serviceHierarchy[serviceId];
+ const model = this._sharedTreeService.modelByIdentifier(serviceModelFromHierarchy, "vnfs", vnfModelName);
+ return new VNFModel(model);
+ }
+
pushInstanceAndVGToForm(result: FormControlModel[], vfModuleElement: any, serviceId: string, vnfModel: any, isALaCarte: boolean) :FormControlModel[]{
result.push(this.getInstanceName(vfModuleElement, serviceId, vnfModel.isEcompGeneratedNaming));
if (this.vfModuleModel.volumeGroupAllowed) {
@@ -108,8 +117,7 @@ export class VfModuleControlGenerator {
}
}
const vnf: VnfInstance = this.store.getState().service.serviceInstance[serviceId].vnfs[vnfStoreKey] ;
- const vnfModelName: string = vnf.originalName;
- const vnfModel = new VNFModel(this.store.getState().service.serviceHierarchy[serviceId].vnfs[vnfModelName]);
+ const vnfModel = this.newVNFModel(serviceId, vnf);
const vfModuleInstance = this._basicControlGenerator.retrieveInstanceIfUpdateMode(this.store, this.getVfModuleInstance(serviceId, vnfStoreKey, uuidData, isUpdateMode));
let result: FormControlModel[] = [];