summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-api.service.ts9
-rw-r--r--cds-ui/server/src/controllers/blueprint-rest.controller.ts34
-rw-r--r--cds-ui/server/src/datasources/blueprint.datasource-template.ts8
-rw-r--r--cds-ui/server/src/services/blueprint.service.ts4
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BlueprintModelController.kt12
5 files changed, 28 insertions, 39 deletions
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-api.service.ts b/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-api.service.ts
index 2332d8e53..8275f8c6c 100644
--- a/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-api.service.ts
+++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-api.service.ts
@@ -37,10 +37,12 @@ export class PackagesApiService {
}
getPagedPackages(pageNumber: number, pageSize: number, sortBy: string): Observable<BluePrintPage[]> {
+ const sortType = sortBy.includes('DATE') ? 'DESC' : 'ASC';
return this.api.get(BlueprintURLs.getPagedBlueprints, {
offset: pageNumber,
limit: pageSize,
- sort: sortBy
+ sort: sortBy,
+ sortType
});
}
@@ -56,11 +58,12 @@ export class PackagesApiService {
}
getPagedPackagesByKeyWord(keyWord: string, pageNumber: number, pageSize: number, sortBy: string) {
-
+ const sortType = sortBy.includes('DATE') ? 'DESC' : 'ASC';
return this.api.get(BlueprintURLs.getMetaDatePageable + '/' + keyWord, {
offset: pageNumber,
limit: pageSize,
- sort: sortBy
+ sort: sortBy,
+ sortType
});
}
}
diff --git a/cds-ui/server/src/controllers/blueprint-rest.controller.ts b/cds-ui/server/src/controllers/blueprint-rest.controller.ts
index 7b2c78329..2319e0a5e 100644
--- a/cds-ui/server/src/controllers/blueprint-rest.controller.ts
+++ b/cds-ui/server/src/controllers/blueprint-rest.controller.ts
@@ -20,34 +20,14 @@ limitations under the License.
*/
-import {
- Count,
- CountSchema,
- Filter,
- repository,
- Where,
-} from '@loopback/repository';
-import {
- post,
- param,
- get,
- getFilterSchemaFor,
- getWhereSchemaFor,
- patch,
- put,
- del,
- requestBody,
- Request,
- Response,
- RestBindings,
-} from '@loopback/rest';
+import {get, param, post, Request, requestBody, Response, RestBindings} from '@loopback/rest';
import {Blueprint} from '../models';
import {inject} from '@loopback/core';
import {BlueprintService} from '../services';
import * as fs from 'fs';
import * as multiparty from 'multiparty';
import * as request_lib from 'request';
-import {processorApiConfig, appConfig} from '../config/app-config';
+import {appConfig, processorApiConfig} from '../config/app-config';
import {bluePrintManagementServiceGrpcClient} from '../clients/blueprint-management-service-grpc-client';
import {BlueprintDetail} from '../models/blueprint.detail.model';
@@ -94,8 +74,9 @@ export class BlueprintRestController {
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);
+ @param.query.string('sort') sort: string,
+ @param.query.string('sortType') sortType: string) {
+ return await this.bpservice.getPagedBueprints(limit, offset, sort, sortType);
}
@get('/controllerblueprint/metadata/paged/{keyword}', {
@@ -110,8 +91,9 @@ export class BlueprintRestController {
@param.path.string('keyword') keyword: string,
@param.query.number('limit') limit: number,
@param.query.number('offset') offset: number,
- @param.query.string('sort') sort: string) {
- return await this.bpservice.getMetaDataPagedBlueprints(limit, offset, sort, keyword);
+ @param.query.string('sort') sort: string,
+ @param.query.string('sortType') sortType: string) {
+ return await this.bpservice.getMetaDataPagedBlueprints(limit, offset, sort, keyword, sortType);
}
@get('/controllerblueprint/meta-data/{keyword}', {
diff --git a/cds-ui/server/src/datasources/blueprint.datasource-template.ts b/cds-ui/server/src/datasources/blueprint.datasource-template.ts
index d7ac14b26..9b8e06a13 100644
--- a/cds-ui/server/src/datasources/blueprint.datasource-template.ts
+++ b/cds-ui/server/src/datasources/blueprint.datasource-template.ts
@@ -73,7 +73,7 @@ export default {
{
"template": {
"method": "GET",
- "url": processorApiConfig.http.url + "/blueprint-model/paged?limit={limit}&offset={offset}&sort={sort}",
+ "url": processorApiConfig.http.url + "/blueprint-model/paged?limit={limit}&offset={offset}&sort={sort}&sortType={sortType}",
"headers": {
"accepts": "application/json",
"content-type": "application/json",
@@ -82,13 +82,13 @@ export default {
"responsePath": "$",
},
"functions": {
- "getPagedBueprints": ["limit", "offset", "sort"],
+ "getPagedBueprints": ["limit", "offset", "sort","sortType"],
}
},
{
"template": {
"method": "GET",
- "url": processorApiConfig.http.url + "/blueprint-model/paged/meta-data/{keyword}?limit={limit}&offset={offset}&sort={sort}",
+ "url": processorApiConfig.http.url + "/blueprint-model/paged/meta-data/{keyword}?limit={limit}&offset={offset}&sort={sort}&sortType={sortType}",
"headers": {
"accepts": "application/json",
"content-type": "application/json",
@@ -97,7 +97,7 @@ export default {
"responsePath": "$",
},
"functions": {
- "getMetaDataPagedBlueprints": ["limit", "offset", "sort", "keyword"],
+ "getMetaDataPagedBlueprints": ["limit", "offset", "sort", "keyword","sortType"],
}
},
{
diff --git a/cds-ui/server/src/services/blueprint.service.ts b/cds-ui/server/src/services/blueprint.service.ts
index cb601f3cf..2680e105a 100644
--- a/cds-ui/server/src/services/blueprint.service.ts
+++ b/cds-ui/server/src/services/blueprint.service.ts
@@ -7,8 +7,8 @@ export interface BlueprintService {
getAllblueprints(): Promise<any>;
getBlueprintsByKeyword(keyword: string): Promise<any>;
getByTags(tags: string): Promise<JSON>;
- getPagedBueprints(limit: number, offset: number , sort: string): Promise<any>;
- getMetaDataPagedBlueprints(limit: number, offset: number, sort: string, keyword: string): Promise<any>;
+ getPagedBueprints(limit: number, offset: number , sort: string,sortType: String): Promise<any>;
+ getMetaDataPagedBlueprints(limit: number, offset: number, sort: string, keyword: string,sortType: String): Promise<any>;
getBlueprintByNameAndVersion(name:string, version:string): Promise<any>;
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BlueprintModelController.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BlueprintModelController.kt
index 1f01d1ce3..3973f3620 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BlueprintModelController.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BlueprintModelController.kt
@@ -89,9 +89,11 @@ open class BlueprintModelController(private val bluePrintModelHandler: BluePrint
fun allBlueprintModel(
@RequestParam(defaultValue = "20") limit: Int,
@RequestParam(defaultValue = "0") offset: Int,
- @RequestParam(defaultValue = "DATE") sort: BlueprintSortByOption
+ @RequestParam(defaultValue = "DATE") sort: BlueprintSortByOption,
+ @RequestParam(defaultValue = "ASC") sortType: String
): Page<BlueprintModelSearch> {
- val pageRequest = PageRequest.of(offset, limit, Sort.Direction.ASC, sort.columnName)
+ val pageRequest = PageRequest.of(offset, limit,
+ Sort.Direction.fromString(sortType), sort.columnName)
return this.bluePrintModelHandler.allBlueprintModel(pageRequest)
}
@@ -110,9 +112,11 @@ open class BlueprintModelController(private val bluePrintModelHandler: BluePrint
@NotNull @PathVariable(value = "keyword") keyWord: String,
@RequestParam(defaultValue = "20") limit: Int,
@RequestParam(defaultValue = "0") offset: Int,
- @RequestParam(defaultValue = "DATE") sort: BlueprintSortByOption
+ @RequestParam(defaultValue = "DATE") sort: BlueprintSortByOption,
+ @RequestParam(defaultValue = "ASC") sortType: String
): Page<BlueprintModelSearch> {
- val pageRequest = PageRequest.of(offset, limit, Sort.Direction.ASC, sort.columnName)
+ val pageRequest = PageRequest.of(offset, limit,
+ Sort.Direction.fromString(sortType), sort.columnName)
return this.bluePrintModelHandler.searchBluePrintModelsByKeyWordPaged(keyWord, pageRequest)
}