diff options
author | Tal Gitelman <tg851x@intl.att.com> | 2017-12-10 18:55:03 +0200 |
---|---|---|
committer | Tal Gitelman <tg851x@intl.att.com> | 2017-12-10 19:33:38 +0200 |
commit | 51d50f0ef642e0f996a1c8b8d2ef4838bdfec892 (patch) | |
tree | 3ac236a864d74d19b0f5c9020891a7a7e5c31b44 /catalog-ui/src/app/models/requirement.ts | |
parent | b5cc2e0695f195716d6ccdc65e73807a6632ec70 (diff) |
Final commit to master merge from
Change-Id: Ib464f9a8828437c86fe6def8af238aaf83473507
Issue-ID: SDC-714
Signed-off-by: Tal Gitelman <tg851x@intl.att.com>
Diffstat (limited to 'catalog-ui/src/app/models/requirement.ts')
-rw-r--r-- | catalog-ui/src/app/models/requirement.ts | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/catalog-ui/src/app/models/requirement.ts b/catalog-ui/src/app/models/requirement.ts index 53e870679d..d880456b06 100644 --- a/catalog-ui/src/app/models/requirement.ts +++ b/catalog-ui/src/app/models/requirement.ts @@ -22,6 +22,7 @@ * Created by obarda on 4/20/2016. */ 'use strict'; +import {RequirementCapabilityModel} from "./capability"; //this is an object contains keys, when each key has matching array. // for example: key = tosca.capabilities.network. and the match array is array of requirements objects export class RequirementsGroup { @@ -36,7 +37,7 @@ export class RequirementsGroup { } } -export class Requirement { +export class Requirement implements RequirementCapabilityModel{ //server data capability:string; @@ -46,6 +47,7 @@ export class Requirement { node:string; uniqueId:string; relationship:string; + leftOccurrences:string; minOccurrences:string; maxOccurrences:string; //custom @@ -61,6 +63,7 @@ export class Requirement { this.node = requirement.node; this.uniqueId = requirement.uniqueId; this.relationship = requirement.relationship; + this.leftOccurrences = requirement.leftOccurrences; this.minOccurrences = requirement.minOccurrences; this.maxOccurrences = requirement.maxOccurrences; this.initFilterTerm(); @@ -68,9 +71,12 @@ export class Requirement { } } + public getTitle():string { + return this.ownerName + ': ' + this.name; + } + public getFullTitle():string { - return this.ownerName + ': ' + this.name + - ': [' + this.minOccurrences + ', ' + this.maxOccurrences + ']'; + return this.getTitle() + ': [' + this.minOccurrences + ', ' + this.maxOccurrences + ']'; } public toJSON = ():any => { @@ -86,6 +92,10 @@ export class Requirement { (this.relationship ? (this.relationship.substring("tosca.relationships.".length) + " ") : "") + this.minOccurrences + "," + this.maxOccurrences; } + + public isFulfilled() { + return parseInt(this.leftOccurrences) === 0; + } } |