diff options
author | ys9693 <ys9693@att.com> | 2020-01-19 13:50:02 +0200 |
---|---|---|
committer | Ofir Sonsino <ofir.sonsino@intl.att.com> | 2020-01-22 12:33:31 +0000 |
commit | 16a9fce0e104a38371a9e5a567ec611ae3fc7f33 (patch) | |
tree | 03a2aff3060ddb5bc26a90115805a04becbaffc9 /catalog-ui/src/app/models/graph/zones | |
parent | aa83a2da4f911c3ac89318b8e9e8403b072942e1 (diff) |
Catalog alignment
Issue-ID: SDC-2724
Signed-off-by: ys9693 <ys9693@att.com>
Change-Id: I52b4aacb58cbd432ca0e1ff7ff1f7dd52099c6fe
Diffstat (limited to 'catalog-ui/src/app/models/graph/zones')
3 files changed, 41 insertions, 39 deletions
diff --git a/catalog-ui/src/app/models/graph/zones/group-instance.ts b/catalog-ui/src/app/models/graph/zones/group-instance.ts index 92d850b894..4001b94df3 100644 --- a/catalog-ui/src/app/models/graph/zones/group-instance.ts +++ b/catalog-ui/src/app/models/graph/zones/group-instance.ts @@ -27,24 +27,24 @@ export class GroupInstance { public originArchived?:boolean; - constructor(group:GroupInstance) { - - this.name = group.name; - this.groupUUID = group.groupUUID; - this.invariantUUID = group.invariantUUID; - this.propertyValueCounter = group.propertyValueCounter; - this.type = group.type; - this.typeUid = group.typeUid; - this.uniqueId = group.uniqueId; - this.version = group.version; - this.artifacts = group.artifacts; - this.artifactsUuid = group.artifactsUuid; - this.properties = CommonUtils.initProperties(group.properties); - this.members = _.values(group.members); - this.description = group.description; - this.empty = group.empty; - this.ownerId = group.ownerId; - + constructor(group?:GroupInstance) { + if (group) { + this.name = group.name; + this.groupUUID = group.groupUUID; + this.invariantUUID = group.invariantUUID; + this.propertyValueCounter = group.propertyValueCounter; + this.type = group.type; + this.typeUid = group.typeUid; + this.uniqueId = group.uniqueId; + this.version = group.version; + this.artifacts = group.artifacts; + this.artifactsUuid = group.artifactsUuid; + this.properties = CommonUtils.initProperties(group.properties); + this.members = _.values(group.members); + this.description = group.description; + this.empty = group.empty; + this.ownerId = group.ownerId; + } this.iconSprite = ''; this.icon = 'icon-group'; } diff --git a/catalog-ui/src/app/models/graph/zones/policy-instance.ts b/catalog-ui/src/app/models/graph/zones/policy-instance.ts index cef1705a41..9dd2d5f212 100644 --- a/catalog-ui/src/app/models/graph/zones/policy-instance.ts +++ b/catalog-ui/src/app/models/graph/zones/policy-instance.ts @@ -5,6 +5,7 @@ import {GroupInstance} from "./group-instance"; import {ComponentInstance} from "../../componentsInstances/componentInstance"; import {TargetUiObject} from "../../ui-models/ui-target-object"; import {TargetOrMemberType} from "../../../utils/constants"; +import * as _ from 'lodash'; /* The request and response should be same model, need to fix in BE */ export class PolicyTargetsMap { @@ -66,24 +67,25 @@ export class PolicyInstance implements IZoneInstanceMethod { constructor(policy?:PolicyInstance) { - this.componentName = policy.componentName; - this.description = policy.description; - this.empty = policy.empty; - this.invariantName = policy.invariantName; - this.invariantUUID = policy.invariantUUID; - this.isFromCsar = policy.isFromCsar; - - this.name = policy.name; - this.normalizedName =policy.normalizedName; - this.type = policy.type; - this.policyTypeUid = policy.policyTypeUid; - this.policyUUID = policy.policyUUID; - this.properties = CommonUtils.initProperties(policy.properties); - this.targets = policy.targets; - this.uniqueId = policy.uniqueId; - this.version = policy.version; - this.instanceUniqueId = policy.instanceUniqueId; - + if(policy){ + this.componentName = policy.componentName; + this.description = policy.description; + this.empty = policy.empty; + this.invariantName = policy.invariantName; + this.invariantUUID = policy.invariantUUID; + this.isFromCsar = policy.isFromCsar; + + this.name = policy.name; + this.normalizedName =policy.normalizedName; + this.type = policy.type; + this.policyTypeUid = policy.policyTypeUid; + this.policyUUID = policy.policyUUID; + this.properties = CommonUtils.initProperties(policy.properties); + this.targets = policy.targets; + this.uniqueId = policy.uniqueId; + this.version = policy.version; + this.instanceUniqueId = policy.instanceUniqueId; + } this.iconSprite = ''; this.icon = 'icon-policy'; } diff --git a/catalog-ui/src/app/models/graph/zones/zone-instance.ts b/catalog-ui/src/app/models/graph/zones/zone-instance.ts index fb8ec7761a..ee6473a20c 100644 --- a/catalog-ui/src/app/models/graph/zones/zone-instance.ts +++ b/catalog-ui/src/app/models/graph/zones/zone-instance.ts @@ -43,11 +43,11 @@ export class ZoneInstance { hidden:boolean; forceSave:Subject<Function>; - constructor(instance: PolicyInstance | GroupInstance, topologyTemplate:TopologyTemplate) { + constructor(instance: PolicyInstance | GroupInstance, topologyTemplateType: string, topologyTemplateId: string) { this.instanceData = instance; - this.parentComponentType = topologyTemplate.componentType; - this.parentComponentID = topologyTemplate.uniqueId; + this.parentComponentType = topologyTemplateType; + this.parentComponentID = topologyTemplateId; if (instance instanceof PolicyInstance) { this.type = ZoneInstanceType.POLICY; |