summaryrefslogtreecommitdiffstats
path: root/cds-ui
diff options
context:
space:
mode:
authorDan Timoney <dtimoney@att.com>2020-05-06 15:10:18 +0000
committerGerrit Code Review <gerrit@onap.org>2020-05-06 15:10:18 +0000
commit1e6f878cc92f42ca25f44319b70797bdcc8a4e1f (patch)
treeba70509807b00e402c89275a0d28d2a997f5aba1 /cds-ui
parent158603523a43d4480b519f4ef27649cd98783410 (diff)
parentf486ab15c64375a2c97df979a718929420124cd6 (diff)
Merge "fix sort at package list"
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>;
che License, Version 2.0 (the "License"); # you may not use this file 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. # echo "This is ${WORKSPACE}/scripts/policy/drools-pdp-script.sh" # the directory of the script DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" echo ${DIR} # the temp directory used, within $DIR # omit the -p parameter to create a temporal directory in the default location WORK_DIR=`mktemp -d -p "$DIR"` echo ${WORK_DIR} cd ${WORK_DIR} # check if tmp dir was created if [[ ! "$WORK_DIR" || ! -d "$WORK_DIR" ]]; then echo "Could not create temp dir" exit 1 fi # bring down maven mkdir maven cd maven curl -O http://apache.claz.org/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz tar -xzvf apache-maven-3.3.9-bin.tar.gz ls -l export PATH=${PATH}:${WORK_DIR}/maven/apache-maven-3.3.9/bin ${WORK_DIR}/maven/apache-maven-3.3.9/bin/mvn -v cd .. ifconfig export IP=`ip route get 8.8.8.8 | awk '/8.8.8.8/ {print $NF}'` if [ -z "$IP" ]; then echo "Could not determine IP address" exit 1 fi echo $IP if ! ifconfig docker0; then export DOCKER_IP="$IP" else export DOCKER_IP=`ifconfig docker0 | awk -F: '/inet addr/ {gsub(/ .*/,"",$2); print $2}'` fi echo $DOCKER_IP git clone http://gerrit.onap.org/r/oparent git clone http://gerrit.onap.org/r/policy/engine cd engine/packages/docker ${WORK_DIR}/maven/apache-maven-3.3.9/bin/mvn prepare-package --settings ${WORK_DIR}/oparent/settings.xml docker build -t onap/policy-pe target/policy-pe cd ${WORK_DIR} git clone http://gerrit.onap.org/r/policy/drools-pdp cd drools-pdp/packages/docker ${WORK_DIR}/maven/apache-maven-3.3.9/bin/mvn prepare-package --settings ${WORK_DIR}/oparent/settings.xml docker build -t onap/policy-drools target/policy-drools cd ${WORK_DIR} git clone http://gerrit.onap.org/r/policy/docker cd docker chmod +x config/drools/drools-tweaks.sh echo $IP > config/pe/ip_addr.txt ls -l config/pe/ip_addr.txt cat config/pe/ip_addr.txt export MTU=9126 export PRELOAD_POLICIES=false docker-compose -f docker-compose-integration.yml up -d if [ ! $? -eq 0 ]; then echo "Docker compose failed" exit 1 fi docker ps POLICY_IP=`docker inspect --format '{{ .NetworkSettings.Networks.docker_default.IPAddress}}' drools` echo ${POLICY_IP} PDP_IP=`docker inspect --format '{{ .NetworkSettings.Networks.docker_default.IPAddress}}' pdp` echo ${PDP_IP} PAP_IP=`docker inspect --format '{{ .NetworkSettings.Networks.docker_default.IPAddress}}' pap` echo ${PAP_IP} BRMS_IP=`docker inspect --format '{{ .NetworkSettings.Networks.docker_default.IPAddress}}' brmsgw` echo ${BRMS_IP} NEXUS_IP=`docker inspect --format '{{ .NetworkSettings.Networks.docker_default.IPAddress}}' nexus` echo ${NEXUS_IP} MARIADB_IP=`docker inspect --format '{{ .NetworkSettings.Networks.docker_default.IPAddress}}' mariadb` echo ${MARIADB_IP} sleep 3m docker logs mariadb 2>&1 | grep -q "mysqld: ready for connections" if [ $? -eq 0 ]; then # mariadb is ok - sleep a little longer for others sleep 2m else echo mariadb is not ready echo Restarting... docker kill drools pdp pap brmsgw nexus mariadb docker rm -f drools pdp pap brmsgw nexus mariadb docker-compose -f docker-compose-integration.yml up -d if [ ! $? -eq 0 ]; then echo "Docker compose failed" exit 1 fi docker ps POLICY_IP=`docker inspect --format '{{ .NetworkSettings.Networks.docker_default.IPAddress}}' drools` echo ${POLICY_IP} PDP_IP=`docker inspect --format '{{ .NetworkSettings.Networks.docker_default.IPAddress}}' pdp` echo ${PDP_IP} PAP_IP=`docker inspect --format '{{ .NetworkSettings.Networks.docker_default.IPAddress}}' pap` echo ${PAP_IP} BRMS_IP=`docker inspect --format '{{ .NetworkSettings.Networks.docker_default.IPAddress}}' brmsgw` echo ${BRMS_IP} NEXUS_IP=`docker inspect --format '{{ .NetworkSettings.Networks.docker_default.IPAddress}}' nexus` echo ${NEXUS_IP} MARIADB_IP=`docker inspect --format '{{ .NetworkSettings.Networks.docker_default.IPAddress}}' mariadb` echo ${MARIADB_IP} sleep 5m fi netstat -tnl ${DIR}/wait_for_port.sh ${MARIADB_IP} 3306 rc=$? if [[ $rc != 0 ]]; then echo "cannot open ${MARIADB_IP} 3306" telnet ${MARIADB_IP} 3306 < /dev/null nc -vz ${MARIADB_IP} 3306 docker logs mariadb exit $rc fi ${DIR}/wait_for_port.sh ${NEXUS_IP} 8081 rc=$? if [[ $rc != 0 ]]; then echo "cannot open ${NEXUS_IP} 8081" telnet ${NEXUS_IP} 8081 < /dev/null nc -vz ${NEXUS_IP} 8081 docker logs nexus exit $rc fi ${DIR}/wait_for_port.sh ${POLICY_IP} 9696 rc=$? if [[ $rc != 0 ]]; then echo "cannot open ${POLICY_IP} 9696" telnet ${POLICY_IP} 9696 < /dev/null nc -vz ${POLICY_IP} 9696 docker logs drools exit $rc fi ${DIR}/wait_for_port.sh ${PAP_IP} 9091 rc=$? if [[ $rc != 0 ]]; then echo "cannot open ${PAP_IP} 9091" telnet ${PAP_IP} 9091 < /dev/null nc -vz ${PAP_IP} 9091 docker logs pap exit $rc fi ${DIR}/wait_for_port.sh ${PDP_IP} 8081 rc=$? if [[ $rc != 0 ]]; then echo "cannot open ${PDP_IP} 8081" telnet ${PDP_IP} 8081 < /dev/null nc -vz ${PDP_IP} 8081 docker logs pdp exit $rc fi ${DIR}/wait_for_port.sh ${BRMS_IP} 9989 rc=$? if [[ $rc != 0 ]]; then echo "cannot open ${BRMS_IP} 9989" telnet ${BRMS_IP} 9989" < /dev/null nc -vz ${BRMS_IP} 9989" docker logs brmsgw exit $rc fi docker logs drools docker logs pap docker logs pdp docker logs brmsgw TIME_OUT=300 INTERVAL=20 TIME=0 while [ "$TIME" -lt "$TIME_OUT" ]; do curl -k -i --user "demo@people.osaaf.org:demo123456!" -H "ContentType: application/json" -H "Accept: application/json" https://${POLICY_IP}:9696/healthcheck && break echo Sleep: $INTERVAL seconds before testing if Policy is up. Total wait time up now is: $TIME seconds. Timeout is: $TIME_OUT seconds sleep $INTERVAL TIME=$(($TIME+$INTERVAL)) done # # Add more sleep for everything to settle # sleep 3m