summaryrefslogtreecommitdiffstats
path: root/catalog-ui
diff options
context:
space:
mode:
authorfranciscovila <javier.paradela.vila@est.tech>2022-05-11 19:38:08 +0100
committerMichael Morris <michael.morris@est.tech>2022-05-17 10:23:40 +0000
commit121251c63b747ca0ffa3d15abfa73054e4c3d692 (patch)
tree8fae5f47be4d4a623e6e1f6605e7ae77215bb394 /catalog-ui
parent23b75f1807cce5418320d0a25aced64f2c2394ed (diff)
Datatypes for a property are not specific to the VFC model
Fix Datatypes dropdown represented values as those were not treated in an asyncrhonous way Issue-ID: SDC-3998 Signed-off-by: franciscovila <javier.paradela.vila@est.tech> Change-Id: If551b1f6a2fa5573dce19ada36e24879ead9102d
Diffstat (limited to 'catalog-ui')
-rw-r--r--catalog-ui/src/app/view-models/forms/property-forms/component-property-form/property-form-view-model.ts38
1 files changed, 17 insertions, 21 deletions
diff --git a/catalog-ui/src/app/view-models/forms/property-forms/component-property-form/property-form-view-model.ts b/catalog-ui/src/app/view-models/forms/property-forms/component-property-form/property-form-view-model.ts
index c36a242c2a..4218123215 100644
--- a/catalog-ui/src/app/view-models/forms/property-forms/component-property-form/property-form-view-model.ts
+++ b/catalog-ui/src/app/view-models/forms/property-forms/component-property-form/property-form-view-model.ts
@@ -48,7 +48,7 @@ interface IPropertyFormViewModelScope extends ng.IScope {
propertyNameValidationPattern:RegExp;
commentValidationPattern:RegExp;
editPropertyModel:IEditPropertyModel;
- modalInstanceProperty:ng.ui.bootstrap.IModalServiceInstance;
+ modalInstanceProperty:ng.ui.bootstrap.IModalServiceInstance;
currentPropertyIndex:number;
isLastProperty:boolean;
myValue:any;
@@ -101,7 +101,7 @@ export class PropertyFormViewModel {
'CompositionService',
'workspaceService'
];
-
+
private formState:FormState;
constructor(private $scope:IPropertyFormViewModelScope,
@@ -134,9 +134,7 @@ export class PropertyFormViewModel {
this.$scope.editPropertyModel.property.type = this.property.type ? this.property.type : null;
this.$scope.editPropertyModel.property.value = this.$scope.editPropertyModel.property.value || this.$scope.editPropertyModel.property.defaultValue;
this.$scope.constraints = this.property.constraints && this.property.constraints[0] ? this.property.constraints[0]["validValues"] : null;
-
this.setMaxLength();
-
};
//init property add-ons labels that show up at the left side of the input.
@@ -193,31 +191,26 @@ export class PropertyFormViewModel {
private initScope = ():void => {
//scope properties
+ this.$scope.isLoading = true;
this.$scope.forms = {};
this.$scope.validationPattern = this.ValidationPattern;
this.$scope.propertyNameValidationPattern = this.PropertyNameValidationPattern;
this.$scope.commentValidationPattern = this.CommentValidationPattern;
- this.$scope.isLoading = false;
this.$scope.isNew = (this.formState === FormState.CREATE);
this.$scope.isService = this.workspaceService.metadata.isService();
this.$scope.modalInstanceProperty = this.$uibModalInstance;
this.$scope.currentPropertyIndex = _.findIndex(this.filteredProperties, i=> i.name == this.property.name);
this.$scope.isLastProperty = this.$scope.currentPropertyIndex == (this.filteredProperties.length - 1);
- this.$scope.dataTypes = this.DataTypesService.getAllDataTypesFromModel(this.workspaceService.metadata.model);
- this.$scope.isPropertyValueOwner = this.isPropertyValueOwner;
- this.$scope.propertyOwnerType = this.propertyOwnerType;
- this.$scope.modelNameFilter = this.workspaceService.metadata.model;
-
this.$scope.editPropertyModel = {
property : new PropertyModel(this.property),
types : PROPERTY_DATA.TYPES,
simpleTypes : PROPERTY_DATA.SIMPLE_TYPES}; //All simple types
-
-
+ this.$scope.isPropertyValueOwner = this.isPropertyValueOwner;
+ this.$scope.propertyOwnerType = this.propertyOwnerType;
+ this.$scope.modelNameFilter = this.workspaceService.metadata.model;
//check if property of VnfConfiguration
this.$scope.isVnfConfiguration = false;
if(this.propertyOwnerType == "component" && angular.isArray(this.compositionService.componentInstances)) {
-
var componentPropertyOwner:ComponentInstance = this.compositionService.componentInstances.find((ci:ComponentInstance) => {
return ci.uniqueId === this.property.resourceInstanceUniqueId;
});
@@ -225,14 +218,9 @@ export class PropertyFormViewModel {
this.$scope.isVnfConfiguration = true;
}
}
-
- this.$scope.nonPrimitiveTypes = _.filter(Object.keys(this.$scope.dataTypes), (type:string)=> {
- return this.$scope.editPropertyModel.types.indexOf(type) == -1;
- });
this.initResource();
this.initForNotSimpleType();
-
this.$scope.validateJson = (json:string):boolean => {
if (!json) {
return true;
@@ -240,6 +228,14 @@ export class PropertyFormViewModel {
return this.ValidationUtils.validateJson(json);
};
+ this.DataTypesService.fetchDataTypesByModel(this.workspaceService.metadata.model).then(response => {
+ this.$scope.dataTypes = response.data as DataTypesMap;
+ this.$scope.nonPrimitiveTypes = _.filter(Object.keys(this.$scope.dataTypes), (type:string)=> {
+ return this.$scope.editPropertyModel.types.indexOf(type) == -1;
+ });
+
+ this.$scope.isLoading = false;
+ });
//scope methods
this.$scope.save = (doNotCloseModal?:boolean):void => {
@@ -291,7 +287,7 @@ export class PropertyFormViewModel {
property.value = myValueString;
}
this.updateInstanceProperties(property.resourceInstanceUniqueId, [property]).subscribe((propertiesFromBE) => onPropertySuccess(propertiesFromBE[0]),
- error => onPropertyFaild(error));
+ error => onPropertyFaild(error));
} else {
if (!this.$scope.editPropertyModel.property.simpleType && !this.$scope.isSimpleType(property.type)) {
let myValueString:string = JSON.stringify(this.$scope.myValue);
@@ -417,7 +413,7 @@ export class PropertyFormViewModel {
return newProperty;
};
return this.topologyTemplateService.addProperty(this.workspaceService.metadata.componentType, this.workspaceService.metadata.uniqueId, property)
- .map(onSuccess);
+ .map(onSuccess);
} else {
let onSuccess = (newProperty: PropertyModel): PropertyModel => {
// find exist instance property in parent component for update the new value ( find bu uniqueId )
@@ -440,4 +436,4 @@ export class PropertyFormViewModel {
};
return this.topologyTemplateService.deleteProperty(this.workspaceService.metadata.componentType, this.workspaceService.metadata.uniqueId, propertyId).map(onSuccess, onFailed);
};
-}
+} \ No newline at end of file