aboutsummaryrefslogtreecommitdiffstats
path: root/vid-webpack-master/src
diff options
context:
space:
mode:
authorIttay Stern <ittay.stern@att.com>2020-01-29 18:20:23 +0200
committerIttay Stern <ittay.stern@att.com>2020-02-02 12:54:38 +0200
commit74e6271d3c9a5f0f2f471c607ca7bc9b8f3d5fc0 (patch)
treec4cd63d23007d8b3d66939146db43fd95b3220f7 /vid-webpack-master/src
parentaefc6a0e43b8ce36134dbbed71cf2b4cb9745a9f (diff)
originalName fallbacks to customizationId or invariantId
Issue-ID: VID-724 Change-Id: I3db8d09cabfb700dc1acd469d6fb8acb4764cd73 Signed-off-by: Ittay Stern <ittay.stern@att.com>
Diffstat (limited to 'vid-webpack-master/src')
-rw-r--r--vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/collectionResource/collectionResource.model.info.ts4
-rw-r--r--vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/configuration/configuration.model.info.ts2
-rw-r--r--vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/network/network.model.info.ts4
-rw-r--r--vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/pnf/pnf.model.info.ts4
-rw-r--r--vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/relatedVnfMember/relatedVnfMember.info.model.ts4
-rw-r--r--vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vfModule/vfModule.model.info.ts2
-rw-r--r--vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vnf/vnf.model.info.ts5
-rw-r--r--vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vnfGrouping/vnfGrouping.model.info.ts4
-rw-r--r--vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vrf/vrf.model.info.ts4
-rw-r--r--vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/shared.tree.service.spec.ts4
-rw-r--r--vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/shared.tree.service.ts32
-rw-r--r--vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/vfModuleGenerator/vfModule.control.generator.ts4
12 files changed, 44 insertions, 29 deletions
diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/collectionResource/collectionResource.model.info.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/collectionResource/collectionResource.model.info.ts
index c469be501..c9c718f44 100644
--- a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/collectionResource/collectionResource.model.info.ts
+++ b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/collectionResource/collectionResource.model.info.ts
@@ -29,8 +29,8 @@ export class CollectionResourceModelInfo implements ILevelNodeInfo{
updateDynamicInputsDataFromModel = (currentModel): any => [];
getModel = (collectionResourceModelId: string, instance: CollectionResourceInstance, serviceHierarchy): CollectionResourceModel => {
- const originalModelName = instance.originalName ? instance.originalName : collectionResourceModelId;
- return new CollectionResourceModel(this._sharedTreeService.modelByIdentifier(serviceHierarchy, this.name, originalModelName));
+ const uniqueIdOrName = this._sharedTreeService.modelUniqueNameOrId(instance);
+ return new CollectionResourceModel(this._sharedTreeService.modelByIdentifiers(serviceHierarchy, this.name, uniqueIdOrName, collectionResourceModelId));
};
diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/configuration/configuration.model.info.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/configuration/configuration.model.info.ts
index f7b7df75c..31c44390d 100644
--- a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/configuration/configuration.model.info.ts
+++ b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/configuration/configuration.model.info.ts
@@ -31,7 +31,7 @@ export class ConfigurationModelInfo implements ILevelNodeInfo{
* @param serviceHierarchy - serviceHierarchy
************************************************************/
getModel = (configurationModelId : string, serviceHierarchy) : any =>{
- const model = this._sharedTreeService.modelByIdentifier(serviceHierarchy, this.name, configurationModelId);
+ const model = this._sharedTreeService.modelByIdentifiers(serviceHierarchy, this.name, configurationModelId);
if (!_.isNil(model)) {
return model;
}
diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/network/network.model.info.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/network/network.model.info.ts
index 7979b5af4..ae28fc2d9 100644
--- a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/network/network.model.info.ts
+++ b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/network/network.model.info.ts
@@ -71,9 +71,9 @@ export class NetworkModelInfo implements ILevelNodeInfo {
* @param serviceHierarchy - serviceHierarchy
************************************************************/
getModel = (networkModelId: string, instance: NetworkInstance, serviceHierarchy): NetworkModel => {
- const originalModelName = instance.originalName ? instance.originalName : networkModelId;
+ const uniqueIdOrName = this._sharedTreeService.modelUniqueNameOrId(instance);
return new NetworkModel(
- this._sharedTreeService.modelByIdentifier(serviceHierarchy, this.name, originalModelName),
+ this._sharedTreeService.modelByIdentifiers(serviceHierarchy, this.name, uniqueIdOrName, networkModelId),
this._featureFlagsService.getAllFlags());
};
diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/pnf/pnf.model.info.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/pnf/pnf.model.info.ts
index 6debcd6a5..b87551547 100644
--- a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/pnf/pnf.model.info.ts
+++ b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/pnf/pnf.model.info.ts
@@ -32,8 +32,8 @@ export class PnfModelInfo implements ILevelNodeInfo{
}
getModel = (pnfModelId: string, instance: PnfInstance, serviceHierarchy): PNFModel => {
- const originalModelName = instance.originalName ? instance.originalName : pnfModelId;
- return new PNFModel(this._sharedTreeService.modelByIdentifier(serviceHierarchy, this.name, originalModelName));
+ const uniqueIdOrName = this._sharedTreeService.modelUniqueNameOrId(instance);
+ return new PNFModel(this._sharedTreeService.modelByIdentifiers(serviceHierarchy, this.name, uniqueIdOrName, pnfModelId));
};
getNextLevelObject(): any { return null; }
diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/relatedVnfMember/relatedVnfMember.info.model.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/relatedVnfMember/relatedVnfMember.info.model.ts
index 20d1f5949..f31a3b2e8 100644
--- a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/relatedVnfMember/relatedVnfMember.info.model.ts
+++ b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/relatedVnfMember/relatedVnfMember.info.model.ts
@@ -54,8 +54,8 @@ export class RelatedVnfMemberInfoModel implements ILevelNodeInfo {
* @param serviceHierarchy - serviceHierarchy
************************************************************/
getModel = (vnfModelId: string, instance: VnfInstance, serviceHierarchy): VNFModel => {
- const originalModelName = instance.originalName ? instance.originalName : vnfModelId;
- return new VNFModel(this._sharedTreeService.modelByIdentifier(serviceHierarchy, this.name, originalModelName));
+ const uniqueIdOrName = this._sharedTreeService.modelUniqueNameOrId(instance);
+ return new VNFModel(this._sharedTreeService.modelByIdentifiers(serviceHierarchy, this.name, uniqueIdOrName, vnfModelId));
};
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 9886176be..dcc6a29f8 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
@@ -79,7 +79,7 @@ export class VFModuleModelInfo implements ILevelNodeInfo {
* @param serviceHierarchy - serviceHierarchy
************************************************************/
getModel = (vfModuleModelId: string, instance, serviceHierarchy): Partial<VfModule> => {
- const model = this._sharedTreeService.modelByIdentifier(serviceHierarchy, this.name, vfModuleModelId);
+ const model = this._sharedTreeService.modelByIdentifiers(serviceHierarchy, this.name, vfModuleModelId);
if (!_.isNil(model)) {
return new VfModule(model, this._featureFlagsService.getAllFlags());
}
diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vnf/vnf.model.info.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vnf/vnf.model.info.ts
index 950e3628c..b2b7b43e2 100644
--- a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vnf/vnf.model.info.ts
+++ b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vnf/vnf.model.info.ts
@@ -88,13 +88,12 @@ export class VnfModelInfo implements ILevelNodeInfo {
* @param serviceHierarchy - serviceHierarchy
************************************************************/
getModel = (vnfModelId: string, instance: VnfInstance, serviceHierarchy): VNFModel => {
- const originalModelName = instance.originalName ? instance.originalName : vnfModelId;
+ const uniqueIdOrName = this._sharedTreeService.modelUniqueNameOrId(instance);
return new VNFModel(
- this._sharedTreeService.modelByIdentifier(serviceHierarchy, this.name, originalModelName),
+ this._sharedTreeService.modelByIdentifiers(serviceHierarchy, this.name, uniqueIdOrName, vnfModelId),
this._featureFlagsService.getAllFlags());
};
-
/***********************************************************
* return vnf instance tree node
* @param instance - vnf instance
diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vnfGrouping/vnfGrouping.model.info.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vnfGrouping/vnfGrouping.model.info.ts
index 2447a063c..d89f307d9 100644
--- a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vnfGrouping/vnfGrouping.model.info.ts
+++ b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vnfGrouping/vnfGrouping.model.info.ts
@@ -96,8 +96,8 @@ export class VnfGroupingModelInfo implements ILevelNodeInfo {
}
getModel(modelId: string, instance: any, serviceHierarchy): any {
- const originalModelName = instance.originalName ? instance.originalName : modelId;
- return new VnfGroupModel(this._sharedTreeService.modelByIdentifier(serviceHierarchy, this.name, originalModelName));
+ const uniqueIdOrName = this._sharedTreeService.modelUniqueNameOrId(instance);
+ return new VnfGroupModel(this._sharedTreeService.modelByIdentifiers(serviceHierarchy, this.name, uniqueIdOrName, modelId));
}
hasMissingData(instance, dynamicInputs: any, isEcompGeneratedNaming: boolean): boolean {
diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vrf/vrf.model.info.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vrf/vrf.model.info.ts
index dacde73f8..7b7437c5e 100644
--- a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vrf/vrf.model.info.ts
+++ b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vrf/vrf.model.info.ts
@@ -51,8 +51,8 @@ export class VrfModelInfo implements ILevelNodeInfo {
updateDynamicInputsDataFromModel = (currentModel): any => [];
getModel = (vrfModelId: string, instance: VrfInstance, serviceHierarchy): VrfModel => {
- const originalModelName = instance.originalName ? instance.originalName : vrfModelId;
- return new VrfModel(this._sharedTreeService.modelByIdentifier(serviceHierarchy, this.name, originalModelName));
+ const uniqueIdOrName = this._sharedTreeService.modelUniqueNameOrId(instance);
+ return new VrfModel(this._sharedTreeService.modelByIdentifiers(serviceHierarchy, this.name, uniqueIdOrName, vrfModelId));
};
diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/shared.tree.service.spec.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/shared.tree.service.spec.ts
index d7697d61b..b4c58364b 100644
--- a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/shared.tree.service.spec.ts
+++ b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/shared.tree.service.spec.ts
@@ -179,7 +179,7 @@ describe('Shared Tree Service', () => {
let serviceModelFromHierarchy =
getStore().service.serviceHierarchy["1a80c596-27e5-4ca9-b5bb-e03a7fd4c0fd"];
- expect(service.modelByIdentifier(serviceModelFromHierarchy, modelTypeName, modelUniqueIdOrName))
+ expect(service.modelByIdentifiers(serviceModelFromHierarchy, modelTypeName, modelUniqueIdOrName))
.toHaveProperty("modelCustomizationName", expectedModelCustomizationName);
});
@@ -192,7 +192,7 @@ describe('Shared Tree Service', () => {
let serviceModelFromHierarchy =
getStore().service.serviceHierarchy["1a80c596-27e5-4ca9-b5bb-e03a7fd4c0fd"];
- expect(service.modelByIdentifier(serviceModelFromHierarchy, modelTypeName, modelUniqueIdOrName))
+ expect(service.modelByIdentifiers(serviceModelFromHierarchy, modelTypeName, modelUniqueIdOrName))
.toBeUndefined();
});
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 669f9b675..d60bbd3c9 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
@@ -54,23 +54,39 @@ export class SharedTreeService {
: (nodeInstance.modelInfo.modelCustomizationId || nodeInstance.modelInfo.modelInvariantId);
};
+ modelUniqueNameOrId = (instance): string =>
+ instance.originalName ? instance.originalName : this.modelUniqueId(instance);
+
/**
* Finds a model inside a full service model
* @param serviceModelFromHierarchy
* @param modelTypeName "vnfs" | "networks" | "vfModules" | "collectionResources" | ...
- * @param modelUniqueIdOrName Either an entry name (i.e. "originalName"), modelCustomizationId or modelInvariantId.
+ * @param modelUniqueNameOrId Either an entry name (i.e. "originalName"), modelCustomizationId or modelInvariantId.
* Note that modelInvariantId will work only where model lacks a modelCustomizationId.
+ * @param modeName An optional entry name (i.e. "originalName"); will not try to use as id
*/
- modelByIdentifier = (serviceModelFromHierarchy, modelTypeName: string, modelUniqueIdOrName: string): any => {
- if (_.isNil(serviceModelFromHierarchy)) return undefined;
+ modelByIdentifiers = (serviceModelFromHierarchy, modelTypeName: string, modelUniqueNameOrId: string, modeName?: string): any => {
+ const logErrorAndReturnUndefined = () =>
+ console.info(`modelByIdentifiers: could not find a model matching query`, {
+ modelTypeName, modelUniqueNameOrId, modeName, serviceModelFromHierarchy
+ });
+
+ if (_.isNil(serviceModelFromHierarchy)) return logErrorAndReturnUndefined();
const modelsOfType = serviceModelFromHierarchy[modelTypeName];
- if (_.isNil(modelsOfType)) return undefined;
+ if (_.isNil(modelsOfType)) return logErrorAndReturnUndefined();
+
+ const modelIfModelIdentifierIsEntryName = modelsOfType[modelUniqueNameOrId];
+ const modelIfModeNameExists = _.isNil(modeName) ? null : modelsOfType[modeName];
- const modelIfModelIdentifierIsEntryName = modelsOfType[modelUniqueIdOrName];
- return _.isNil(modelIfModelIdentifierIsEntryName)
- ? _.find(modelsOfType, o => (o.customizationUuid || o.invariantUuid) === modelUniqueIdOrName)
- : modelIfModelIdentifierIsEntryName;
+ if (!_.isNil(modelIfModelIdentifierIsEntryName)) {
+ return modelIfModelIdentifierIsEntryName;
+ } else if (!_.isNil(modelIfModeNameExists)) {
+ return modelIfModeNameExists;
+ } else {
+ // try modelUniqueNameOrId as an id
+ return _.find(modelsOfType, o => (o.customizationUuid || o.invariantUuid) === modelUniqueNameOrId) || logErrorAndReturnUndefined()
+ }
};
hasMissingData(instance, dynamicInputs: any, isEcompGeneratedNaming: boolean, requiredFields: string[]): boolean {
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 5189af0d6..702181581 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
@@ -94,10 +94,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);
}