diff options
author | Eylon Malin <eylon.malin@intl.att.com> | 2020-01-22 07:40:29 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2020-01-22 07:40:29 +0000 |
commit | a0b4be90caf6bb3e6deed0002b42c8c5e9c1f8a8 (patch) | |
tree | 58d09db963c0097558cfaeab0274dcd62a32b014 /vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/shared.tree.service.ts | |
parent | e7a285a3c9cf5afd1731e4220bde5b301227f106 (diff) | |
parent | 6b1e53d593a958254481f2043f6da8c6c96d4a0b (diff) |
Merge "originalName may be model's "entry name", customizationId or invariantId"
Diffstat (limited to 'vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/shared.tree.service.ts')
-rw-r--r-- | vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/shared.tree.service.ts | 19 |
1 files changed, 19 insertions, 0 deletions
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 1115d1bc6..6c985ec6a 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,6 +54,25 @@ export class SharedTreeService { : (nodeInstance.modelInfo.modelCustomizationId || nodeInstance.modelInfo.modelInvariantId); }; + /** + * 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. + * Note that modelInvariantId will work only where model lacks a modelCustomizationId. + */ + modelByIdentifier = (serviceModelFromHierarchy, modelTypeName: string, modelUniqueIdOrName: string): any => { + if (_.isNil(serviceModelFromHierarchy)) return undefined; + + const modelsOfType = serviceModelFromHierarchy[modelTypeName]; + if (_.isNil(modelsOfType)) return undefined; + + const modelIfModelIdentifierIsEntryName = modelsOfType[modelUniqueIdOrName]; + return _.isNil(modelIfModelIdentifierIsEntryName) + ? _.find(modelsOfType, o => (o.customizationUuid || o.invariantUuid) === modelUniqueIdOrName) + : modelIfModelIdentifierIsEntryName; + }; + hasMissingData(instance, dynamicInputs: any, isEcompGeneratedNaming: boolean, requiredFields: string[]): boolean { if (!isEcompGeneratedNaming && _.isEmpty(instance.instanceName)) { return true; |