From: Brinda Santh Muthuramalingam Date: Thu, 14 Nov 2019 16:01:55 +0000 (+0000) Subject: Merge "add API to list blueprints with pagination in loopback server" X-Git-Tag: 0.7.0~154 X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=394053fb895c1c59a90e221f57777ebf5d85b27c;hp=c5c977f499350b71a23ff7e07042c595bfbfa642;p=ccsdk%2Fcds.git Merge "add API to list blueprints with pagination in loopback server" --- diff --git a/cds-ui/server/src/controllers/blueprint-rest.controller.ts b/cds-ui/server/src/controllers/blueprint-rest.controller.ts index b52952826..49ecb9df1 100644 --- a/cds-ui/server/src/controllers/blueprint-rest.controller.ts +++ b/cds-ui/server/src/controllers/blueprint-rest.controller.ts @@ -69,6 +69,21 @@ export class BlueprintRestController { return await this.bpservice.getAllblueprints(); } + @get('/controllerblueprint/paged', { + responses: { + '200': { + description: 'Blueprint model instance with pagination', + content: { 'application/json': { schema: { 'x-ts-type': Blueprint } } }, + }, + }, + }) + async getPagedBlueprints( + @param.query.number('limit') limit: number, + @param.query.number('offset') offset: number, + @param.query.string('sort') sort: string) { + return await this.bpservice.getPagedBueprints(limit, offset, sort); + } + @get('/controllerblueprint/meta-data/{keyword}', { responses: { '200': { diff --git a/cds-ui/server/src/datasources/blueprint.datasource-template.ts b/cds-ui/server/src/datasources/blueprint.datasource-template.ts index b0aaf01eb..914021887 100644 --- a/cds-ui/server/src/datasources/blueprint.datasource-template.ts +++ b/cds-ui/server/src/datasources/blueprint.datasource-template.ts @@ -38,21 +38,36 @@ export default { } }, - { - "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": "$.*" + { + "template": { + "method": "GET", + "url": processorApiConfig.http.url + "/blueprint-model/meta-data/{keyword}", + "headers": { + "accepts": "application/json", + "content-type": "application/json", + "authorization": processorApiConfig.http.authToken }, - "functions": { - "getBlueprintsByKeyword": ["keyword"] + "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 + }, + "responsePath": "$", }, + "functions": { + "getPagedBueprints": ["limit","offset", "sort"], + } + }, ] }; diff --git a/cds-ui/server/src/services/blueprint.service.ts b/cds-ui/server/src/services/blueprint.service.ts index 7952859d1..bc93fa1be 100644 --- a/cds-ui/server/src/services/blueprint.service.ts +++ b/cds-ui/server/src/services/blueprint.service.ts @@ -6,6 +6,7 @@ export interface BlueprintService { getAllblueprints(): Promise; getBlueprintsByKeyword(keyword: string): Promise; getByTags(tags: string): Promise; + getPagedBueprints(limit: number, offset: number , sort: string): Promise; } export class BlueprintServiceProvider implements Provider {