aboutsummaryrefslogtreecommitdiffstats
path: root/cds-ui
diff options
context:
space:
mode:
authorShaabanEltanany <shaaban.eltanany.ext@orange.com>2020-05-05 11:01:44 +0200
committerShaabanEltanany <shaaban.eltanany.ext@orange.com>2020-05-05 11:01:44 +0200
commitf486ab15c64375a2c97df979a718929420124cd6 (patch)
treeb5fcfbbe4c48e438e2c50129ca60dd0fc1ecfb91 /cds-ui
parent6b6ac70007ba2b52c6beb8c0d22453a628c891f3 (diff)
fix sort at package list
Issue-ID: CCSDK-2320 Signed-off-by: ShaabanEltanany <shaaban.eltanany.ext@orange.com> Change-Id: Ia91d519c315b6ef0c01089422253599b137eceec
Diffstat (limited to 'cds-ui')
-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
4 files changed, 20 insertions, 35 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>;