summaryrefslogtreecommitdiffstats
path: root/catalog-ui/src/app/services
diff options
context:
space:
mode:
authorKrupaNagabhushan <krupa.nagabhushan@est.tech>2022-09-23 10:17:29 +0100
committerMichael Morris <michael.morris@est.tech>2022-11-30 16:40:22 +0000
commit4a754a8c898fb397e19876de2d19141d047a9e58 (patch)
tree164634a57dc675cd45d84fbc40dc843cac57ca77 /catalog-ui/src/app/services
parent1ed328d96144bc626f664e2a5c45894393e8308e (diff)
View data types in UI catalog
Issue-ID: SDC-4220 Signed-off-by: KrupaNagabhushan <krupa.nagabhushan@est.tech> Change-Id: I880c7fedb58eafc7524fc6833b9b5d02f3b7d523
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 => {