diff options
4 files changed, 100 insertions, 32 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/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/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>; |