summaryrefslogtreecommitdiffstats
path: root/catalog-ui/src/app/models
diff options
context:
space:
mode:
Diffstat (limited to 'catalog-ui/src/app/models')
-rw-r--r--catalog-ui/src/app/models/componentsInstances/componentInstance.ts21
-rw-r--r--catalog-ui/src/app/models/graph/nodes/composition-graph-nodes/composition-ci-node-base.ts32
-rw-r--r--catalog-ui/src/app/models/graph/nodes/composition-graph-nodes/composition-ci-node-service-proxy.ts22
-rw-r--r--catalog-ui/src/app/models/properties-inputs/property-be-model.ts2
-rw-r--r--catalog-ui/src/app/models/service-instance-properties.ts31
5 files changed, 90 insertions, 18 deletions
diff --git a/catalog-ui/src/app/models/componentsInstances/componentInstance.ts b/catalog-ui/src/app/models/componentsInstances/componentInstance.ts
index fcc3298249..f95d6553cd 100644
--- a/catalog-ui/src/app/models/componentsInstances/componentInstance.ts
+++ b/catalog-ui/src/app/models/componentsInstances/componentInstance.ts
@@ -61,6 +61,11 @@ export class ComponentInstance {
public groupInstances:Array<Module>;
public invariantName:string;
public originArchived:boolean;
+ public directives: Array<string>;
+
+ DIRECTIVES_TYPES = {
+ SELECTABLE: 'selectable'
+ };
constructor(componentInstance?:ComponentInstance) {
@@ -92,6 +97,7 @@ export class ComponentInstance {
this.sourceModelUid = componentInstance.sourceModelUid;
this.sourceModelUuid = componentInstance.sourceModelUuid;
this.originArchived = componentInstance.originArchived;
+ this.directives = componentInstance.directives;
}
}
@@ -177,4 +183,19 @@ export class ComponentInstance {
public get iconClass() {
return this.iconSprite + ' ' + this.icon;
}
+
+ public isDependent = () : boolean => {
+ return this.directives && this.directives.indexOf(this.DIRECTIVES_TYPES.SELECTABLE) !== -1;
+ }
+
+ public markAsDependent = () : void => {
+ this.directives.push(this.DIRECTIVES_TYPES.SELECTABLE);
+ }
+
+ public unmarkAsDependent = () : void => {
+ let index = this.directives.indexOf(this.DIRECTIVES_TYPES.SELECTABLE);
+ if(index >= 0) {
+ this.directives.splice(index, 1);
+ }
+ }
}
diff --git a/catalog-ui/src/app/models/graph/nodes/composition-graph-nodes/composition-ci-node-base.ts b/catalog-ui/src/app/models/graph/nodes/composition-graph-nodes/composition-ci-node-base.ts
index a24142348c..51a0c7b3e5 100644
--- a/catalog-ui/src/app/models/graph/nodes/composition-graph-nodes/composition-ci-node-base.ts
+++ b/catalog-ui/src/app/models/graph/nodes/composition-graph-nodes/composition-ci-node-base.ts
@@ -48,33 +48,31 @@ export abstract class CompositionCiNodeBase extends CommonCINodeBase implements
this.isUcpePart = false;
this.isInsideGroup = false;
}
-
-
- public setUncertifiedImageBgStyle(node:Cy.Collection, nodeMinSize:number):string {
- let uncertifiedIconWidth:number = GraphUIObjects.HANDLE_SIZE;
+
+ protected enhanceImage(node:Cy.Collection, nodeMinSize:number, imgUrl: string):string {
+ let infoIconWidth:number = GraphUIObjects.HANDLE_SIZE;
let nodeWidth:number = node.data('imgWidth') || node.width();
- let uncertifiedCanvasWidth: number = nodeWidth;
+ let infoCanvasWidth: number = nodeWidth;
- if (nodeWidth < nodeMinSize) { //uncertified icon will overlap too much of the node, need to expand canvas.
- uncertifiedCanvasWidth = nodeWidth + uncertifiedIconWidth/2; //expand canvas so that only half of the icon overlaps with the node
+ if (nodeWidth < nodeMinSize) { //info icon will overlap too much of the node, need to expand canvas.
+ infoCanvasWidth = nodeWidth + infoIconWidth/2; //expand canvas so that only half of the icon overlaps with the node
}
- const x = uncertifiedCanvasWidth - nodeWidth, y = x, width = nodeWidth, height = width;
+ const x = infoCanvasWidth - nodeWidth, y = x, width = nodeWidth, height = width;
const canvasImages:ICanvasImage[] = [
{ src: this.imagesPath + this.componentInstance.icon + '.png', x, y, width, height},
- { src: this.imagesPath + 'uncertified.png', x: 0, y: 0, width: uncertifiedIconWidth, height: uncertifiedIconWidth}
+ { src: imgUrl, x: 0, y: 0, width: infoIconWidth, height: infoIconWidth}
];
-
//Create the image and update the node background styles
- this.imageCreator.getMultiLayerBase64Image(canvasImages, uncertifiedCanvasWidth, uncertifiedCanvasWidth).then(img => this.updateNodeStyles(node,uncertifiedCanvasWidth,img));
+ this.imageCreator.getMultiLayerBase64Image(canvasImages, infoCanvasWidth, infoCanvasWidth).then(img => this.updateNodeStyles(node,infoCanvasWidth,img));
return this.img; // Return the referance to the image (in Base64 format)
}
-
- public setArchivedImageBgStyle(node:Cy.Collection, nodeMinSize:number):string {
+
+ public setArchivedImageBgStyle(node:Cy.Collection, nodeMinSize:number):string {
let archivedIconWidth:number = GraphUIObjects.HANDLE_SIZE;
let nodeWidth:number = node.data('imgWidth') || node.width();
let archivedCanvasWidth: number = nodeWidth;
@@ -92,6 +90,10 @@ export abstract class CompositionCiNodeBase extends CommonCINodeBase implements
return this.img; // Return the default img
}
+ public initUncertifiedImage(node:Cy.Collection, nodeMinSize:number):string {
+ return this.enhanceImage(node, nodeMinSize, this.imagesPath + 'uncertified.png');
+ }
+
protected getDisplayName():string {
let graphResourceName = AngularJSBridge.getFilter('graphResourceName');
let resourceName = AngularJSBridge.getFilter('resourceName');
@@ -99,7 +101,7 @@ export abstract class CompositionCiNodeBase extends CommonCINodeBase implements
}
//TODO:: move to Base class ???
- private updateNodeStyles(node,canvasWidth,imageBase64){
+ private updateNodeStyles(node,canvasWidth,imageBase64){
this.img = imageBase64;
node.style({
'background-image': this.img,
@@ -107,7 +109,7 @@ export abstract class CompositionCiNodeBase extends CommonCINodeBase implements
'background-height': canvasWidth,
'background-position-x':0,
'background-position-y':0
- });
+ });
}
}
diff --git a/catalog-ui/src/app/models/graph/nodes/composition-graph-nodes/composition-ci-node-service-proxy.ts b/catalog-ui/src/app/models/graph/nodes/composition-graph-nodes/composition-ci-node-service-proxy.ts
index b025221f25..5ef3a733b2 100644
--- a/catalog-ui/src/app/models/graph/nodes/composition-graph-nodes/composition-ci-node-service-proxy.ts
+++ b/catalog-ui/src/app/models/graph/nodes/composition-graph-nodes/composition-ci-node-service-proxy.ts
@@ -18,29 +18,45 @@
* ============LICENSE_END=========================================================
*/
-import { ImagesUrl, GraphUIObjects} from "../../../../utils/constants";
-import {ComponentInstance, CompositionCiNodeBase} from "../../../../models";
-import {ImageCreatorService} from "../../../../directives/graphs-v2/image-creator/image-creator.service";
+import {ComponentInstance, CompositionCiNodeBase} from "app/models";
+import {ImageCreatorService} from "app/directives/graphs-v2/image-creator/image-creator.service";
+import {ImagesUrl, GraphUIObjects} from "app/utils";
export class CompositionCiNodeServiceProxy extends CompositionCiNodeBase {
+ private isDependent: boolean;
+ private originalImg: string;
constructor(instance:ComponentInstance,
imageCreator:ImageCreatorService) {
super(instance, imageCreator);
+ this.isDependent =instance.isDependent();
this.initService();
}
private initService():void {
this.imagesPath = this.imagesPath + ImagesUrl.SERVICE_PROXY_ICONS;
this.img = this.imagesPath + this.componentInstance.icon + '.png';
+ this.originalImg = this.img;
this.imgWidth = GraphUIObjects.DEFAULT_RESOURCE_WIDTH;
this.classes = 'service-node';
if(this.archived){
this.classes = this.classes + ' archived';
return;
}
+ if (this.isDependent) {
+ this.classes += ' dependent';
+ }
if (!this.certified) {
this.classes = this.classes + ' not-certified';
}
}
+
+ public initUncertifiedDependentImage(node:Cy.Collection, nodeMinSize:number):string {
+ return this.enhanceImage(node, nodeMinSize, this.imagesPath + 'uncertified_dependent.png');
+ }
+
+ public initDependentImage(node:Cy.Collection, nodeMinSize:number):string {
+ return this.enhanceImage(node, nodeMinSize, this.imagesPath + 'dependent.png');
+ }
+
}
diff --git a/catalog-ui/src/app/models/properties-inputs/property-be-model.ts b/catalog-ui/src/app/models/properties-inputs/property-be-model.ts
index 14b6385f2f..aa68551950 100644
--- a/catalog-ui/src/app/models/properties-inputs/property-be-model.ts
+++ b/catalog-ui/src/app/models/properties-inputs/property-be-model.ts
@@ -39,6 +39,7 @@ export class PropertyBEModel {
password: boolean;
required: boolean;
schema: SchemaPropertyGroupModel;
+ schemaType: string;
type: string;
uniqueId: string;
value: string;
@@ -53,6 +54,7 @@ export class PropertyBEModel {
this.password = property.password;
this.required = property.required;
this.schema = property.schema;
+ this.schemaType = property.schemaType;
this.type = property.type;
this.uniqueId = property.uniqueId;
this.value = property.value;
diff --git a/catalog-ui/src/app/models/service-instance-properties.ts b/catalog-ui/src/app/models/service-instance-properties.ts
new file mode 100644
index 0000000000..9e9f1cce7f
--- /dev/null
+++ b/catalog-ui/src/app/models/service-instance-properties.ts
@@ -0,0 +1,31 @@
+/*!
+ * Copyright © 2016-2018 European Support Limited
+ *
+ * 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.
+ */
+
+import {PropertyModel} from 'app/models';
+
+export class ServiceInstanceObject {
+ id: string;
+ name: string;
+ properties: Array<PropertyModel> = [];
+
+ constructor(input?:any) {
+ if(input) {
+ this.id = input.id;
+ this.name = input.name;
+ this.properties = input.properties;
+ }
+ }
+} \ No newline at end of file