diff options
author | andre.schmid <andre.schmid@est.tech> | 2020-11-18 18:13:58 +0000 |
---|---|---|
committer | Christophe Closset <christophe.closset@intl.att.com> | 2021-01-15 13:59:55 +0000 |
commit | bd5a1006210092f9ac5c48352cc94f6264e961ef (patch) | |
tree | a91d4fc711dacb4e9833a1f7ff5134ff8407c931 /catalog-ui/src/app/models | |
parent | 3849231a17930b1bb2ba09af15673bfd07538b9d (diff) |
Initial support for relationship_templates
Change-Id: Ia246b9f11a77815c0585abfa0b3de5433728001a
Issue-ID: SDC-3435
Signed-off-by: andre.schmid <andre.schmid@est.tech>
Diffstat (limited to 'catalog-ui/src/app/models')
3 files changed, 60 insertions, 2 deletions
diff --git a/catalog-ui/src/app/models/graph/match-relation.ts b/catalog-ui/src/app/models/graph/match-relation.ts index 2a1b2146b9..3da6775650 100644 --- a/catalog-ui/src/app/models/graph/match-relation.ts +++ b/catalog-ui/src/app/models/graph/match-relation.ts @@ -21,7 +21,7 @@ import {Requirement} from "../requirement"; import {Capability} from "../capability"; import {Relationship, RelationshipModel} from "./relationship"; -import {PropertyModel} from "../properties"; +import {Operation} from "../../ng2/pages/composition/graph/connection-wizard/create-interface-operation/model/operation"; export class Match { requirement:Requirement; @@ -29,6 +29,7 @@ export class Match { isFromTo:boolean; fromNode:string; toNode:string; + operations?:Array<Operation>; private _relationship:Relationship; constructor(requirement:Requirement, capability:Capability, isFromTo:boolean, fromNode:string, toNode:string) { @@ -54,6 +55,7 @@ export class Match { public matchToRelation = ():Relationship => { const relationship:Relationship = new Relationship(); relationship.setRelationProperties(this.capability, this.requirement); + relationship.operations = this.operations; return relationship; }; @@ -74,5 +76,22 @@ export class Match { relationshipModel.setRelationshipModelParams(this.fromNode, this.toNode, [relationship]); return relationshipModel; }; + + public addToOperations(operation: Operation): void { + if (!this.operations) { + this.operations = new Array<Operation>(); + } + this.operations.push(operation); + } + + public removeFromOperations(operation: Operation): void { + if (!this.operations) { + return; + } + const index = this.operations.indexOf(operation); + if (index > -1) { + this.operations.splice(index, 1); + } + } } diff --git a/catalog-ui/src/app/models/graph/relationship.ts b/catalog-ui/src/app/models/graph/relationship.ts index 13a1bd13e0..e39521a66a 100644 --- a/catalog-ui/src/app/models/graph/relationship.ts +++ b/catalog-ui/src/app/models/graph/relationship.ts @@ -21,6 +21,7 @@ import * as _ from "lodash"; import {Capability} from "../capability"; import {Requirement} from "../requirement"; +import {Operation} from "../../ng2/pages/composition/graph/connection-wizard/create-interface-operation/model/operation"; export class RelationshipModel { fromNode:string; @@ -103,12 +104,19 @@ export class Relationship { relation: RelationshipType; capability?: Capability; requirement?: Requirement; + operations?:Array<Operation>; constructor(fullRelationship?:Relationship) { if (fullRelationship) { this.relation = new RelationshipType(fullRelationship.relation); this.capability = fullRelationship.capability && new Capability(fullRelationship.capability); this.requirement = fullRelationship.requirement && new Requirement(fullRelationship.requirement); + if (fullRelationship.operations) { + this.operations = new Array<Operation>(); + fullRelationship.operations.forEach(operation => { + this.operations.push(new Operation(operation)); + }); + } } else { this.relation = new RelationshipType(); } @@ -118,7 +126,7 @@ export class Relationship { this.relation.setRelationProperties(capability, requirement); this.capability = capability; this.requirement = requirement; - }; + } public toJSON = ():any => { let temp = angular.copy(this); diff --git a/catalog-ui/src/app/models/properties-inputs/property-assignment.ts b/catalog-ui/src/app/models/properties-inputs/property-assignment.ts new file mode 100644 index 0000000000..0c3ef8370e --- /dev/null +++ b/catalog-ui/src/app/models/properties-inputs/property-assignment.ts @@ -0,0 +1,31 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 2021 Nordix Foundation + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +export class PropertyAssignment { + + name: string + value: string + type: string + + constructor(type?: string) { + if (type) { + this.type = type; + } + } +} |