summaryrefslogtreecommitdiffstats
path: root/catalog-ui/src/app/services
diff options
context:
space:
mode:
authorandre.schmid <andre.schmid@est.tech>2022-02-09 19:00:35 +0000
committerMichael Morris <michael.morris@est.tech>2022-03-11 15:25:28 +0000
commitf13f58eb867c763e6ed1c3b674fd99b1081a0664 (patch)
treec0ccc70b8fdf4362bce26efa0a5bb1c435f98575 /catalog-ui/src/app/services
parent767b122ea026099e17a2ffde30e6718d2abf150f (diff)
Support complex types in interface operation inputs
Issue-ID: SDC-3897 Change-Id: Ieac2d74ad340de1d9f6e4cd3ac830e2ec8c35d5b Signed-off-by: andre.schmid <andre.schmid@est.tech> Signed-off-by: vasraz <vasyl.razinkov@est.tech> Signed-off-by: MichaelMorris <michael.morris@est.tech>
Diffstat (limited to 'catalog-ui/src/app/services')
-rw-r--r--catalog-ui/src/app/services/data-types-service.ts33
1 files changed, 29 insertions, 4 deletions
diff --git a/catalog-ui/src/app/services/data-types-service.ts b/catalog-ui/src/app/services/data-types-service.ts
index 08b49ae422..1a0fc47aae 100644
--- a/catalog-ui/src/app/services/data-types-service.ts
+++ b/catalog-ui/src/app/services/data-types-service.ts
@@ -27,7 +27,7 @@ import {
PropertyModel,
InputPropertyBase,
IAppConfigurtaion,
- SchemaProperty
+ SchemaProperty, DataTypeModel
} from "../models";
import {PROPERTY_DATA} from "../utils/constants";
@@ -40,7 +40,8 @@ export interface IDataTypesService {
selectedInstance:ComponentInstance;
selectedComponentInputs:Array<InputModel>;
//declare methods
- fetchDataTypesByModel(modelName:string):void;
+ loadDataTypesCache(modelName:string):void;
+ findAllDataTypesByModel(modelName: string): void;
getAllDataTypes():DataTypesMap;
getFirsLevelOfDataTypeProperties(dataTypeName:string):Array<DataTypePropertyModel>;
isDataTypeForSchemaType(property:SchemaProperty):boolean;
@@ -70,7 +71,7 @@ export class DataTypesService implements IDataTypesService {
selectedInstance:ComponentInstance;
selectedComponentInputs:Array<InputModel>;
- public fetchDataTypesByModel = (modelName: string):void => {
+ public loadDataTypesCache = (modelName: string): void => {
let model;
if (modelName) {
model = {'model': modelName}
@@ -82,11 +83,35 @@ export class DataTypesService implements IDataTypesService {
});
};
+ public fetchDataTypesByModel = (modelName: string): angular.IHttpPromise<any> => {
+ let model;
+ if (modelName) {
+ model = {'model': modelName}
+ }
+ return this.$http.get(this.baseUrl + "dataTypes", {params: model});
+ };
+
public getAllDataTypesFromModel = (modelName: string): DataTypesMap => {
- this.fetchDataTypesByModel(modelName);
+ this.loadDataTypesCache(modelName);
return this.dataTypes;
}
+ public findAllDataTypesByModel = (modelName: string): Promise<Map<string, DataTypeModel>> => {
+ return new Promise<Map<string, DataTypeModel>>((resolve, reject) => {
+ this.fetchDataTypesByModel(modelName).then(response => {
+ const dataTypes = response.data;
+ delete dataTypes[PROPERTY_DATA.ROOT_DATA_TYPE];
+ const dataTypeMap = new Map<string, DataTypeModel>();
+ for(const dataTypeKey of Object.keys(dataTypes)) {
+ dataTypeMap.set(dataTypeKey, new DataTypeModel(dataTypes[dataTypeKey]))
+ }
+ resolve(dataTypeMap);
+ }).catch(reason => {
+ reject(reason);
+ });
+ });
+ }
+
public getAllDataTypes = ():DataTypesMap => {
return this.dataTypes;
};