summaryrefslogtreecommitdiffstats
path: root/catalog-ui/src/app/models/properties-inputs
diff options
context:
space:
mode:
authorTal Gitelman <tg851x@intl.att.com>2017-07-03 20:16:55 +0300
committerTal Gitelman <tg851x@intl.att.com>2017-07-03 20:16:55 +0300
commit153a35821f0d25ce23cca467b76c5a7c5092c744 (patch)
tree0c66c4d1310019479e446ea3a4c26faffb0aa33f /catalog-ui/src/app/models/properties-inputs
parentffdda7d685029d6a88ac82ac637e43bba96423cb (diff)
[sdc] - last merges before moving to LF
Change-Id: I0df3ec795f0de84229ea4bb4806ec8f959243557 Signed-off-by: Tal Gitelman <tg851x@intl.att.com>
Diffstat (limited to 'catalog-ui/src/app/models/properties-inputs')
-rw-r--r--catalog-ui/src/app/models/properties-inputs/input-be-model.ts9
-rw-r--r--catalog-ui/src/app/models/properties-inputs/input-fe-model.ts39
-rw-r--r--catalog-ui/src/app/models/properties-inputs/property-be-model.ts22
-rw-r--r--catalog-ui/src/app/models/properties-inputs/property-declare-api-model.ts18
-rw-r--r--catalog-ui/src/app/models/properties-inputs/property-fe-model.ts9
-rw-r--r--catalog-ui/src/app/models/properties-inputs/property-input-detail.ts6
6 files changed, 49 insertions, 54 deletions
diff --git a/catalog-ui/src/app/models/properties-inputs/input-be-model.ts b/catalog-ui/src/app/models/properties-inputs/input-be-model.ts
index 6767bce729..72afd77038 100644
--- a/catalog-ui/src/app/models/properties-inputs/input-be-model.ts
+++ b/catalog-ui/src/app/models/properties-inputs/input-be-model.ts
@@ -3,10 +3,13 @@ import {PropertyBEModel} from 'app/models';
* Created by rc2122 on 6/1/2017.
*/
export class InputBEModel extends PropertyBEModel {
- properties: Array<ComponentInstanceModel>;
+
+ inputPath: string;
inputs: Array<ComponentInstanceModel>;
instanceUniqueId: string;
+ ownerId: string;
propertyId: string;
+ properties: Array<ComponentInstanceModel>;
constructor(input?: InputBEModel) {
super(input);
@@ -14,10 +17,10 @@ export class InputBEModel extends PropertyBEModel {
this.propertyId = input.propertyId;
this.properties = input.properties;
this.inputs = input.inputs;
+ this.ownerId = input.ownerId;
+ this.inputPath = input.inputPath;
}
-
-
public toJSON = (): any => {
};
diff --git a/catalog-ui/src/app/models/properties-inputs/input-fe-model.ts b/catalog-ui/src/app/models/properties-inputs/input-fe-model.ts
index 3af4431b55..f79a7e6317 100644
--- a/catalog-ui/src/app/models/properties-inputs/input-fe-model.ts
+++ b/catalog-ui/src/app/models/properties-inputs/input-fe-model.ts
@@ -5,42 +5,19 @@ import {InputBEModel} from "./input-be-model";
export class InputFEModel extends InputBEModel {
isSimpleType: boolean;
- relatedProperty: SimpleRelatedProperty;
+ relatedPropertyValue: any;
+ relatedPropertyName: string;
constructor(input?: InputBEModel) {
super(input);
if (input) {
this.isSimpleType = PROPERTY_DATA.SIMPLE_TYPES.indexOf(this.type) > -1;
- this.relatedProperty = new SimpleRelatedProperty(input);
+ let relatedProperty = input.properties && input.properties[0] || input.inputs && input.inputs[0];
+ if (relatedProperty) {
+ this.relatedPropertyValue = relatedProperty.value;
+ this.relatedPropertyName = relatedProperty.name;
+ }
}
}
-}
-
-export class SimpleRelatedProperty {
- name: string;
- value: string;
- nestedPath: string;
-
- constructor(input: InputBEModel) {
- if(!input.instanceUniqueId){
- return;
- }
- //Check if input is on DerivedFEProperty level, in which case we want to set a nested path
- let instanceName = input.instanceUniqueId.split('.').pop();
- if (input.inputPath && input.inputPath.indexOf('#') > -1
- && instanceName + "_" + input.inputPath.split('#').join('_') == input.name) { //Ignore inputPath for a complex child on VL that was declared within VF, that was then dragged into service. For that case, input.name will be missing the vl name, so we'll know to ignore the path and fall into else case.
- this.nestedPath = input.inputPath;
- this.name = input.inputPath.substring(0, input.inputPath.indexOf('#'));
- } else { //PropertyFEModel level. Can parse input name to get prop name.
- let propNameLength = input.name.length - instanceName.length + 1;
- this.name = input.name.substr(instanceName.length + 1, propNameLength);
- }
-
- //In declare response, input contains nested property, and we need to extract value so we can update our prop.
- let nestedProperty = input.properties && input.properties[0] || input.inputs && input.inputs[0];
- if (nestedProperty) {
- this.value = nestedProperty.value;
- }
- }
-};
+} \ No newline at end of file
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 f5cd4094f5..0f22d53434 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
@@ -1,4 +1,4 @@
-import { SchemaPropertyGroupModel, SchemaProperty } from "../aschema-property";
+import { PropertyInputDetail, SchemaPropertyGroupModel, SchemaProperty } from "app/models";
import { PROPERTY_DATA, PROPERTY_TYPES } from 'app/utils';
export enum DerivedPropertyType {
SIMPLE,
@@ -10,8 +10,10 @@ export enum DerivedPropertyType {
export class PropertyBEModel {
defaultValue: string;
+ definition: boolean;
description: string;
fromDerived: boolean;
+ getInputValues: Array<PropertyInputDetail>
name: string;
parentUniqueId: string;
password: boolean;
@@ -20,13 +22,8 @@ export class PropertyBEModel {
type: string;
uniqueId: string;
value: string;
- definition: boolean;
- inputPath: string;
- propertiesName: string;
- ownerId: string;
- input: PropertyBEModel;
- constructor(property?: PropertyBEModel, childProperty?:PropertyBEModel) {
+ constructor(property?: PropertyBEModel) {
if (property) {
this.defaultValue = property.defaultValue;
this.description = property.description;
@@ -40,16 +37,7 @@ export class PropertyBEModel {
this.uniqueId = property.uniqueId;
this.value = property.value ? property.value : property.defaultValue;
this.definition = property.definition;
- this.ownerId = property.ownerId;
- if (property.inputPath) {
- this.inputPath = property.inputPath;
- }
- }
- if (childProperty) {
- this.input = childProperty;
- this.propertiesName = childProperty.propertiesName;
- } else {
- this.propertiesName = this.name;
+ this.getInputValues = property.getInputValues;
}
if (!this.schema || !this.schema.property) {
diff --git a/catalog-ui/src/app/models/properties-inputs/property-declare-api-model.ts b/catalog-ui/src/app/models/properties-inputs/property-declare-api-model.ts
new file mode 100644
index 0000000000..ddb7bd4391
--- /dev/null
+++ b/catalog-ui/src/app/models/properties-inputs/property-declare-api-model.ts
@@ -0,0 +1,18 @@
+'use strict';
+import { PropertyBEModel, PropertyFEModel, DerivedFEProperty } from "../../models";
+
+
+export class PropertyDeclareAPIModel extends PropertyBEModel{
+ input: PropertyBEModel;
+ propertiesName: string;
+
+
+ constructor(property: PropertyFEModel, childProperty?: DerivedFEProperty) {
+ super(property);
+ if (childProperty) {
+ this.input = childProperty;
+ this.propertiesName = childProperty.propertiesName;
+ }
+ }
+
+}
diff --git a/catalog-ui/src/app/models/properties-inputs/property-fe-model.ts b/catalog-ui/src/app/models/properties-inputs/property-fe-model.ts
index cfbe6d64c7..bfb6462f63 100644
--- a/catalog-ui/src/app/models/properties-inputs/property-fe-model.ts
+++ b/catalog-ui/src/app/models/properties-inputs/property-fe-model.ts
@@ -6,11 +6,12 @@ import { FilterPropertiesAssignmentData, PropertyBEModel, DerivedPropertyType, D
export class PropertyFEModel extends PropertyBEModel {
expandedChildPropertyId: string;
- flattenedChildren: Array<DerivedFEProperty>; //[parentPath] : Array<DerivedFEProp>
+ flattenedChildren: Array<DerivedFEProperty>;
isDeclared: boolean;
isDisabled: boolean;
isSelected: boolean;
isSimpleType: boolean; //for convenience only - we can really just check if derivedDataType == derivedPropertyTypes.SIMPLE to know if the prop is simple
+ propertiesName: string;
uniqueId: string;
valueObj: any; //this is the only value we relate to in the html templates
derivedDataType: DerivedPropertyType;
@@ -21,6 +22,7 @@ export class PropertyFEModel extends PropertyBEModel {
this.setNonDeclared();
this.derivedDataType = this.getDerivedPropertyType();
this.flattenedChildren = [];
+ this.propertiesName = this.name;
}
@@ -29,7 +31,7 @@ export class PropertyFEModel extends PropertyBEModel {
//TODO: handle this.derivedDataType == DerivedPropertyType.MAP
if (this.derivedDataType == DerivedPropertyType.LIST && this.schema.property.type == PROPERTY_TYPES.JSON) {
try {
- return JSON.stringify(this.valueObj.map(item => JSON.parse(item)));
+ return JSON.stringify(this.valueObj.map(item => (typeof item == 'string')? JSON.parse(item) : item));
} catch (e){}
}
@@ -37,7 +39,7 @@ export class PropertyFEModel extends PropertyBEModel {
}
public setNonDeclared = (childPath?: string): void => {
- if (!childPath) { //declaring a child prop
+ if (!childPath) { //un-declaring a child prop
this.isDeclared = false;
} else {
let childProp: DerivedFEProperty = this.flattenedChildren.find(child => child.propertiesName == childPath);
@@ -51,6 +53,7 @@ export class PropertyFEModel extends PropertyBEModel {
this.isDeclared = true;
} else {
let childProp: DerivedFEProperty = this.flattenedChildren.find(child => child.propertiesName == childNameToDeclare);
+ if (!childProp) { console.log("ERROR: Unabled to find child: " + childNameToDeclare, this); return; }
childProp.isSelected = false;
childProp.isDeclared = true;
}
diff --git a/catalog-ui/src/app/models/properties-inputs/property-input-detail.ts b/catalog-ui/src/app/models/properties-inputs/property-input-detail.ts
new file mode 100644
index 0000000000..03f7b4090b
--- /dev/null
+++ b/catalog-ui/src/app/models/properties-inputs/property-input-detail.ts
@@ -0,0 +1,6 @@
+export class PropertyInputDetail {
+ inputId: string;
+ inputName: string;
+ inputPath: string;
+ list: boolean;
+}