Final commit to master merge from
Change-Id: Ib464f9a8828437c86fe6def8af238aaf83473507
Issue-ID: SDC-714
Signed-off-by: Tal Gitelman <tg851x@intl.att.com>
diff --git a/catalog-ui/src/app/models/requirement.ts b/catalog-ui/src/app/models/requirement.ts
index 53e8706..d880456 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 Requirement {
+export class Requirement implements RequirementCapabilityModel{
//server data
capability:string;
@@ -46,6 +47,7 @@
node:string;
uniqueId:string;
relationship:string;
+ leftOccurrences:string;
minOccurrences:string;
maxOccurrences:string;
//custom
@@ -61,6 +63,7 @@
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 @@
}
}
+ 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 @@
(this.relationship ? (this.relationship.substring("tosca.relationships.".length) + " ") : "") +
this.minOccurrences + "," + this.maxOccurrences;
}
+
+ public isFulfilled() {
+ return parseInt(this.leftOccurrences) === 0;
+ }
}