summaryrefslogtreecommitdiffstats
path: root/catalog-ui/src/app/models/graph
diff options
context:
space:
mode:
authorys9693 <ys9693@att.com>2020-01-19 13:50:02 +0200
committerOfir Sonsino <ofir.sonsino@intl.att.com>2020-01-22 12:33:31 +0000
commit16a9fce0e104a38371a9e5a567ec611ae3fc7f33 (patch)
tree03a2aff3060ddb5bc26a90115805a04becbaffc9 /catalog-ui/src/app/models/graph
parentaa83a2da4f911c3ac89318b8e9e8403b072942e1 (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')
-rw-r--r--catalog-ui/src/app/models/graph/graph-links/links-factory.ts75
-rw-r--r--catalog-ui/src/app/models/graph/nodes/composition-graph-nodes/composition-ci-node-base.ts26
-rw-r--r--catalog-ui/src/app/models/graph/nodes/composition-graph-nodes/composition-ci-node-configuration.ts2
-rw-r--r--catalog-ui/src/app/models/graph/nodes/composition-graph-nodes/composition-ci-node-cp.ts2
-rw-r--r--catalog-ui/src/app/models/graph/nodes/composition-graph-nodes/composition-ci-node-service-proxy.ts8
-rw-r--r--catalog-ui/src/app/models/graph/nodes/composition-graph-nodes/composition-ci-node-service.ts2
-rw-r--r--catalog-ui/src/app/models/graph/nodes/composition-graph-nodes/composition-ci-node-ucpe-cp.ts2
-rw-r--r--catalog-ui/src/app/models/graph/nodes/composition-graph-nodes/composition-ci-node-ucpe.ts2
-rw-r--r--catalog-ui/src/app/models/graph/nodes/composition-graph-nodes/composition-ci-node-vf.ts2
-rw-r--r--catalog-ui/src/app/models/graph/nodes/composition-graph-nodes/composition-ci-node-vfc.ts2
-rw-r--r--catalog-ui/src/app/models/graph/nodes/composition-graph-nodes/composition-ci-node-vl.ts2
-rw-r--r--catalog-ui/src/app/models/graph/nodes/nodes-factory.ts8
-rw-r--r--catalog-ui/src/app/models/graph/relationship.ts7
-rw-r--r--catalog-ui/src/app/models/graph/zones/group-instance.ts36
-rw-r--r--catalog-ui/src/app/models/graph/zones/policy-instance.ts38
-rw-r--r--catalog-ui/src/app/models/graph/zones/zone-instance.ts6
16 files changed, 109 insertions, 111 deletions
diff --git a/catalog-ui/src/app/models/graph/graph-links/links-factory.ts b/catalog-ui/src/app/models/graph/graph-links/links-factory.ts
index cc037a7e22..d690eca02c 100644
--- a/catalog-ui/src/app/models/graph/graph-links/links-factory.ts
+++ b/catalog-ui/src/app/models/graph/graph-links/links-factory.ts
@@ -22,60 +22,49 @@
*/
'use strict';
import * as _ from "lodash";
-import {RelationshipModel, Relationship, CompositionCiLinkBase, CompositionCiNodeBase, LinkUcpeHost, CompositionCiUcpeLink,
- CompositionCiVlUcpeLink, CompositionCiSimpleLink, ModuleCiLinkBase, ModuleCiVlLink, CompositionCiVLink} from "../../../models";
+import {
+ RelationshipModel, Relationship, CompositionCiLinkBase, CompositionCiNodeBase, LinkUcpeHost, CompositionCiUcpeLink,
+ CompositionCiVlUcpeLink, CompositionCiSimpleLink, ModuleCiLinkBase, ModuleCiVlLink, CompositionCiVLink
+} from "app/models";
+import {Injectable} from "@angular/core";
+@Injectable()
export class LinksFactory {
- constructor() {
- }
-
- public createGraphLink = (cy:Cy.Instance, relation:RelationshipModel, singleRelation:Relationship):CompositionCiLinkBase => {
-
- let newRelation:CompositionCiLinkBase;
-
- // let fromNode:CompositionCiNodeBase = cy.getElementById(relation.fromNode).data();
- // let toNode:CompositionCiNodeBase = cy.getElementById(relation.toNode).data();
- //
- // if ((relation.fromNode && fromNode.isUcpePart) || (relation.toNode && toNode.isUcpePart )) { //Link from or to node inside ucpe
- //
- // if (singleRelation && singleRelation.relationship.type && singleRelation.relationship.type == 'tosca.relationships.HostedOn') {
- // newRelation = new LinkUcpeHost(relation, singleRelation);
- // } else if (singleRelation.relationship.type && _.includes(singleRelation.relationship.type.toLowerCase(), 'link')) {
- // newRelation = new CompositionCiVlUcpeLink(relation, fromNode.isUcpePart, singleRelation);
- // } else {
- // newRelation = new CompositionCiUcpeLink(relation, fromNode.isUcpePart, singleRelation);
- // }
- // } else
- if (singleRelation.relation.relationship.type && _.includes(singleRelation.relation.relationship.type.toLowerCase(), 'link')) {
- newRelation = new CompositionCiVLink(relation, singleRelation);
- } else {
- newRelation = new CompositionCiSimpleLink(relation, singleRelation);
+ constructor() {
}
- return newRelation;
- };
+ public createGraphLink = (cy:Cy.Instance, relation:RelationshipModel, singleRelation:Relationship):CompositionCiLinkBase => {
- public createUcpeHostLink = (relation:RelationshipModel):LinkUcpeHost => {
- return new LinkUcpeHost(relation);
- };
+ let newRelation:CompositionCiLinkBase;
+ if (singleRelation.relation.relationship.type && _.includes(singleRelation.relation.relationship.type.toLowerCase(), 'link')) {
+ newRelation = new CompositionCiVLink(relation, singleRelation);
+ } else {
+ newRelation = new CompositionCiSimpleLink(relation, singleRelation);
+ }
- public createVLLink = (relation:RelationshipModel):CompositionCiVLink => {
- return new CompositionCiVLink(relation);
- }
+ return newRelation;
+ };
+ public createUcpeHostLink = (relation:RelationshipModel):LinkUcpeHost => {
+ return new LinkUcpeHost(relation);
+ };
- public createModuleGraphLinks = (relation:RelationshipModel, singleRelation:Relationship):ModuleCiLinkBase => {
+ public createVLLink = (relation:RelationshipModel):CompositionCiVLink => {
+ return new CompositionCiVLink(relation);
+ }
- let newRelation:ModuleCiLinkBase;
+ public createModuleGraphLinks = (relation:RelationshipModel, singleRelation:Relationship):ModuleCiLinkBase => {
- if (_.includes(singleRelation.relation.relationship.type.toLowerCase(), 'link')) {
- newRelation = new ModuleCiVlLink(relation, singleRelation);
- } else {
- newRelation = new ModuleCiLinkBase(relation, singleRelation);
- }
+ let newRelation:ModuleCiLinkBase;
+
+ if (_.includes(singleRelation.relation.relationship.type.toLowerCase(), 'link')) {
+ newRelation = new ModuleCiVlLink(relation, singleRelation);
+ } else {
+ newRelation = new ModuleCiLinkBase(relation, singleRelation);
+ }
- return newRelation;
- };
+ return newRelation;
+ };
}
diff --git a/catalog-ui/src/app/models/graph/nodes/composition-graph-nodes/composition-ci-node-base.ts b/catalog-ui/src/app/models/graph/nodes/composition-graph-nodes/composition-ci-node-base.ts
index 51a0c7b3e5..69605507e7 100644
--- a/catalog-ui/src/app/models/graph/nodes/composition-graph-nodes/composition-ci-node-base.ts
+++ b/catalog-ui/src/app/models/graph/nodes/composition-graph-nodes/composition-ci-node-base.ts
@@ -20,9 +20,11 @@
import {ComponentInstance} from "../../../componentsInstances/componentInstance";
import {CommonCINodeBase} from "../common-ci-node-base";
-import {ICanvasImage, ImageCreatorService} from "app/directives/graphs-v2/image-creator/image-creator.service";
import {ImagesUrl, GraphUIObjects} from "app/utils";
import {AngularJSBridge} from "app/services";
+import {ResourceNamePipe} from "app/ng2/pipes/resource-name.pipe";
+import {ComponentInstanceNodesStyle} from "app/ng2/pages/composition/graph/common/style/component-instances-nodes-style";
+import {ImageCreatorService, ICanvasImage} from "app/ng2/pages/composition/graph/common/image-creator.service";
export interface ICompositionCiNodeBase {
@@ -48,14 +50,16 @@ export abstract class CompositionCiNodeBase extends CommonCINodeBase implements
this.isUcpePart = false;
this.isInsideGroup = false;
}
-
-
+
+
protected enhanceImage(node:Cy.Collection, nodeMinSize:number, imgUrl: string):string {
+
let infoIconWidth:number = GraphUIObjects.HANDLE_SIZE;
let nodeWidth:number = node.data('imgWidth') || node.width();
+ // let uncertifiedCanvasWidth: number = nodeWidth;
let infoCanvasWidth: number = nodeWidth;
- if (nodeWidth < nodeMinSize) { //info icon will overlap too much of the node, need to expand canvas.
+ if (nodeWidth < nodeMinSize) { //uncertified icon will overlap too much of the node, need to expand canvas.
infoCanvasWidth = nodeWidth + infoIconWidth/2; //expand canvas so that only half of the icon overlaps with the node
}
@@ -66,13 +70,14 @@ export abstract class CompositionCiNodeBase extends CommonCINodeBase implements
{ src: imgUrl, x: 0, y: 0, width: infoIconWidth, height: infoIconWidth}
];
+
//Create the image and update the node background styles
this.imageCreator.getMultiLayerBase64Image(canvasImages, infoCanvasWidth, infoCanvasWidth).then(img => this.updateNodeStyles(node,infoCanvasWidth,img));
return this.img; // Return the referance to the image (in Base64 format)
}
-
- public setArchivedImageBgStyle(node:Cy.Collection, nodeMinSize:number):string {
+
+ public setArchivedImageBgStyle(node:Cy.Collection, nodeMinSize:number):string {
let archivedIconWidth:number = GraphUIObjects.HANDLE_SIZE;
let nodeWidth:number = node.data('imgWidth') || node.width();
let archivedCanvasWidth: number = nodeWidth;
@@ -95,13 +100,12 @@ export abstract class CompositionCiNodeBase extends CommonCINodeBase implements
}
protected getDisplayName():string {
- let graphResourceName = AngularJSBridge.getFilter('graphResourceName');
- let resourceName = AngularJSBridge.getFilter('resourceName');
- return graphResourceName(resourceName(this.componentInstance.name));
+ let resourceName = ResourceNamePipe.getDisplayName(this.componentInstance.name);
+ return ComponentInstanceNodesStyle.getGraphDisplayName(resourceName);
}
//TODO:: move to Base class ???
- private updateNodeStyles(node,canvasWidth,imageBase64){
+ private updateNodeStyles(node,canvasWidth,imageBase64){
this.img = imageBase64;
node.style({
'background-image': this.img,
@@ -109,7 +113,7 @@ export abstract class CompositionCiNodeBase extends CommonCINodeBase implements
'background-height': canvasWidth,
'background-position-x':0,
'background-position-y':0
- });
+ });
}
}
diff --git a/catalog-ui/src/app/models/graph/nodes/composition-graph-nodes/composition-ci-node-configuration.ts b/catalog-ui/src/app/models/graph/nodes/composition-graph-nodes/composition-ci-node-configuration.ts
index 78bcc17186..cac48df632 100644
--- a/catalog-ui/src/app/models/graph/nodes/composition-graph-nodes/composition-ci-node-configuration.ts
+++ b/catalog-ui/src/app/models/graph/nodes/composition-graph-nodes/composition-ci-node-configuration.ts
@@ -20,7 +20,7 @@
import { ImagesUrl, GraphUIObjects} from "../../../../utils/constants";
import {ComponentInstance, CompositionCiNodeBase} from "../../../../models";
-import {ImageCreatorService} from "../../../../directives/graphs-v2/image-creator/image-creator.service";
+import {ImageCreatorService} from "app/ng2/pages/composition/graph/common/image-creator.service";
export class CompositionCiNodeConfiguration extends CompositionCiNodeBase {
constructor(instance:ComponentInstance,
diff --git a/catalog-ui/src/app/models/graph/nodes/composition-graph-nodes/composition-ci-node-cp.ts b/catalog-ui/src/app/models/graph/nodes/composition-graph-nodes/composition-ci-node-cp.ts
index 05a6d790ab..9b6a4ed0aa 100644
--- a/catalog-ui/src/app/models/graph/nodes/composition-graph-nodes/composition-ci-node-cp.ts
+++ b/catalog-ui/src/app/models/graph/nodes/composition-graph-nodes/composition-ci-node-cp.ts
@@ -20,7 +20,7 @@
import {CompositionCiNodeBase} from "./composition-ci-node-base";
import {ComponentInstance} from "../../../componentsInstances/componentInstance";
-import {ImageCreatorService} from "../../../../directives/graphs-v2/image-creator/image-creator.service";
+import {ImageCreatorService} from "app/ng2/pages/composition/graph/common/image-creator.service";
import {AngularJSBridge} from "../../../../services/angular-js-bridge-service";
import { ImagesUrl, GraphUIObjects} from "../../../../utils/constants";
diff --git a/catalog-ui/src/app/models/graph/nodes/composition-graph-nodes/composition-ci-node-service-proxy.ts b/catalog-ui/src/app/models/graph/nodes/composition-graph-nodes/composition-ci-node-service-proxy.ts
index 5ef3a733b2..a46e0c4d32 100644
--- a/catalog-ui/src/app/models/graph/nodes/composition-graph-nodes/composition-ci-node-service-proxy.ts
+++ b/catalog-ui/src/app/models/graph/nodes/composition-graph-nodes/composition-ci-node-service-proxy.ts
@@ -18,9 +18,9 @@
* ============LICENSE_END=========================================================
*/
-import {ComponentInstance, CompositionCiNodeBase} from "app/models";
-import {ImageCreatorService} from "app/directives/graphs-v2/image-creator/image-creator.service";
-import {ImagesUrl, GraphUIObjects} from "app/utils";
+import { ImagesUrl, GraphUIObjects} from "../../../../utils/constants";
+import {ComponentInstance, CompositionCiNodeBase} from "../../../../models";
+import {ImageCreatorService} from "app/ng2/pages/composition/graph/common/image-creator.service";
export class CompositionCiNodeServiceProxy extends CompositionCiNodeBase {
private isDependent: boolean;
private originalImg: string;
@@ -50,7 +50,6 @@ export class CompositionCiNodeServiceProxy extends CompositionCiNodeBase {
}
}
-
public initUncertifiedDependentImage(node:Cy.Collection, nodeMinSize:number):string {
return this.enhanceImage(node, nodeMinSize, this.imagesPath + 'uncertified_dependent.png');
}
@@ -58,5 +57,4 @@ export class CompositionCiNodeServiceProxy extends CompositionCiNodeBase {
public initDependentImage(node:Cy.Collection, nodeMinSize:number):string {
return this.enhanceImage(node, nodeMinSize, this.imagesPath + 'dependent.png');
}
-
}
diff --git a/catalog-ui/src/app/models/graph/nodes/composition-graph-nodes/composition-ci-node-service.ts b/catalog-ui/src/app/models/graph/nodes/composition-graph-nodes/composition-ci-node-service.ts
index bf8facf002..5b6281560c 100644
--- a/catalog-ui/src/app/models/graph/nodes/composition-graph-nodes/composition-ci-node-service.ts
+++ b/catalog-ui/src/app/models/graph/nodes/composition-graph-nodes/composition-ci-node-service.ts
@@ -20,7 +20,7 @@
import { ImagesUrl, GraphUIObjects} from "../../../../utils/constants";
import {ComponentInstance, CompositionCiNodeBase} from "../../../../models";
-import {ImageCreatorService} from "../../../../directives/graphs-v2/image-creator/image-creator.service";
+import {ImageCreatorService} from "app/ng2/pages/composition/graph/common/image-creator.service";
export class CompositionCiNodeService extends CompositionCiNodeBase {
constructor(instance:ComponentInstance,
diff --git a/catalog-ui/src/app/models/graph/nodes/composition-graph-nodes/composition-ci-node-ucpe-cp.ts b/catalog-ui/src/app/models/graph/nodes/composition-graph-nodes/composition-ci-node-ucpe-cp.ts
index a79b183db4..f769e69ec1 100644
--- a/catalog-ui/src/app/models/graph/nodes/composition-graph-nodes/composition-ci-node-ucpe-cp.ts
+++ b/catalog-ui/src/app/models/graph/nodes/composition-graph-nodes/composition-ci-node-ucpe-cp.ts
@@ -19,7 +19,7 @@
*/
import {CompositionCiNodeCp, ComponentInstance} from "./../../../../models";
-import {ImageCreatorService} from "../../../../directives/graphs-v2/image-creator/image-creator.service";
+import {ImageCreatorService} from "app/ng2/pages/composition/graph/common/image-creator.service";
import { ImagesUrl} from "../../../../utils/constants";
export class CompositionCiNodeUcpeCp extends CompositionCiNodeCp {
diff --git a/catalog-ui/src/app/models/graph/nodes/composition-graph-nodes/composition-ci-node-ucpe.ts b/catalog-ui/src/app/models/graph/nodes/composition-graph-nodes/composition-ci-node-ucpe.ts
index d4172c0eaa..242e96857d 100644
--- a/catalog-ui/src/app/models/graph/nodes/composition-graph-nodes/composition-ci-node-ucpe.ts
+++ b/catalog-ui/src/app/models/graph/nodes/composition-graph-nodes/composition-ci-node-ucpe.ts
@@ -19,7 +19,7 @@
*/
import {ComponentInstance} from "../../../componentsInstances/componentInstance";
-import {ImageCreatorService} from "../../../../directives/graphs-v2/image-creator/image-creator.service";
+import {ImageCreatorService} from "app/ng2/pages/composition/graph/common/image-creator.service";
import {CompositionCiNodeBase} from "./composition-ci-node-base";
import { ImagesUrl} from "../../../../utils/constants";
diff --git a/catalog-ui/src/app/models/graph/nodes/composition-graph-nodes/composition-ci-node-vf.ts b/catalog-ui/src/app/models/graph/nodes/composition-graph-nodes/composition-ci-node-vf.ts
index 4aff85e6c3..c5d2d9e34b 100644
--- a/catalog-ui/src/app/models/graph/nodes/composition-graph-nodes/composition-ci-node-vf.ts
+++ b/catalog-ui/src/app/models/graph/nodes/composition-graph-nodes/composition-ci-node-vf.ts
@@ -19,7 +19,7 @@
*/
import {CompositionCiNodeBase} from "./composition-ci-node-base";
import {ComponentInstance} from "../../../componentsInstances/componentInstance";
-import {ImageCreatorService} from "../../../../directives/graphs-v2/image-creator/image-creator.service";
+import {ImageCreatorService} from "app/ng2/pages/composition/graph/common/image-creator.service";
import { ImagesUrl, GraphUIObjects} from "../../../../utils/constants";
export class CompositionCiNodeVf extends CompositionCiNodeBase {
diff --git a/catalog-ui/src/app/models/graph/nodes/composition-graph-nodes/composition-ci-node-vfc.ts b/catalog-ui/src/app/models/graph/nodes/composition-graph-nodes/composition-ci-node-vfc.ts
index 5f07986d5c..4c16661548 100644
--- a/catalog-ui/src/app/models/graph/nodes/composition-graph-nodes/composition-ci-node-vfc.ts
+++ b/catalog-ui/src/app/models/graph/nodes/composition-graph-nodes/composition-ci-node-vfc.ts
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
import {CompositionCiNodeBase} from "./composition-ci-node-base";
-import {ImageCreatorService} from "../../../../directives/graphs-v2/image-creator/image-creator.service";
+import {ImageCreatorService} from "app/ng2/pages/composition/graph/common/image-creator.service";
import {ComponentInstance} from "../../../componentsInstances/componentInstance";
import {ImagesUrl} from "../../../../utils/constants";
diff --git a/catalog-ui/src/app/models/graph/nodes/composition-graph-nodes/composition-ci-node-vl.ts b/catalog-ui/src/app/models/graph/nodes/composition-graph-nodes/composition-ci-node-vl.ts
index a440f09156..2407593665 100644
--- a/catalog-ui/src/app/models/graph/nodes/composition-graph-nodes/composition-ci-node-vl.ts
+++ b/catalog-ui/src/app/models/graph/nodes/composition-graph-nodes/composition-ci-node-vl.ts
@@ -19,7 +19,7 @@
*/
import * as _ from "lodash";
import {ComponentInstance} from "../../../componentsInstances/componentInstance";
-import {ImageCreatorService} from "../../../../directives/graphs-v2/image-creator/image-creator.service";
+import {ImageCreatorService} from "app/ng2/pages/composition/graph/common/image-creator.service";
import {CompositionCiNodeBase} from "./composition-ci-node-base";
import { ImagesUrl, GraphUIObjects} from "../../../../utils/constants";
diff --git a/catalog-ui/src/app/models/graph/nodes/nodes-factory.ts b/catalog-ui/src/app/models/graph/nodes/nodes-factory.ts
index 245f2e10d9..bcd2f7e111 100644
--- a/catalog-ui/src/app/models/graph/nodes/nodes-factory.ts
+++ b/catalog-ui/src/app/models/graph/nodes/nodes-factory.ts
@@ -22,8 +22,10 @@
import {CompositionCiNodeUcpeCp, Module, ModuleNodeBase, CompositionCiNodeVf, CompositionCiNodeVl, CompositionCiNodeCp, CompositionCiNodeConfiguration,
NodeUcpe, CompositionCiNodeService,CompositionCiNodeServiceProxy, CompositionCiNodeBase, ComponentInstance} from "./../../../models";
import {ComponentType, ResourceType} from "../../../utils/constants";
-import {ImageCreatorService} from "../../../directives/graphs-v2/image-creator/image-creator.service";
+import {ImageCreatorService} from "app/ng2/pages/composition/graph/common/image-creator.service";
+import {Injectable} from "@angular/core";
+@Injectable()
export class NodesFactory {
constructor(private imageCreator:ImageCreatorService) {
@@ -54,7 +56,6 @@ export class NodesFactory {
};
public createModuleNode = (module:Module):ModuleNodeBase => {
-
return new ModuleNodeBase(module);
};
@@ -64,6 +65,3 @@ export class NodesFactory {
}
}
-NodesFactory.$inject = [
- 'ImageCreatorService'
-];
diff --git a/catalog-ui/src/app/models/graph/relationship.ts b/catalog-ui/src/app/models/graph/relationship.ts
index 8d56272fa0..13a1bd13e0 100644
--- a/catalog-ui/src/app/models/graph/relationship.ts
+++ b/catalog-ui/src/app/models/graph/relationship.ts
@@ -119,4 +119,11 @@ export class Relationship {
this.capability = capability;
this.requirement = requirement;
};
+
+ public toJSON = ():any => {
+ let temp = angular.copy(this);
+ temp.capability = undefined;
+ temp.requirement = undefined;
+ return temp;
+ }
}
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;