summaryrefslogtreecommitdiffstats
path: root/catalog-ui/src/app/services
diff options
context:
space:
mode:
Diffstat (limited to 'catalog-ui/src/app/services')
-rw-r--r--catalog-ui/src/app/services/data-types-service.ts25
1 files changed, 23 insertions, 2 deletions
diff --git a/catalog-ui/src/app/services/data-types-service.ts b/catalog-ui/src/app/services/data-types-service.ts
index ca30259260..b27f4222c4 100644
--- a/catalog-ui/src/app/services/data-types-service.ts
+++ b/catalog-ui/src/app/services/data-types-service.ts
@@ -24,13 +24,14 @@ import {
ComponentInstance,
DataTypeModel,
DataTypesMap,
- IAppConfigurtaion,
- InputModel,
+ IAppConfigurtaion, InputModel,
InputPropertyBase,
PropertyModel,
SchemaProperty
} from "../models";
import {PROPERTY_DATA} from "../utils/constants";
+import {List} from "lodash";
+import {Observable} from "rxjs/Observable";
export interface IDataTypesService {
@@ -97,6 +98,26 @@ export class DataTypesService implements IDataTypesService {
return this.dataTypes;
}
+ public getDataTypesFromAllModel = (): Observable<Array<DataTypeModel>> => {
+ return new Observable<Array<DataTypeModel>>(subscriber => {
+ this.$http.get<List<DataTypesMap>>(this.baseUrl + "allDataTypes")
+ .then(promiseValue => {
+ const allDataTypes = this.getDataTypesItems(promiseValue.data);
+ subscriber.next(allDataTypes);
+ });
+ });
+ }
+
+ private getDataTypesItems(dataTypesListOfMap: List<DataTypesMap>):Array<DataTypeModel> {
+ const dataTypes = new Array<DataTypeModel>();
+ angular.forEach(dataTypesListOfMap, (dataTypesMap: DataTypesMap): void => {
+ for (const dataTypeKey of Object.keys(dataTypesMap)) {
+ dataTypes.push(new DataTypeModel(dataTypesMap[dataTypeKey]))
+ }
+ });
+ return dataTypes;
+ }
+
public findAllDataTypesByModel = (modelName: string): Promise<Map<string, DataTypeModel>> => {
return new Promise<Map<string, DataTypeModel>>((resolve, reject) => {
this.fetchDataTypesByModel(modelName).then(response => {