summaryrefslogtreecommitdiffstats
path: root/catalog-ui/src/app/models/properties-inputs/input-fe-model.ts
diff options
context:
space:
mode:
Diffstat (limited to 'catalog-ui/src/app/models/properties-inputs/input-fe-model.ts')
-rw-r--r--catalog-ui/src/app/models/properties-inputs/input-fe-model.ts57
1 files changed, 29 insertions, 28 deletions
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;
+ }
+ }
+};