diff options
Diffstat (limited to 'cds-ui')
7 files changed, 135 insertions, 34 deletions
diff --git a/cds-ui/server/src/controllers/blueprint-rest.controller.ts b/cds-ui/server/src/controllers/blueprint-rest.controller.ts index 1a8de6b47..b2a11281f 100644 --- a/cds-ui/server/src/controllers/blueprint-rest.controller.ts +++ b/cds-ui/server/src/controllers/blueprint-rest.controller.ts @@ -50,6 +50,7 @@ import * as multiparty from 'multiparty'; import * as request_lib from 'request'; import { processorApiConfig, appConfig } from '../config/app-config'; import { bluePrintManagementServiceGrpcClient } from '../clients/blueprint-management-service-grpc-client'; +import {BlueprintDetail} from '../models/blueprint.detail.model'; export class BlueprintRestController { constructor( @@ -68,6 +69,18 @@ export class BlueprintRestController { async getall() { return await this.bpservice.getAllblueprints(); } + @get('/controllerblueprint/{id}', { + responses: { + '200': { + description: 'Blueprint model instance', + content: { 'application/json': { schema: { 'x-ts-type': BlueprintDetail } } }, + }, + }, + }) + async getOneBluePrint(@param.path.string('id') id: string) { + return await this.bpservice.getOneBluePrint(id); + } + @get('/controllerblueprint/paged', { responses: { diff --git a/cds-ui/server/src/controllers/data-dictionary.controller.ts b/cds-ui/server/src/controllers/data-dictionary.controller.ts index eab0bc50c..076d714c6 100644 --- a/cds-ui/server/src/controllers/data-dictionary.controller.ts +++ b/cds-ui/server/src/controllers/data-dictionary.controller.ts @@ -96,6 +96,9 @@ export class DataDictionaryController { return await this.rdservice.getModelType(source); } + /** + * @deprecated use getResourceDictionaryByType Instead. + */ @get('/resourcedictionary/model-type/by-definition/data_type', { responses: { '200': { @@ -104,6 +107,19 @@ export class DataDictionaryController { }, }) async getDataTypes() { + console.warn("Calling deprecated function!"); return await this.rdservice.getDataTypes(); } + + @get('/resourcedictionary/model-type/by-definition/{type}', { + responses: { + '200': { + content: {'application/json': {}}, + }, + }, + }) + async getResourceDictionaryByType(@param.path.string('type') type: string) { + return await this.rdservice.getResourceDictionaryByType(type); + } + } diff --git a/cds-ui/server/src/datasources/blueprint.datasource-template.ts b/cds-ui/server/src/datasources/blueprint.datasource-template.ts index a7cea1d4a..d51d1ba7b 100644 --- a/cds-ui/server/src/datasources/blueprint.datasource-template.ts +++ b/cds-ui/server/src/datasources/blueprint.datasource-template.ts @@ -21,11 +21,10 @@ export default { "getAllblueprints": [] } - }, - { + }, { "template": { "method": "GET", - "url": processorApiConfig.http.url + "/blueprint-model/search/{tags}", + "url": processorApiConfig.http.url + "/blueprint-model/{id}", "headers": { "accepts": "application/json", "content-type": "application/json", @@ -34,41 +33,58 @@ export default { "responsePath": "$.*" }, "functions": { - "getByTags": ["tags"] + "getOneBluePrint": ["id"] } }, - { - "template": { - "method": "GET", - "url": processorApiConfig.http.url + "/blueprint-model/meta-data/{keyword}", - "headers": { - "accepts": "application/json", - "content-type": "application/json", - "authorization": processorApiConfig.http.authToken + + { + "template": { + "method": "GET", + "url": processorApiConfig.http.url + "/blueprint-model/search/{tags}", + "headers": { + "accepts": "application/json", + "content-type": "application/json", + "authorization": processorApiConfig.http.authToken + }, + "responsePath": "$.*" }, - "responsePath": "$.*" + "functions": { + "getByTags": ["tags"] + + } }, - "functions": { - "getBlueprintsByKeyword": ["keyword"] + { + "template": { + "method": "GET", + "url": processorApiConfig.http.url + "/blueprint-model/meta-data/{keyword}", + "headers": { + "accepts": "application/json", + "content-type": "application/json", + "authorization": processorApiConfig.http.authToken + }, + "responsePath": "$.*" + }, + "functions": { + "getBlueprintsByKeyword": ["keyword"] - } - }, - { - "template": { - "method": "GET", - "url": processorApiConfig.http.url + "/blueprint-model/paged?limit={limit}&offset={offset}&sort={sort}", - "headers": { - "accepts": "application/json", - "content-type": "application/json", - "authorization": processorApiConfig.http.authToken + } + }, + { + "template": { + "method": "GET", + "url": processorApiConfig.http.url + "/blueprint-model/paged?limit={limit}&offset={offset}&sort={sort}", + "headers": { + "accepts": "application/json", + "content-type": "application/json", + "authorization": processorApiConfig.http.authToken + }, + "responsePath": "$", }, - "responsePath": "$", + "functions": { + "getPagedBueprints": ["limit", "offset", "sort"], + } }, - "functions": { - "getPagedBueprints": ["limit","offset", "sort"], - } - }, { "template": { "method": "GET", @@ -81,8 +97,9 @@ export default { "responsePath": "$", }, "functions": { - "getMetaDataPagedBlueprints": ["limit","offset", "sort","keyword"], + "getMetaDataPagedBlueprints": ["limit", "offset", "sort", "keyword"], } }, -] + ] + }; 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 f839bb225..7373d069e 100644 --- a/cds-ui/server/src/datasources/resource-dictionary.datasource-template.ts +++ b/cds-ui/server/src/datasources/resource-dictionary.datasource-template.ts @@ -119,6 +119,22 @@ export default { "getDataTypes": [] } + }, + { + "template": { + "method": "GET", + "url": processorApiConfig.http.url + "/model-type/by-definition/{type}", + "headers": { + "accepts": "application/json", + "content-type": "application/json", + "authorization": processorApiConfig.http.authToken + }, + "responsePath": "$.*" + }, + "functions": { + "getResourceDictionaryByType": ["type"] + + } } ] -};
\ No newline at end of file +}; diff --git a/cds-ui/server/src/models/blueprint.detail.model.ts b/cds-ui/server/src/models/blueprint.detail.model.ts new file mode 100644 index 000000000..1a6b9f2f8 --- /dev/null +++ b/cds-ui/server/src/models/blueprint.detail.model.ts @@ -0,0 +1,37 @@ +/* +============LICENSE_START========================================== +=================================================================== +Copyright (C) 2018-19 IBM Intellectual Property. All rights reserved. +=================================================================== + +Unless otherwise specified, all software contained herein is licensed +under the Apache License, Version 2.0 (the License); +you may not use this software except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +============LICENSE_END============================================ +*/ + + +import { model, property} from '@loopback/repository'; +import {Blueprint} from "./blueprint.model"; + +@model() +export class BlueprintDetail extends Blueprint { + + @property({ + type: 'object', + }) + blueprintModelContent?: object; + + constructor(data?: Partial<BlueprintDetail>) { + super(data); + } +} diff --git a/cds-ui/server/src/services/blueprint.service.ts b/cds-ui/server/src/services/blueprint.service.ts index b6474a3a2..875eb5e38 100644 --- a/cds-ui/server/src/services/blueprint.service.ts +++ b/cds-ui/server/src/services/blueprint.service.ts @@ -3,6 +3,7 @@ import {inject, Provider} from '@loopback/core'; import {BlueprintDataSource} from '../datasources'; export interface BlueprintService { + getOneBluePrint(id: string): any; getAllblueprints(): Promise<any>; getBlueprintsByKeyword(keyword: string): Promise<any>; getByTags(tags: string): Promise<JSON>; diff --git a/cds-ui/server/src/services/resource-dictionary.service.ts b/cds-ui/server/src/services/resource-dictionary.service.ts index 8df22085c..a36c7fe75 100644 --- a/cds-ui/server/src/services/resource-dictionary.service.ts +++ b/cds-ui/server/src/services/resource-dictionary.service.ts @@ -7,9 +7,10 @@ export interface ResourceDictionaryService { getSourceMapping(): Promise<JSON>; getByTags(tags: string): Promise<JSON>; save(resourceDictionary: JSON): Promise<JSON>; - searchbyNames(resourceDictionaryList: JSON): Promise<JSON>; + searchbyNames(resourceDictionaryList: JSON): Promise<JSON>; getModelType(source: string): Promise<JSON>; getDataTypes(): Promise<JSON>; + getResourceDictionaryByType(type: string): Promise<JSON>; } export class ResourceDictionaryServiceProvider implements Provider<ResourceDictionaryService> { |