summaryrefslogtreecommitdiffstats
path: root/catalog-ui/src/app/view-models
diff options
context:
space:
mode:
authoraribeiro <anderson.ribeiro@est.tech>2021-07-15 09:18:37 +0100
committeraribeiro <anderson.ribeiro@est.tech>2021-08-06 17:22:20 +0100
commit47bcc63a9daff1f310125fed006f27c93656fa83 (patch)
tree3c61670b039c0e63d14880f909e6047d54776492 /catalog-ui/src/app/view-models
parent0ed125f98ae8ea9e80c855a640c328654660d081 (diff)
Retrieve data types based on component model
Issue-ID: SDC-3660 Signed-off-by: aribeiro <anderson.ribeiro@est.tech> Change-Id: I09c533eb39277532b29e581e4dd57e9df952e8e6
Diffstat (limited to 'catalog-ui/src/app/view-models')
-rw-r--r--catalog-ui/src/app/view-models/forms/property-forms/base-property-form/property-form-base-model.ts2
-rw-r--r--catalog-ui/src/app/view-models/forms/property-forms/component-property-form/property-form-view-model.ts5
-rw-r--r--catalog-ui/src/app/view-models/forms/property-forms/select-datatype-modal/select-datatype-modal-view-model.ts8
-rw-r--r--catalog-ui/src/app/view-models/forms/property-forms/select-datatype-modal/select-datatype-modal-view.html2
-rw-r--r--catalog-ui/src/app/view-models/workspace/tabs/general/general-view-model.ts1
5 files changed, 13 insertions, 5 deletions
diff --git a/catalog-ui/src/app/view-models/forms/property-forms/base-property-form/property-form-base-model.ts b/catalog-ui/src/app/view-models/forms/property-forms/base-property-form/property-form-base-model.ts
index 1f922cdaf9..5e48dc8115 100644
--- a/catalog-ui/src/app/view-models/forms/property-forms/base-property-form/property-form-base-model.ts
+++ b/catalog-ui/src/app/view-models/forms/property-forms/base-property-form/property-form-base-model.ts
@@ -135,7 +135,7 @@ export abstract class PropertyFormBaseView {
this.$scope.property = new PropertyModel(this.originalProperty); //we create a new Object so if user press cance we won't update the property
this.$scope.types = PROPERTY_DATA.TYPES; //All types - simple type + map + list
this.$scope.simpleTypes = PROPERTY_DATA.SIMPLE_TYPES; //All simple types
- this.$scope.dataTypes = this.DataTypesService.getAllDataTypes(); //Get all data types in service
+ this.$scope.dataTypes = this.DataTypesService.getAllDataTypesFromModel(this.component.model.name); //Get all data types in service
this.$scope.modalPropertyFormBase = this.$uibModalInstance;
this.$scope.isNew = !angular.isDefined(this.$scope.property.name);
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 c63dd8a208..c36a242c2a 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
@@ -59,6 +59,7 @@ interface IPropertyFormViewModelScope extends ng.IScope {
isPropertyValueOwner:boolean;
isVnfConfiguration:boolean;
constraints:string[];
+ modelNameFilter:string;
validateJson(json:string):boolean;
save(doNotCloseModal?:boolean):void;
@@ -125,7 +126,6 @@ export class PropertyFormViewModel {
private workspaceService: WorkspaceService) {
this.formState = angular.isDefined(property.name) ? FormState.UPDATE : FormState.CREATE;
-
this.initScope();
}
@@ -203,9 +203,10 @@ export class PropertyFormViewModel {
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.getAllDataTypes();
+ 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),
diff --git a/catalog-ui/src/app/view-models/forms/property-forms/select-datatype-modal/select-datatype-modal-view-model.ts b/catalog-ui/src/app/view-models/forms/property-forms/select-datatype-modal/select-datatype-modal-view-model.ts
index ab4b033c0e..9be3b642b4 100644
--- a/catalog-ui/src/app/view-models/forms/property-forms/select-datatype-modal/select-datatype-modal-view-model.ts
+++ b/catalog-ui/src/app/view-models/forms/property-forms/select-datatype-modal/select-datatype-modal-view-model.ts
@@ -20,7 +20,7 @@
'use strict';
import {DataTypesService} from "app/services/data-types-service";
-import {PropertyModel, InputPropertyBase, Component} from "app/models";
+import {PropertyModel, InputPropertyBase, Component, DataTypesMap} from "app/models";
import {IPropertyFormBaseViewScope, PropertyFormBaseView} from "../base-property-form/property-form-base-model";
import {PROPERTY_TYPES} from "app/utils/constants";
@@ -31,6 +31,7 @@ interface ISelectDataTypeViewModelScope extends IPropertyFormBaseViewScope {
isTypeDataType:boolean;
myValue:any;
isReadOnly:boolean;
+ modelNameFilter:string;
}
export class SelectDataTypeViewModel extends PropertyFormBaseView {
@@ -62,6 +63,7 @@ export class SelectDataTypeViewModel extends PropertyFormBaseView {
this.$templateCache.put("select-datatype-modal-view.html", require('app/view-models/forms/property-forms/select-datatype-modal/select-datatype-modal-view.html'));
this.$scope.innerViewSrcUrl = "select-datatype-modal-view.html";
+ this.$scope.modelNameFilter = this.component.model.name;
this.initChildScope();
}
@@ -114,4 +116,8 @@ export class SelectDataTypeViewModel extends PropertyFormBaseView {
this.initForNotSimpleType();
this.removeSelected();
}
+
+ public getAllDataTypesFromModel = (modelName: string): DataTypesMap => {
+ return this.DataTypesService.getAllDataTypesFromModel(modelName);
+ }
}
diff --git a/catalog-ui/src/app/view-models/forms/property-forms/select-datatype-modal/select-datatype-modal-view.html b/catalog-ui/src/app/view-models/forms/property-forms/select-datatype-modal/select-datatype-modal-view.html
index d22741f81a..f95a7e0782 100644
--- a/catalog-ui/src/app/view-models/forms/property-forms/select-datatype-modal/select-datatype-modal-view.html
+++ b/catalog-ui/src/app/view-models/forms/property-forms/select-datatype-modal/select-datatype-modal-view.html
@@ -13,7 +13,7 @@
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
-<div data-ng-if="dataTypes" class="default-value-section i-sdc-form-item">
+<div data-ng-if="getAllDataTypesFromModel(modelNameFilter)" class="default-value-section i-sdc-form-item">
<label class="i-sdc-form-label">Default Value</label>
<div data-ng-if="isTypeDataType">
<select-fields-structure value-obj-ref="myValue"
diff --git a/catalog-ui/src/app/view-models/workspace/tabs/general/general-view-model.ts b/catalog-ui/src/app/view-models/workspace/tabs/general/general-view-model.ts
index 391b6ee2b7..20eaec6aad 100644
--- a/catalog-ui/src/app/view-models/workspace/tabs/general/general-view-model.ts
+++ b/catalog-ui/src/app/view-models/workspace/tabs/general/general-view-model.ts
@@ -38,6 +38,7 @@ import {Component, IAppConfigurtaion, ICsarComponent, IMainCategory, IMetadataKe
import {IWorkspaceViewModelScope} from "app/view-models/workspace/workspace-view-model";
import {CATEGORY_SERVICE_METADATA_KEYS, PREVIOUS_CSAR_COMPONENT} from "../../../../utils/constants";
import {Observable} from "rxjs";
+import {Model} from "../../../../models/model";
export class Validation {
componentNameValidationPattern:RegExp;