From 7918513759a4a6fd5ae90640c6b654a1a61f46b8 Mon Sep 17 00:00:00 2001 From: Arundathi Patil Date: Mon, 9 Sep 2019 19:27:04 +0530 Subject: Resource Dictionary: fecthing data-type list Created loopback API function to fetch data-types from backend and display them in data-type drop-down Issue-ID: CCSDK-707 Change-Id: I797177b9042558c99a94df9c9dd4295c43389d29 Signed-off-by: Arundathi Patil --- .../src/controllers/data-dictionary.controller.ts | 11 +++++++++++ .../resource-dictionary.datasource-template.ts | 17 ++++++++++++++++- .../server/src/services/resource-dictionary.service.ts | 1 + 3 files changed, 28 insertions(+), 1 deletion(-) (limited to 'cds-ui/server') diff --git a/cds-ui/server/src/controllers/data-dictionary.controller.ts b/cds-ui/server/src/controllers/data-dictionary.controller.ts index 63587e6b3..eab0bc50c 100644 --- a/cds-ui/server/src/controllers/data-dictionary.controller.ts +++ b/cds-ui/server/src/controllers/data-dictionary.controller.ts @@ -95,4 +95,15 @@ export class DataDictionaryController { async getmodelType(@param.path.string('source') source: string) { return await this.rdservice.getModelType(source); } + + @get('/resourcedictionary/model-type/by-definition/data_type', { + responses: { + '200': { + content: { 'application/json': {} }, + }, + }, + }) + async getDataTypes() { + return await this.rdservice.getDataTypes(); + } } diff --git a/cds-ui/server/src/datasources/resource-dictionary.datasource-template.ts b/cds-ui/server/src/datasources/resource-dictionary.datasource-template.ts index af96aca04..9f9d754d1 100644 --- a/cds-ui/server/src/datasources/resource-dictionary.datasource-template.ts +++ b/cds-ui/server/src/datasources/resource-dictionary.datasource-template.ts @@ -88,7 +88,6 @@ export default { } }, - , { "template": { "method": "GET", @@ -103,6 +102,22 @@ export default { "functions": { "getModelType": ["source"] + } + }, + { + "template": { + "method": "GET", + "url": controllerApiConfig.http.url + "/model-type/by-definition/data_type", + "headers": { + "accepts": "application/json", + "content-type": "application/json", + "authorization": controllerApiConfig.http.authToken + }, + "responsePath": "$.*" + }, + "functions": { + "getDataTypes": [] + } } ] diff --git a/cds-ui/server/src/services/resource-dictionary.service.ts b/cds-ui/server/src/services/resource-dictionary.service.ts index 9a781d6b8..8df22085c 100644 --- a/cds-ui/server/src/services/resource-dictionary.service.ts +++ b/cds-ui/server/src/services/resource-dictionary.service.ts @@ -9,6 +9,7 @@ export interface ResourceDictionaryService { save(resourceDictionary: JSON): Promise; searchbyNames(resourceDictionaryList: JSON): Promise; getModelType(source: string): Promise; + getDataTypes(): Promise; } export class ResourceDictionaryServiceProvider implements Provider { -- cgit 1.2.3-korg