Retrieve data types based on component model
Issue-ID: SDC-3660
Signed-off-by: aribeiro <anderson.ribeiro@est.tech>
Change-Id: I09c533eb39277532b29e581e4dd57e9df952e8e6
diff --git a/catalog-ui/src/app/app.ts b/catalog-ui/src/app/app.ts
index 5cb4e8d..87930fd 100644
--- a/catalog-ui/src/app/app.ts
+++ b/catalog-ui/src/app/app.ts
@@ -663,7 +663,7 @@
// $http.defaults.headers.common.Authorization = 'Basic YmVlcDpib29w';
$http.defaults.headers.common[cookieService.getUserIdSuffix()] = cookieService.getUserId();
- DataTypesService.initDataTypes();
+ DataTypesService.fetchDataTypesByModel(null);
//handle stateChangeStart
let internalDeregisterStateChangeStartWatcher: Function = (): void => {
diff --git a/catalog-ui/src/app/models/components/component.ts b/catalog-ui/src/app/models/components/component.ts
index a60d7be..a2d28eb 100644
--- a/catalog-ui/src/app/models/components/component.ts
+++ b/catalog-ui/src/app/models/components/component.ts
@@ -36,6 +36,7 @@
import { PolicyInstance } from "app/models/graph/zones/policy-instance";
import { GroupInstance } from "../graph/zones/group-instance";
import { Metadata } from "app/models/metadata";
+import {Model} from "../model";
// import {}
diff --git a/catalog-ui/src/app/models/data-types.ts b/catalog-ui/src/app/models/data-types.ts
index d72211c..7004b43 100644
--- a/catalog-ui/src/app/models/data-types.ts
+++ b/catalog-ui/src/app/models/data-types.ts
@@ -24,6 +24,7 @@
'use strict';
import {PropertyBEModel} from "./properties-inputs/property-be-model";
import {AttributeBEModel} from "./attributes-outputs/attribute-be-model";
+import {Model} from "./model";
export class DataTypeModel {
@@ -36,6 +37,7 @@
modificationTime:string;
properties: Array<PropertyBEModel>;
attributes: Array<AttributeBEModel>;
+ model: Model;
constructor(dataType:DataTypeModel) {
if (dataType) {
@@ -46,6 +48,7 @@
this.modificationTime = dataType.modificationTime;
this.properties = dataType.properties;
this.attributes = dataType.attributes;
+ this.model = this.model;
}
}
diff --git a/catalog-ui/src/app/models/model.ts b/catalog-ui/src/app/models/model.ts
index 239d86e..a5e6021 100644
--- a/catalog-ui/src/app/models/model.ts
+++ b/catalog-ui/src/app/models/model.ts
@@ -17,6 +17,13 @@
* ============LICENSE_END=========================================================
*/
-interface Model {
- name:string;
+export class Model {
+ name: string;
+
+ constructor(param?: any) {
+ if (param) {
+ this.name = param;
+ }
+ }
+
}
diff --git a/catalog-ui/src/app/ng2/pages/attributes-outputs/attribute-creator/attribute-creator.component.ts b/catalog-ui/src/app/ng2/pages/attributes-outputs/attribute-creator/attribute-creator.component.ts
index 5fc3d5b..96ec935 100644
--- a/catalog-ui/src/app/ng2/pages/attributes-outputs/attribute-creator/attribute-creator.component.ts
+++ b/catalog-ui/src/app/ng2/pages/attributes-outputs/attribute-creator/attribute-creator.component.ts
@@ -27,6 +27,7 @@
import {PROPERTY_TYPES} from '../../../../utils';
import {AttributeBEModel} from "../../../../models/attributes-outputs/attribute-be-model";
import {Validation} from "../../../../view-models/workspace/tabs/general/general-view-model";
+import {WorkspaceService} from "../../workspace/workspace.service";
@Component({
selector: 'attribute-creator',
@@ -43,7 +44,7 @@
dataTypes: DataTypesMap;
isLoading: boolean;
- constructor(protected dataTypeService: DataTypeService) {
+ constructor(protected dataTypeService: DataTypeService, protected workspaceService: WorkspaceService) {
}
ngOnInit() {
@@ -51,7 +52,7 @@
this.attributeModel.type = '';
this.attributeModel.schema.property.type = '';
const types: string[] = PROPERTY_DATA.TYPES; // All types - simple type + map + list
- this.dataTypes = this.dataTypeService.getAllDataTypes(); // Get all data types in service
+ this.dataTypes = this.dataTypeService.getDataTypeByModel(this.workspaceService.metadata.model); // Get all data types in service
const nonPrimitiveTypes: string[] = _.filter(Object.keys(this.dataTypes), (type: string) => {
return types.indexOf(type) === -1;
});
diff --git a/catalog-ui/src/app/ng2/pages/interface-operation/operation-creator/param-row/param-row.component.ts b/catalog-ui/src/app/ng2/pages/interface-operation/operation-creator/param-row/param-row.component.ts
index 76cf73f..8227229 100644
--- a/catalog-ui/src/app/ng2/pages/interface-operation/operation-creator/param-row/param-row.component.ts
+++ b/catalog-ui/src/app/ng2/pages/interface-operation/operation-creator/param-row/param-row.component.ts
@@ -3,6 +3,7 @@
import {DataTypeService} from "app/ng2/services/data-type.service";
import {OperationModel, OperationParameter, InputBEModel, DataTypeModel, Capability} from 'app/models';
import {DropdownValue} from "app/ng2/components/ui/form-components/dropdown/ui-element-dropdown.component";
+import {WorkspaceService} from "../../../workspace/workspace.service";
class DropdownValueType extends DropdownValue {
type: String;
@@ -37,7 +38,7 @@
filteredInputProps: Array<DropdownValue> = [];
filteredCapabilitiesProps: Array<{capabilityName: string, properties: Array<DropdownValueType>}> = [];
- constructor(private dataTypeService:DataTypeService) {}
+ constructor(private dataTypeService:DataTypeService, protected workspaceService: WorkspaceService) {}
ngOnInit() {
if (this.isInputParam) {
@@ -58,7 +59,7 @@
)
);
} else {
- const dataTypes: Array<DataTypeModel> = _.toArray(this.dataTypeService.getAllDataTypes());
+ const dataTypes: Array<DataTypeModel> = _.toArray(this.dataTypeService.getDataTypeByModel(this.workspaceService.metadata.model));
this.propTypeEnum = _.concat(
_.map(
_.filter(
@@ -170,7 +171,7 @@
getPrimitiveSubtypes(): Array<InputBEModel> {
const flattenedProps: Array<any> = [];
- const dataTypes = this.dataTypeService.getAllDataTypes();
+ const dataTypes = this.dataTypeService.getDataTypeByModel(this.workspaceService.metadata.model);
_.forEach(this.inputProps, prop => {
const type:DataTypeModel = _.find(
diff --git a/catalog-ui/src/app/ng2/pages/properties-assignment/declare-list/declare-list.component.ts b/catalog-ui/src/app/ng2/pages/properties-assignment/declare-list/declare-list.component.ts
index 8ca4f44..cb90b8b 100644
--- a/catalog-ui/src/app/ng2/pages/properties-assignment/declare-list/declare-list.component.ts
+++ b/catalog-ui/src/app/ng2/pages/properties-assignment/declare-list/declare-list.component.ts
@@ -29,6 +29,7 @@
import { PROPERTY_DATA } from 'app/utils';
import * as _ from 'lodash';
import { PROPERTY_TYPES } from '../../../../utils';
+import {WorkspaceService} from "../../workspace/workspace.service";
@Component({
selector: 'declare-list',
@@ -50,7 +51,7 @@
propertiesListString: string;
privateDataType: DataTypeModel;
- constructor(protected dataTypeService: DataTypeService, private modalService: ModalService) {}
+ constructor(protected dataTypeService: DataTypeService, private modalService: ModalService, private workspaceService: WorkspaceService) {}
ngOnInit() {
console.log('DeclareListComponent.ngOnInit() - enter');
@@ -59,7 +60,7 @@
this.propertyModel.schema.property.type = '';
this.propertyModel.required = false;
const types: string[] = PROPERTY_DATA.TYPES; // All types - simple type + map + list
- this.dataTypes = this.dataTypeService.getAllDataTypes(); // Get all data types in service
+ this.dataTypes = this.dataTypeService.getDataTypeByModel(this.workspaceService.metadata.model); // Get all data types in service
const nonPrimitiveTypes: string[] = _.filter(Object.keys(this.dataTypes), (type: string) => {
return types.indexOf(type) === -1;
});
diff --git a/catalog-ui/src/app/ng2/pages/properties-assignment/properties-assignment.module.ts b/catalog-ui/src/app/ng2/pages/properties-assignment/properties-assignment.module.ts
index ae4aa57..10273e2 100644
--- a/catalog-ui/src/app/ng2/pages/properties-assignment/properties-assignment.module.ts
+++ b/catalog-ui/src/app/ng2/pages/properties-assignment/properties-assignment.module.ts
@@ -36,12 +36,13 @@
import {SdcUiComponentsModule} from "onap-ui-angular";
import {ModalFormsModule} from "app/ng2/components/ui/forms/modal-forms.module";
import {HierarchyNavigationModule} from "../../components/logic/hierarchy-navigtion/hierarchy-navigation.module";
+import {PropertyCreatorComponent} from "./property-creator/property-creator.component";
@NgModule({
declarations: [
PropertiesAssignmentComponent,
InputsTableComponent,
- FilterPropertiesAssignmentComponent
+ FilterPropertiesAssignmentComponent,
],
imports: [
BrowserModule,
@@ -59,7 +60,7 @@
exports: [
PropertiesAssignmentComponent
],
- providers: [PropertiesService, HierarchyNavService, PropertiesUtils, InputsUtils, DataTypeService, ComponentModeService]
+ providers: [PropertiesService, HierarchyNavService, PropertiesUtils, InputsUtils, DataTypeService, ComponentModeService, PropertyCreatorComponent]
})
export class PropertiesAssignmentModule {
diff --git a/catalog-ui/src/app/ng2/pages/properties-assignment/properties-assignment.page.component.html b/catalog-ui/src/app/ng2/pages/properties-assignment/properties-assignment.page.component.html
index 8847e96..b54cbc9 100644
--- a/catalog-ui/src/app/ng2/pages/properties-assignment/properties-assignment.page.component.html
+++ b/catalog-ui/src/app/ng2/pages/properties-assignment/properties-assignment.page.component.html
@@ -87,7 +87,7 @@
</div>
<div class="right-column">
<div *ngIf="!isReadonly && !isInputsTabSelected" class="add-btn"
- (click)="addProperty()" data-tests-id="properties-add-button" [ngClass]="{'disabled': !isSelf()}">Add Property</div>
+ (click)="addProperty(component.model)" data-tests-id="properties-add-button" [ngClass]="{'disabled': !isSelf()}">Add Property</div>
<div *ngIf="!isReadonly && isInputsTabSelected" class="add-btn"
(click)="addInput()" [ngClass]="{'disabled': !isSelf()}">Add Input</div>
<tabs #hierarchyNavTabs tabStyle="simple-tabs" class="gray-border">
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 6d009a8..fbbc4d8 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
@@ -67,6 +67,7 @@
import {Observable} from "rxjs";
import {ToscaGetFunctionType} from "../../../models/tosca-get-function-type.enum";
import {TranslateService} from "../../shared/translator/translate.service";
+import {Model} from '../../../models/model';
const SERVICE_SELF_TITLE = "SELF";
@Component({
@@ -130,6 +131,7 @@
private inputsUtils: InputsUtils,
private componentServiceNg2: ComponentServiceNg2,
private componentInstanceServiceNg2: ComponentInstanceServiceNg2,
+ private propertyCreatorComponent: PropertyCreatorComponent,
@Inject("$stateParams") _stateParams,
@Inject("$scope") private $scope: ng.IScope,
@Inject("$state") private $state: ng.ui.IStateService,
@@ -220,6 +222,8 @@
});
}
});
+
+ this.loadDataTypesByComponentModel(this.component.model);
};
ngOnDestroy() {
@@ -1142,7 +1146,8 @@
}
/*** addProperty ***/
- addProperty = () => {
+ addProperty = (model: Model) => {
+ this.loadDataTypesByComponentModel(model)
let modalTitle = 'Add Property';
let modal = this.ModalService.createCustomModal(new ModalModel(
'sm',
@@ -1172,8 +1177,8 @@
],
null
));
- this.ModalService.addDynamicContentToModal(modal, PropertyCreatorComponent, {});
modal.instance.open();
+ this.ModalService.addDynamicContentToModal(modal, PropertyCreatorComponent, {});
}
/*** addInput ***/
@@ -1245,6 +1250,10 @@
private isInput = (instanceType:string):boolean =>{
return instanceType === ResourceType.VF || instanceType === ResourceType.PNF || instanceType === ResourceType.CVFC || instanceType === ResourceType.CR;
}
-
+
+ loadDataTypesByComponentModel(model:Model) {
+ let modelName = new Model(model).name;
+ this.propertyCreatorComponent.filterDataTypesByModel(modelName);
+ }
}
diff --git a/catalog-ui/src/app/ng2/pages/properties-assignment/property-creator/property-creator.component.ts b/catalog-ui/src/app/ng2/pages/properties-assignment/property-creator/property-creator.component.ts
index 8167caa..57c9f97 100644
--- a/catalog-ui/src/app/ng2/pages/properties-assignment/property-creator/property-creator.component.ts
+++ b/catalog-ui/src/app/ng2/pages/properties-assignment/property-creator/property-creator.component.ts
@@ -7,6 +7,7 @@
import * as _ from 'lodash';
import { PROPERTY_TYPES } from '../../../../utils';
import {Validation} from "../../../../view-models/workspace/tabs/general/general-view-model";
+import {WorkspaceService} from "../../workspace/workspace.service";
@Component({
selector: 'property-creator',
@@ -23,34 +24,8 @@
dataTypes: DataTypesMap;
isLoading: boolean;
- constructor(protected dataTypeService: DataTypeService) {}
-
- ngOnInit() {
- this.propertyModel = new PropertyBEModel();
- this.propertyModel.type = '';
- this.propertyModel.schema.property.type = '';
- const types: string[] = PROPERTY_DATA.TYPES; // All types - simple type + map + list
- this.dataTypes = this.dataTypeService.getAllDataTypes(); // Get all data types in service
- const nonPrimitiveTypes: string[] = _.filter(Object.keys(this.dataTypes), (type: string) => {
- return types.indexOf(type) === -1;
- });
-
- this.typesProperties = _.map(PROPERTY_DATA.TYPES,
- (type: string) => new DropdownValue(type, type)
- );
- const typesSimpleProperties = _.map(PROPERTY_DATA.SIMPLE_TYPES,
- (type: string) => new DropdownValue(type, type)
- );
- const nonPrimitiveTypesValues = _.map(nonPrimitiveTypes,
- (type: string) => new DropdownValue(type,
- type.replace('org.openecomp.datatypes.heat.', ''))
- )
- .sort((a, b) => a.label.localeCompare(b.label));
- this.typesProperties = _.concat(this.typesProperties, nonPrimitiveTypesValues);
- this.typesSchemaProperties = _.concat(typesSimpleProperties, nonPrimitiveTypesValues);
- this.typesProperties.unshift(new DropdownValue('', 'Select Type...'));
- this.typesSchemaProperties.unshift(new DropdownValue('', 'Select Schema Type...'));
-
+ constructor(protected dataTypeService: DataTypeService, private workspaceService: WorkspaceService) {
+ this.filterDataTypesByModel(this.workspaceService.metadata.model);
}
checkFormValidForSubmit() {
@@ -74,4 +49,32 @@
}
}
+ public filterDataTypesByModel = (modelName: string) => {
+ this.dataTypes = new DataTypesMap(null);
+ this.dataTypes = this.dataTypeService.getDataTypeByModel(modelName);
+ this.propertyModel = new PropertyBEModel();
+ this.propertyModel.type = '';
+ this.propertyModel.schema.property.type = '';
+ const types: string[] = PROPERTY_DATA.TYPES; // All types - simple type + map + list
+ const nonPrimitiveTypes: string[] = _.filter(Object.keys(this.dataTypes), (type: string) => {
+ return types.indexOf(type) === -1;
+ });
+
+ this.typesProperties = _.map(PROPERTY_DATA.TYPES,
+ (type: string) => new DropdownValue(type, type)
+ );
+ const typesSimpleProperties = _.map(PROPERTY_DATA.SIMPLE_TYPES,
+ (type: string) => new DropdownValue(type, type)
+ );
+ const nonPrimitiveTypesValues = _.map(nonPrimitiveTypes,
+ (type: string) => new DropdownValue(type,
+ type.replace('org.openecomp.datatypes.heat.', ''))
+ )
+ .sort((a, b) => a.label.localeCompare(b.label));
+ this.typesProperties = _.concat(this.typesProperties, nonPrimitiveTypesValues);
+ this.typesSchemaProperties = _.concat(typesSimpleProperties, nonPrimitiveTypesValues);
+ this.typesProperties.unshift(new DropdownValue('', 'Select Type...'));
+ this.typesSchemaProperties.unshift(new DropdownValue('', 'Select Schema Type...'));
+ }
+
}
diff --git a/catalog-ui/src/app/ng2/services/data-type.service.ts b/catalog-ui/src/app/ng2/services/data-type.service.ts
index 30eb6f0..85c8b89 100644
--- a/catalog-ui/src/app/ng2/services/data-type.service.ts
+++ b/catalog-ui/src/app/ng2/services/data-type.service.ts
@@ -47,8 +47,8 @@
return this.dataTypes[typeName];
}
- public getAllDataTypes(): DataTypesMap {
- return this.dataTypes;
+ public getDataTypeByModel(modelName: string): DataTypesMap {
+ return this.dataTypeService.getAllDataTypesFromModel(modelName);
}
public getConstraintsByParentTypeAndUniqueID(rootPropertyType, propertyName){
diff --git a/catalog-ui/src/app/ng2/services/model.service.ts b/catalog-ui/src/app/ng2/services/model.service.ts
index 33d5729..10ad414 100644
--- a/catalog-ui/src/app/ng2/services/model.service.ts
+++ b/catalog-ui/src/app/ng2/services/model.service.ts
@@ -20,6 +20,7 @@
import { Inject, Injectable } from '@angular/core';
import { Observable } from 'rxjs/Observable';
import { ISdcConfig, SdcConfigToken } from '../config/sdc-config.config';
+import {Model} from "../../models/model";
@Injectable()
export class ModelService {
diff --git a/catalog-ui/src/app/ng2/services/responses/component-generic-response.ts b/catalog-ui/src/app/ng2/services/responses/component-generic-response.ts
index 96a2126..fa3de88 100644
--- a/catalog-ui/src/app/ng2/services/responses/component-generic-response.ts
+++ b/catalog-ui/src/app/ng2/services/responses/component-generic-response.ts
@@ -31,6 +31,7 @@
import { InputsGroup } from "../../../models/inputs";
import { InterfaceModel } from "../../../models/operation";
import { OutputBEModel } from "app/models/attributes-outputs/output-be-model";
+import {Model} from "../../../models/model";
export class ComponentGenericResponse implements Serializable<ComponentGenericResponse> {
diff --git a/catalog-ui/src/app/services/data-types-service.ts b/catalog-ui/src/app/services/data-types-service.ts
index 0237b2f..08b49ae 100644
--- a/catalog-ui/src/app/services/data-types-service.ts
+++ b/catalog-ui/src/app/services/data-types-service.ts
@@ -20,7 +20,15 @@
'use strict';
import { DataTypePropertyModel } from "../models/data-type-properties";
-import {ComponentInstance, InputModel, DataTypesMap, PropertyModel, InputPropertyBase, IAppConfigurtaion, SchemaProperty} from "../models";
+import {
+ ComponentInstance,
+ InputModel,
+ DataTypesMap,
+ PropertyModel,
+ InputPropertyBase,
+ IAppConfigurtaion,
+ SchemaProperty
+} from "../models";
import {PROPERTY_DATA} from "../utils/constants";
export interface IDataTypesService {
@@ -32,7 +40,7 @@
selectedInstance:ComponentInstance;
selectedComponentInputs:Array<InputModel>;
//declare methods
- initDataTypes():void;
+ fetchDataTypesByModel(modelName:string):void;
getAllDataTypes():DataTypesMap;
getFirsLevelOfDataTypeProperties(dataTypeName:string):Array<DataTypePropertyModel>;
isDataTypeForSchemaType(property:SchemaProperty):boolean;
@@ -51,9 +59,10 @@
constructor(private sdcConfig:IAppConfigurtaion,
private $q:ng.IQService,
private $http:ng.IHttpService) {
-
}
+ private baseUrl = this.sdcConfig.api.root + this.sdcConfig.api.component_api_root;
+
dataTypes:DataTypesMap; //Data type map
selectedPropertiesName:string;
selectedInput:PropertyModel;
@@ -61,16 +70,23 @@
selectedInstance:ComponentInstance;
selectedComponentInputs:Array<InputModel>;
- public initDataTypes = ():void => {
- this.$http({
- url: this.sdcConfig.api.root + this.sdcConfig.api.component_api_root + "dataTypes",
- method: "get"
- }).then((response:any) => {
+ public fetchDataTypesByModel = (modelName: string):void => {
+ let model;
+ if (modelName) {
+ model = {'model': modelName}
+ }
+ this.$http.get(this.baseUrl+"dataTypes", {params: model})
+ .then((response:any) => {
this.dataTypes = response.data;
delete this.dataTypes['tosca.datatypes.Root'];
});
};
+ public getAllDataTypesFromModel = (modelName: string): DataTypesMap => {
+ this.fetchDataTypesByModel(modelName);
+ return this.dataTypes;
+ }
+
public getAllDataTypes = ():DataTypesMap => {
return this.dataTypes;
};
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 1f922cd..5e48dc8 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 @@
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 c63dd8a..c36a242 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 @@
isPropertyValueOwner:boolean;
isVnfConfiguration:boolean;
constraints:string[];
+ modelNameFilter:string;
validateJson(json:string):boolean;
save(doNotCloseModal?:boolean):void;
@@ -125,7 +126,6 @@
private workspaceService: WorkspaceService) {
this.formState = angular.isDefined(property.name) ? FormState.UPDATE : FormState.CREATE;
-
this.initScope();
}
@@ -203,9 +203,10 @@
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 ab4b033..9be3b64 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 @@
isTypeDataType:boolean;
myValue:any;
isReadOnly:boolean;
+ modelNameFilter:string;
}
export class SelectDataTypeViewModel extends PropertyFormBaseView {
@@ -62,6 +63,7 @@
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 @@
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 d22741f..f95a7e0 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 391b6ee..20eaec6 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 {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;