aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-ui/src/app/models/capability.ts
diff options
context:
space:
mode:
authorTal Gitelman <tg851x@intl.att.com>2017-12-10 18:55:03 +0200
committerTal Gitelman <tg851x@intl.att.com>2017-12-10 19:33:38 +0200
commit51d50f0ef642e0f996a1c8b8d2ef4838bdfec892 (patch)
tree3ac236a864d74d19b0f5c9020891a7a7e5c31b44 /catalog-ui/src/app/models/capability.ts
parentb5cc2e0695f195716d6ccdc65e73807a6632ec70 (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/capability.ts')
-rw-r--r--catalog-ui/src/app/models/capability.ts18
1 files changed, 15 insertions, 3 deletions
diff --git a/catalog-ui/src/app/models/capability.ts b/catalog-ui/src/app/models/capability.ts
index 79cf425d92..2f2e3a8de6 100644
--- a/catalog-ui/src/app/models/capability.ts
+++ b/catalog-ui/src/app/models/capability.ts
@@ -23,7 +23,9 @@
*/
'use strict';
import {PropertyModel} from "./properties";
+import {Requirement} from "./requirement";
+export interface RequirementCapabilityModel{};
//this is an object contains keys, when each key has matching array.
// for example: key = tosca.capabilities.network.Linkable and the match array is array of capabilities objects
export class CapabilitiesGroup {
@@ -44,7 +46,7 @@ export class CapabilitiesGroup {
}
}
-export class Capability {
+export class Capability implements RequirementCapabilityModel{
//server data
name:string;
@@ -53,11 +55,12 @@ export class Capability {
type:string;
uniqueId:string;
capabilitySources:Array<String>;
+ leftOccurrences:string;
minOccurrences:string;
maxOccurrences:string;
- properties:Array<PropertyModel>;
description:string;
validSourceTypes:Array<string>;
+ properties:Array<PropertyModel>;
//custom
selected:boolean;
filterTerm:string;
@@ -72,6 +75,7 @@ export class Capability {
this.type = capability.type;
this.uniqueId = capability.uniqueId;
this.capabilitySources = capability.capabilitySources;
+ this.leftOccurrences = capability.leftOccurrences;
this.minOccurrences = capability.minOccurrences;
this.maxOccurrences = capability.maxOccurrences;
this.properties = capability.properties;
@@ -83,9 +87,13 @@ export class Capability {
}
}
+ public getTitle():string {
+ return this.ownerName + ': ' + this.name;
+ }
+
public getFullTitle():string {
let maxOccurrences:string = this.maxOccurrences === 'UNBOUNDED' ? '∞' : this.maxOccurrences;
- return this.ownerName + ': ' + this.name + ': [' + this.minOccurrences + ', ' + maxOccurrences + ']';
+ return this.getTitle() + ': [' + this.minOccurrences + ', ' + maxOccurrences + ']';
}
public toJSON = ():any => {
@@ -110,6 +118,10 @@ export class Capability {
});
}
}
+
+ public isFulfilled() {
+ return parseInt(this.leftOccurrences) === 0;
+ }
}