summaryrefslogtreecommitdiffstats
path: root/catalog-ui/src/app/models/capability.ts
diff options
context:
space:
mode:
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;
+ }
}