From c6bc12d878753aceb887838b926666595d480a86 Mon Sep 17 00:00:00 2001 From: Nirvan Ramjuttun Date: Tue, 7 May 2019 12:39:19 -0400 Subject: Modify CDS-UI server to allow communicating with external blueprint mS Issue-ID: CCSDK-1292 Change-Id: I3536437bad334841d7c7ecd577c092cd13f42a9b Signed-off-by: Nirvan Ramjuttun (cherry picked from commit 087d4b667a9c5517ac7d014c2bbdad994b927147) --- .../datasources/blueprint.datasource-template.ts | 24 ++++++ .../src/datasources/blueprint.datasource.json | 22 ------ .../server/src/datasources/blueprint.datasource.ts | 2 +- .../resource-dictionary.datasource-template.ts | 91 ++++++++++++++++++++++ .../resource-dictionary.datasource.json | 89 --------------------- .../datasources/resource-dictionary.datasource.ts | 2 +- 6 files changed, 117 insertions(+), 113 deletions(-) create mode 100644 cds-ui/server/src/datasources/blueprint.datasource-template.ts delete mode 100644 cds-ui/server/src/datasources/blueprint.datasource.json create mode 100644 cds-ui/server/src/datasources/resource-dictionary.datasource-template.ts delete mode 100644 cds-ui/server/src/datasources/resource-dictionary.datasource.json (limited to 'cds-ui/server/src/datasources') diff --git a/cds-ui/server/src/datasources/blueprint.datasource-template.ts b/cds-ui/server/src/datasources/blueprint.datasource-template.ts new file mode 100644 index 000000000..3cbf09576 --- /dev/null +++ b/cds-ui/server/src/datasources/blueprint.datasource-template.ts @@ -0,0 +1,24 @@ +import {controllerApiConfig} from '../../config/app-config'; + +export default { + "name": "blueprint", + "connector": "rest", + "baseURL": controllerApiConfig.url, + "crud": false, + "operations": [{ + "template": { + "method": "GET", + "url": controllerApiConfig.url + "/blueprint-model/", + "headers": { + "accepts": "application/json", + "content-type": "application/json", + "authorization": controllerApiConfig.authToken + }, + "responsePath": "$.*" + }, + "functions": { + "getAllblueprints": [] + + } + }] +}; \ No newline at end of file diff --git a/cds-ui/server/src/datasources/blueprint.datasource.json b/cds-ui/server/src/datasources/blueprint.datasource.json deleted file mode 100644 index 86b1c2c15..000000000 --- a/cds-ui/server/src/datasources/blueprint.datasource.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "name": "blueprint", - "connector": "rest", - "baseURL": "http://localhost:8080/api/v1/", - "crud": false, - "operations": [{ - "template": { - "method": "GET", - "url": "http://localhost:8080/api/v1/blueprint-model/", - "headers": { - "accepts": "application/json", - "content-type": "application/json", - "authorization": "{authtoken}" - }, - "responsePath": "$.*" - }, - "functions": { - "getAllblueprints": ["authtoken"] - - } - }] -} \ No newline at end of file diff --git a/cds-ui/server/src/datasources/blueprint.datasource.ts b/cds-ui/server/src/datasources/blueprint.datasource.ts index 008612693..ce901b6d7 100644 --- a/cds-ui/server/src/datasources/blueprint.datasource.ts +++ b/cds-ui/server/src/datasources/blueprint.datasource.ts @@ -1,6 +1,6 @@ import {inject} from '@loopback/core'; import {juggler} from '@loopback/repository'; -import * as config from './blueprint.datasource.json'; +import config from './blueprint.datasource-template'; export class BlueprintDataSource extends juggler.DataSource { static dataSourceName = 'blueprint'; diff --git a/cds-ui/server/src/datasources/resource-dictionary.datasource-template.ts b/cds-ui/server/src/datasources/resource-dictionary.datasource-template.ts new file mode 100644 index 000000000..b987e588c --- /dev/null +++ b/cds-ui/server/src/datasources/resource-dictionary.datasource-template.ts @@ -0,0 +1,91 @@ +import {controllerApiConfig} from '../../config/app-config'; + +export default { + "name": "resourceDictionary", + "connector": "rest", + "baseURL": controllerApiConfig.url + "/dictionary", + "crud": false, + "operations": [{ + "template": { + "method": "GET", + "url": controllerApiConfig.url + "/dictionary/{name}", + "headers": { + "accepts": "application/json", + "content-type": "application/json", + "authorization": controllerApiConfig.authToken + }, + "responsePath": "$.*" + }, + "functions": { + "getByName": ["name"] + + } + }, + { + "template": { + "method": "GET", + "url": controllerApiConfig.url + "/dictionary/source-mapping", + "headers": { + "accepts": "application/json", + "content-type": "application/json", + "authorization": controllerApiConfig.authToken + }, + "responsePath": "$.*" + }, + "functions": { + "getSourceMapping": [] + + } + }, + { + "template": { + "method": "GET", + "url": controllerApiConfig.url + "/dictionary/search/{tags}", + "headers": { + "accepts": "application/json", + "content-type": "application/json", + "authorization": controllerApiConfig.authToken + }, + "responsePath": "$.*" + }, + "functions": { + "getByTags": ["tags"] + + } + }, + { + "template": { + "method": "POST", + "url": controllerApiConfig.url + "/dictionary", + "headers": { + "accepts": "application/json", + "content-type": "application/json", + "authorization": controllerApiConfig.authToken + }, + "body": "{resourceDictionary}", + "responsePath": "$.*" + }, + "functions": { + "save": ["resourceDictionary"] + + } + }, + { + "template": { + "method": "POST", + "url": controllerApiConfig.url + "/dictionary/by-names", + "headers": { + "accepts": "application/json", + "content-type": "application/json", + "authorization": controllerApiConfig.authToken + }, + "body": "{resourceDictionaryList}", + "responsePath": "$.*" + }, + "functions": { + "searchbyNames": ["resourceDictionaryList"] + + } + } + ] +}; \ No newline at end of file diff --git a/cds-ui/server/src/datasources/resource-dictionary.datasource.json b/cds-ui/server/src/datasources/resource-dictionary.datasource.json deleted file mode 100644 index 9bf5f30c4..000000000 --- a/cds-ui/server/src/datasources/resource-dictionary.datasource.json +++ /dev/null @@ -1,89 +0,0 @@ -{ - "name": "resourceDictionary", - "connector": "rest", - "baseURL": "http://localhost:8080/api/v1/dictionary", - "crud": false, - "operations": [{ - "template": { - "method": "GET", - "url": "http://localhost:8080/api/v1/dictionary/{name}", - "headers": { - "accepts": "application/json", - "content-type": "application/json", - "authorization": "{authtoken}" - }, - "responsePath": "$.*" - }, - "functions": { - "getByName": ["name", "authtoken"] - - } - }, - { - "template": { - "method": "GET", - "url": "http://localhost:8080/api/v1/dictionary/source-mapping", - "headers": { - "accepts": "application/json", - "content-type": "application/json", - "authorization": "{authtoken}" - }, - "responsePath": "$.*" - }, - "functions": { - "getSourceMapping": ["authtoken"] - - } - }, - { - "template": { - "method": "GET", - "url": "http://localhost:8080/api/v1/dictionary/search/{tags}", - "headers": { - "accepts": "application/json", - "content-type": "application/json", - "authorization": "{authtoken}" - }, - "responsePath": "$.*" - }, - "functions": { - "getByTags": ["tags", "authtoken"] - - } - }, - { - "template": { - "method": "POST", - "url": "http://localhost:8080/api/v1/dictionary", - "headers": { - "accepts": "application/json", - "content-type": "application/json", - "authorization": "{authtoken}" - }, - "body": "{resourceDictionary}", - "responsePath": "$.*" - }, - "functions": { - "save": ["authtoken", "resourceDictionary"] - - } - }, - { - "template": { - "method": "POST", - "url": "http://localhost:8080/api/v1/dictionary/by-names", - "headers": { - "accepts": "application/json", - "content-type": "application/json", - "authorization": "{authtoken}" - }, - "body": "{resourceDictionaryList}", - "responsePath": "$.*" - }, - "functions": { - "searchbyNames": ["authtoken", "resourceDictionaryList"] - - } - } - ] -} \ No newline at end of file diff --git a/cds-ui/server/src/datasources/resource-dictionary.datasource.ts b/cds-ui/server/src/datasources/resource-dictionary.datasource.ts index 381ab9a78..ba12c78e2 100644 --- a/cds-ui/server/src/datasources/resource-dictionary.datasource.ts +++ b/cds-ui/server/src/datasources/resource-dictionary.datasource.ts @@ -1,6 +1,6 @@ import {inject} from '@loopback/core'; import {juggler} from '@loopback/repository'; -import * as config from './resource-dictionary.datasource.json'; +import config from './resource-dictionary.datasource-template'; export class ResourceDictionaryDataSource extends juggler.DataSource { static dataSourceName = 'resourceDictionary'; -- cgit 1.2.3-korg