diff options
author | Tal Gitelman <tg851x@intl.att.com> | 2017-07-03 20:16:55 +0300 |
---|---|---|
committer | Tal Gitelman <tg851x@intl.att.com> | 2017-07-03 20:16:55 +0300 |
commit | 153a35821f0d25ce23cca467b76c5a7c5092c744 (patch) | |
tree | 0c66c4d1310019479e446ea3a4c26faffb0aa33f /catalog-ui/src/app/ng2/pages/properties-assignment/properties-assignment.page.component.ts | |
parent | ffdda7d685029d6a88ac82ac637e43bba96423cb (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/ng2/pages/properties-assignment/properties-assignment.page.component.ts')
-rw-r--r-- | catalog-ui/src/app/ng2/pages/properties-assignment/properties-assignment.page.component.ts | 37 |
1 files changed, 22 insertions, 15 deletions
diff --git a/catalog-ui/src/app/ng2/pages/properties-assignment/properties-assignment.page.component.ts b/catalog-ui/src/app/ng2/pages/properties-assignment/properties-assignment.page.component.ts index e66ed59ad7..3efe866479 100644 --- a/catalog-ui/src/app/ng2/pages/properties-assignment/properties-assignment.page.component.ts +++ b/catalog-ui/src/app/ng2/pages/properties-assignment/properties-assignment.page.component.ts @@ -22,7 +22,8 @@ import {EventListenerService} from "app/services/event-listener-service" export class PropertiesAssignmentComponent { title = "Properties & Inputs"; - component:ComponentData; + component: ComponentData; + componentInstanceNamesMap: Map<string, string> = new Map<string, string>();//instanceUniqueId, name propertiesNavigationData = []; instancesNavigationData = []; @@ -80,7 +81,7 @@ export class PropertiesAssignmentComponent { .getComponentInputs(this.component) .subscribe(response => { _.forEach(response.inputs, (input: InputBEModel) => { - this.inputs.push(new InputFEModel(input)); + this.inputs.push(new InputFEModel(input)); //only push items that were declared via SDC }); this.loadingInputs = false; @@ -92,6 +93,7 @@ export class PropertiesAssignmentComponent { _.forEach(this.instances, (instance) => { this.instancesNavigationData.push(instance); + this.componentInstanceNamesMap[instance.uniqueId] = instance.name; }); this.loadingInstances = false; if (this.instancesNavigationData[0] == undefined) { @@ -129,12 +131,12 @@ export class PropertiesAssignmentComponent { this.selectedInstanceType = resourceInstance.originType; this.loadingProperties = true; - if(resourceInstance.originType === ResourceType.VF) { + if(this.isInput(resourceInstance.originType)) { this.componentInstanceServiceNg2 .getComponentInstanceInputs(this.component, resourceInstance) .subscribe(response => { instanceBePropertiesMap[resourceInstance.uniqueId] = response; - this.processInstancePropertiesResponse(instanceBePropertiesMap); + this.processInstancePropertiesResponse(instanceBePropertiesMap, true); this.loadingProperties = false; }); @@ -143,7 +145,7 @@ export class PropertiesAssignmentComponent { .getComponentInstanceProperties(this.component, resourceInstance.uniqueId) .subscribe(response => { instanceBePropertiesMap[resourceInstance.uniqueId] = response; - this.processInstancePropertiesResponse(instanceBePropertiesMap); + this.processInstancePropertiesResponse(instanceBePropertiesMap, false); this.loadingProperties = false; }); } @@ -159,8 +161,8 @@ export class PropertiesAssignmentComponent { /** * Entry point handling response from server */ - processInstancePropertiesResponse = (instanceBePropertiesMap:InstanceBePropertiesMap) => { - this.instanceFePropertiesMap = this.propertiesUtils.convertPropertiesMapToFEAndCreateChildren(instanceBePropertiesMap, this.inputs); //create flattened children, disable declared props, and init values + processInstancePropertiesResponse = (instanceBePropertiesMap: InstanceBePropertiesMap, originTypeIsVF: boolean) => { + this.instanceFePropertiesMap = this.propertiesUtils.convertPropertiesMapToFEAndCreateChildren(instanceBePropertiesMap, originTypeIsVF, this.inputs); //create flattened children, disable declared props, and init values this.checkedPropertiesCount = 0; }; @@ -171,7 +173,7 @@ export class PropertiesAssignmentComponent { // Copying the actual value from the object ref into the value if it's from a complex type event.value = event.getJSONValue(); - if (this.selectedInstanceData.originType === ResourceType.VF) { + if (this.isInput(this.selectedInstanceData.originType)) { console.log("I want to update input value on the resource instance"); let inputToUpdate = new PropertyBEModel(event); this.componentInstanceServiceNg2 @@ -279,7 +281,7 @@ export class PropertiesAssignmentComponent { }); let inputsToCreate: InstancePropertiesAPIMap; - if (this.selectedInstanceType !== ResourceType.VF) { + if (!this.isInput(this.selectedInstanceType)) { inputsToCreate = new InstancePropertiesAPIMap(null, selectedProperties); } else { inputsToCreate = new InstancePropertiesAPIMap(selectedProperties, null); @@ -301,12 +303,12 @@ export class PropertiesAssignmentComponent { updatePropertyValueAfterDeclare = (input: InputFEModel) => { if (this.instanceFePropertiesMap[input.instanceUniqueId]) { let propertyForUpdatindVal = _.find(this.instanceFePropertiesMap[input.instanceUniqueId], (feProperty: PropertyFEModel) => { - return feProperty.name == input.relatedProperty.name; + return feProperty.name == input.relatedPropertyName; }); - - propertyForUpdatindVal.setAsDeclared(input.relatedProperty.nestedPath); //set prop as declared before assigning value - this.propertiesService.disableRelatedProperties(propertyForUpdatindVal, input.relatedProperty.nestedPath); - this.propertiesUtils.resetPropertyValue(propertyForUpdatindVal, input.relatedProperty.value, input.relatedProperty.nestedPath); + let inputPath = (input.inputPath && input.inputPath != propertyForUpdatindVal.name) ? input.inputPath : undefined; + propertyForUpdatindVal.setAsDeclared(inputPath); //set prop as declared before assigning value + this.propertiesService.disableRelatedProperties(propertyForUpdatindVal, inputPath); + this.propertiesUtils.resetPropertyValue(propertyForUpdatindVal, input.relatedPropertyValue, inputPath); } } @@ -357,7 +359,7 @@ export class PropertiesAssignmentComponent { .filterComponentInstanceProperties(this.component, filterData) .subscribe(response => { - this.processInstancePropertiesResponse(response); + this.processInstancePropertiesResponse(response, false); this.hierarchyPropertiesDisplayOptions.searchText = filterData.propertyName;//mark results in tree this.searchPropertyName = filterData.propertyName;//mark in table this.renderer.invokeElementMethod(this.hierarchyNavTabs, 'triggerTabChange', ['Composition']); @@ -373,6 +375,7 @@ export class PropertiesAssignmentComponent { this.hierarchyPropertiesDisplayOptions.searchText = ""; this.displayClearSearch = false; this.advanceSearch.clearAll(); + this.searchQuery = ''; }; clickOnClearSearch = () => { @@ -382,4 +385,8 @@ export class PropertiesAssignmentComponent { this.hierarchyNavTabs, 'triggerTabChange', ['Composition']); }; + private isInput = (instanceType:string):boolean =>{ + return instanceType === ResourceType.VF || instanceType === ResourceType.PNF; + } + } |