summaryrefslogtreecommitdiffstats
path: root/catalog-ui/src/app/models/properties-inputs
diff options
context:
space:
mode:
authorTal Gitelman <tg851x@intl.att.com>2017-06-29 19:30:00 +0300
committerMichael Lando <ml636r@att.com>2017-06-29 21:32:19 +0300
commited7e1c3dfe332abc67ed943717db2ee94406f95e (patch)
treee0f2f39596656456272900f59aadc3dff6c6e828 /catalog-ui/src/app/models/properties-inputs
parent68ccc45de18f41cddb79de33a245bceb3b063ffb (diff)
[SDC] rebase code
Change-Id: I456ec65a233d277e6bae35e140f2e3da5765bae6 Signed-off-by: Tal Gitelman <tg851x@intl.att.com> Signed-off-by: Michael Lando <ml636r@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.ts42
-rw-r--r--catalog-ui/src/app/models/properties-inputs/input-fe-model.ts57
2 files changed, 40 insertions, 59 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 6d7854a6bf..6767bce729 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,11 +3,17 @@ import {PropertyBEModel} from 'app/models';
* Created by rc2122 on 6/1/2017.
*/
export class InputBEModel extends PropertyBEModel {
- properties:Array<ComponentInstanceProperty>;
- inputs:Array<ComponentInstanceInput>;
+ properties: Array<ComponentInstanceModel>;
+ inputs: Array<ComponentInstanceModel>;
+ instanceUniqueId: string;
+ propertyId: string;
- constructor(input?: PropertyBEModel) {
+ constructor(input?: InputBEModel) {
super(input);
+ this.instanceUniqueId = input.instanceUniqueId;
+ this.propertyId = input.propertyId;
+ this.properties = input.properties;
+ this.inputs = input.inputs;
}
@@ -17,33 +23,7 @@ export class InputBEModel extends PropertyBEModel {
}
-export class ComponentInstanceProperty extends PropertyBEModel {
+export interface ComponentInstanceModel extends InputBEModel {
componentInstanceId:string;
- componentInstanceName:string;
-
- constructor(property?: PropertyBEModel) {
- super(property);
- }
-
-
-
- public toJSON = (): any => {
- };
-
-}
-
-export class ComponentInstanceInput extends InputBEModel {
- componentInstanceId:string;
- componentInstanceName:string;
-
- constructor(property?: PropertyBEModel) {
- super(property);
- }
-
-
-
- public toJSON = (): any => {
- };
-
+ componentInstanceName: string;
}
-
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 4f3417186c..3af4431b55 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,41 +5,42 @@ import {InputBEModel} from "./input-be-model";
export class InputFEModel extends InputBEModel {
isSimpleType: boolean;
- isDataType: boolean;
- instanceName: string;
- instanceId: string;
- propertyName: string;
-
+ relatedProperty: SimpleRelatedProperty;
constructor(input?: InputBEModel) {
super(input);
if (input) {
this.isSimpleType = PROPERTY_DATA.SIMPLE_TYPES.indexOf(this.type) > -1;
- this.isDataType = PROPERTY_DATA.TYPES.indexOf(this.type) == -1;
-
- let propNameIndex:number = this.name.indexOf('_');
- this.instanceName = this.name.substring(0, propNameIndex);
-
- if(input.properties && input.properties.length){
- this.instanceId = input.properties[0].componentInstanceId;
- this.propertyName = input.properties[0].name;
- }else if(input.inputs && input.inputs.length){
- this.instanceId = input.inputs[0].componentInstanceId;
- this.propertyName = input.inputs[0].name;
- }else{
- if (input.inputPath && input.inputPath.indexOf('#') > -1) {
- this.propertyName = input.inputPath.substring(0, input.inputPath.indexOf('#'))
- } else {
- this.inputPath = undefined; //input path may be populated even if its a parent - ensure its empty
- this.propertyName = this.name.substring(propNameIndex + 1);
- }
- }
+ this.relatedProperty = new SimpleRelatedProperty(input);
}
}
+}
+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);
+ }
- public toJSON = (): any => {
- };
-
-}
+ //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;
+ }
+ }
+};