aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-ui/src
diff options
context:
space:
mode:
Diffstat (limited to 'catalog-ui/src')
-rw-r--r--catalog-ui/src/app/app.ts2
-rw-r--r--catalog-ui/src/app/models/components/component.ts1
-rw-r--r--catalog-ui/src/app/models/data-types.ts3
-rw-r--r--catalog-ui/src/app/models/model.ts11
-rw-r--r--catalog-ui/src/app/ng2/pages/attributes-outputs/attribute-creator/attribute-creator.component.ts5
-rw-r--r--catalog-ui/src/app/ng2/pages/interface-operation/operation-creator/param-row/param-row.component.ts7
-rw-r--r--catalog-ui/src/app/ng2/pages/properties-assignment/declare-list/declare-list.component.ts5
-rw-r--r--catalog-ui/src/app/ng2/pages/properties-assignment/properties-assignment.module.ts5
-rw-r--r--catalog-ui/src/app/ng2/pages/properties-assignment/properties-assignment.page.component.html2
-rw-r--r--catalog-ui/src/app/ng2/pages/properties-assignment/properties-assignment.page.component.ts15
-rw-r--r--catalog-ui/src/app/ng2/pages/properties-assignment/property-creator/property-creator.component.ts55
-rw-r--r--catalog-ui/src/app/ng2/services/data-type.service.ts4
-rw-r--r--catalog-ui/src/app/ng2/services/model.service.ts1
-rw-r--r--catalog-ui/src/app/ng2/services/responses/component-generic-response.ts1
-rw-r--r--catalog-ui/src/app/services/data-types-service.ts32
-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
20 files changed, 110 insertions, 57 deletions
diff --git a/catalog-ui/src/app/app.ts b/catalog-ui/src/app/app.ts
index 5cb4e8d4d0..87930fd12e 100644
--- a/catalog-ui/src/app/app.ts
+++ b/catalog-ui/src/app/app.ts
@@ -663,7 +663,7 @@ ng1appModule.run([
// $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 a60d7be6f7..a2d28ebeac 100644
--- a/catalog-ui/src/app/models/components/component.ts
+++ b/catalog-ui/src/app/models/components/component.ts
@@ -36,6 +36,7 @@ import {Relationship} from "../graph/relationship";
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 d72211cc57..7004b43cbc 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 @@ export class DataTypeModel {
modificationTime:string;
properties: Array<PropertyBEModel>;
attributes: Array<AttributeBEModel>;
+ model: Model;
constructor(dataType:DataTypeModel) {
if (dataType) {
@@ -46,6 +48,7 @@ export class DataTypeModel {
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 239d86e827..a5e6021284 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 5fc3d5b5ac..96ec935202 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 * as _ from 'lodash';
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 @@ export class AttributeCreatorComponent {
dataTypes: DataTypesMap;
isLoading: boolean;
- constructor(protected dataTypeService: DataTypeService) {
+ constructor(protected dataTypeService: DataTypeService, protected workspaceService: WorkspaceService) {
}
ngOnInit() {
@@ -51,7 +52,7 @@ export class AttributeCreatorComponent {
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 76cf73ff17..8227229c26 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 {PROPERTY_DATA} from "app/utils";
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 @@ export class ParamRowComponent {
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 @@ export class ParamRowComponent {
)
);
} 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 @@ export class ParamRowComponent {
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 8ca4f44116..cb90b8b83e 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 { ModalService } from 'app/ng2/services/modal.service';
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 @@ export class DeclareListComponent {
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 @@ export class DeclareListComponent {
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 ae4aa57572..10273e2636 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 {ComponentModeService} from "../../services/component-services/component-
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 @@ import {HierarchyNavigationModule} from "../../components/logic/hierarchy-navigt
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 8847e96d18..b54cbc97c2 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 6d009a8039..fbbc4d8b0e 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 {ToscaPresentationData} from "../../../models/tosca-presentation";
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 @@ export class PropertiesAssignmentComponent {
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 @@ export class PropertiesAssignmentComponent {
});
}
});
+
+ this.loadDataTypesByComponentModel(this.component.model);
};
ngOnDestroy() {
@@ -1142,7 +1146,8 @@ export class PropertiesAssignmentComponent {
}
/*** addProperty ***/
- addProperty = () => {
+ addProperty = (model: Model) => {
+ this.loadDataTypesByComponentModel(model)
let modalTitle = 'Add Property';
let modal = this.ModalService.createCustomModal(new ModalModel(
'sm',
@@ -1172,8 +1177,8 @@ export class PropertiesAssignmentComponent {
],
null
));
- this.ModalService.addDynamicContentToModal(modal, PropertyCreatorComponent, {});
modal.instance.open();
+ this.ModalService.addDynamicContentToModal(modal, PropertyCreatorComponent, {});
}
/*** addInput ***/
@@ -1245,6 +1250,10 @@ export class PropertiesAssignmentComponent {
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 8167caa959..57c9f97387 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 { PROPERTY_DATA } from 'app/utils';
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,14 +24,38 @@ export class PropertyCreatorComponent {
dataTypes: DataTypesMap;
isLoading: boolean;
- constructor(protected dataTypeService: DataTypeService) {}
+ constructor(protected dataTypeService: DataTypeService, private workspaceService: WorkspaceService) {
+ this.filterDataTypesByModel(this.workspaceService.metadata.model);
+ }
+
+ checkFormValidForSubmit() {
+ const showSchema: boolean = this.showSchema();
+ const isSchemaValid: boolean = (showSchema && !this.propertyModel.schema.property.type) ? false : true;
+ if (!showSchema) {
+ this.propertyModel.schema.property.type = '';
+ }
+ return this.propertyModel.name && this.propertyModel.type && isSchemaValid;
+ }
+
+ showSchema(): boolean {
+ return [PROPERTY_TYPES.LIST, PROPERTY_TYPES.MAP].indexOf(this.propertyModel.type) > -1;
+ }
+
+ onSchemaTypeChange(): void {
+ if (this.propertyModel.type === PROPERTY_TYPES.MAP) {
+ this.propertyModel.value = JSON.stringify({'': null});
+ } else if (this.propertyModel.type === PROPERTY_TYPES.LIST) {
+ this.propertyModel.value = JSON.stringify([]);
+ }
+ }
- ngOnInit() {
+ 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
- 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;
});
@@ -43,35 +68,13 @@ export class PropertyCreatorComponent {
);
const nonPrimitiveTypesValues = _.map(nonPrimitiveTypes,
(type: string) => new DropdownValue(type,
- type.replace('org.openecomp.datatypes.heat.', ''))
+ 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...'));
-
- }
-
- checkFormValidForSubmit() {
- const showSchema: boolean = this.showSchema();
- const isSchemaValid: boolean = (showSchema && !this.propertyModel.schema.property.type) ? false : true;
- if (!showSchema) {
- this.propertyModel.schema.property.type = '';
- }
- return this.propertyModel.name && this.propertyModel.type && isSchemaValid;
- }
-
- showSchema(): boolean {
- return [PROPERTY_TYPES.LIST, PROPERTY_TYPES.MAP].indexOf(this.propertyModel.type) > -1;
- }
-
- onSchemaTypeChange(): void {
- if (this.propertyModel.type === PROPERTY_TYPES.MAP) {
- this.propertyModel.value = JSON.stringify({'': null});
- } else if (this.propertyModel.type === PROPERTY_TYPES.LIST) {
- this.propertyModel.value = JSON.stringify([]);
- }
}
}
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 30eb6f0c77..85c8b898aa 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 @@ export class DataTypeService {
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 33d57295bf..10ad4142de 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 { HttpClient } from '@angular/common/http';
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 96a21262e8..fa3de88c7b 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 { GroupInstance } from "../../../models/graph/zones/group-instance";
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 0237b2f3de..08b49ae422 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 @@ export interface IDataTypesService {
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 @@ export class DataTypesService implements IDataTypesService {
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 @@ export class DataTypesService implements IDataTypesService {
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 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;