diff options
author | Ittay Stern <ittay.stern@att.com> | 2020-01-29 18:20:23 +0200 |
---|---|---|
committer | Ittay Stern <ittay.stern@att.com> | 2020-02-02 12:54:38 +0200 |
commit | 74e6271d3c9a5f0f2f471c607ca7bc9b8f3d5fc0 (patch) | |
tree | c4cd63d23007d8b3d66939146db43fd95b3220f7 /vid-webpack-master | |
parent | aefc6a0e43b8ce36134dbbed71cf2b4cb9745a9f (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')
14 files changed, 50 insertions, 35 deletions
diff --git a/vid-webpack-master/cypress/integration/iFrames/retry.e2e.ts b/vid-webpack-master/cypress/integration/iFrames/retry.e2e.ts index e544720a7..005babbc6 100644 --- a/vid-webpack-master/cypress/integration/iFrames/retry.e2e.ts +++ b/vid-webpack-master/cypress/integration/iFrames/retry.e2e.ts @@ -56,7 +56,7 @@ describe('Retry Page', function () { cy.openIframe(`app/ui/#/servicePlanning/RETRY_EDIT?serviceModelId=${SERVICE_MODEL_ID}&subscriberId=${SUBSCRIBER_ID}&serviceType=${SERVICE_TYPE}&serviceInstanceId=${SERVICE_INSTANCE_ID}&jobId=${JOB_ID}`); - cy.getElementByDataTestsId('node-69e09f68-8b63-4cc9-b9ff-860960b5db09-2017-488_PASQUALE-vPE 0').click(); + cy.getElementByDataTestsId('node-69e09f68-8b63-4cc9-b9ff-860960b5db09-2017-488_PASQUALE-vPE 0').eq(0).click(); cy.get('.failed-msg').should('have.length', 5); cy.get('.newIcon').should('have.length', 4); @@ -133,7 +133,7 @@ describe('Retry Page', function () { cy.openIframe(`app/ui/#/servicePlanning/RETRY?serviceModelId=${SERVICE_MODEL_ID}&subscriberId=${SUBSCRIBER_ID}&serviceType=${SERVICE_TYPE}&serviceInstanceId=${SERVICE_INSTANCE_ID}&jobId=${JOB_ID}`); - cy.getElementByDataTestsId('node-69e09f68-8b63-4cc9-b9ff-860960b5db09-2017-488_PASQUALE-vPE 0').click(); + cy.getElementByDataTestsId('node-69e09f68-8b63-4cc9-b9ff-860960b5db09-2017-488_PASQUALE-vPE 0').eq(0).click(); cy.get('.failed-msg').should('have.length', 4); cy.get('.newIcon').should('have.length', 4); diff --git a/vid-webpack-master/cypress/integration/iFrames/viewOnlyDrawingBoard.e2e.ts b/vid-webpack-master/cypress/integration/iFrames/viewOnlyDrawingBoard.e2e.ts index 60b2e123d..de5facf89 100644 --- a/vid-webpack-master/cypress/integration/iFrames/viewOnlyDrawingBoard.e2e.ts +++ b/vid-webpack-master/cypress/integration/iFrames/viewOnlyDrawingBoard.e2e.ts @@ -113,13 +113,13 @@ describe('View only drawing board', function () { cy.getElementByDataTestsId('node-2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_vRE_BV..module-1').find(`[data-tests-id='node-type-indicator']`).should('have.text', 'M'); //testing right side - cy.getElementByDataTestsId('node-69e09f68-8b63-4cc9-b9ff-860960b5db09-2017-488_PASQUALE-vPE 0').find(`[data-tests-id='node-type-indicator']`).should('have.text', 'VNF'); - cy.getElementByDataTestsId('node-69e09f68-8b63-4cc9-b9ff-860960b5db09-2017-488_PASQUALE-vPE 0').click({force: true}); + cy.getElementByDataTestsId('node-69e09f68-8b63-4cc9-b9ff-860960b5db09-2017-488_PASQUALE-vPE 0').find(`[data-tests-id='node-type-indicator']`).should('have.length', 3).and('have.text', 'VNFVNFVNF'); + cy.getElementByDataTestsId('node-69e09f68-8b63-4cc9-b9ff-860960b5db09-2017-488_PASQUALE-vPE 0').eq(0).click({force: true}); cy.getElementByDataTestsId('node-f8360508-3f17-4414-a2ed-6bc71161e8db-2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_base_vPE_BV..module-0').eq(0).find(`[data-tests-id='node-type-indicator']`).should('have.text', 'M'); //check vnf node tree sub header - cy.getElementByDataTestsId('node-69e09f68-8b63-4cc9-b9ff-860960b5db09-2017-488_PASQUALE-vPE 0').find("[data-tests-id='status-property-orchStatus']").should('have.text', 'Created'); - cy.getElementByDataTestsId('node-69e09f68-8b63-4cc9-b9ff-860960b5db09-2017-488_PASQUALE-vPE 0').find("[data-tests-id='status-property-provStatus']").should('have.text', ''); + cy.getElementByDataTestsId('node-69e09f68-8b63-4cc9-b9ff-860960b5db09-2017-488_PASQUALE-vPE 0').find("[data-tests-id='status-property-orchStatus']").eq(0).should('have.text', 'Created'); + cy.getElementByDataTestsId('node-69e09f68-8b63-4cc9-b9ff-860960b5db09-2017-488_PASQUALE-vPE 0').find("[data-tests-id='status-property-provStatus']").eq(0).should('have.text', ''); cy.getElementByDataTestsId('node-69e09f68-8b63-4cc9-b9ff-860960b5db09-2017-488_PASQUALE-vPE 0').find("[data-tests-id='status-property-inMaint']").should('not.exist'); //check vf Module node tree sub header 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); } |