From 1e81ab929ecb821b028084fad6b169a11340835f Mon Sep 17 00:00:00 2001 From: Mathias Brunkow Moser Date: Mon, 30 Oct 2023 11:43:31 +0100 Subject: [PATCH] feat: removed remaining decrepated passport version configuration in the frontend --- buildAndDeploy.sh | 3 +-- charts/digital-product-pass/values-beta.yaml | 5 +++-- charts/digital-product-pass/values-dev.yaml | 5 +++-- charts/digital-product-pass/values-int.yaml | 5 +++-- charts/digital-product-pass/values.yaml | 11 +++++------ entrypoint.sh | 1 - src/services/BackendService.js | 11 +++++------ src/services/service.const.js | 5 +---- src/views/PassportView.vue | 6 ++---- 9 files changed, 23 insertions(+), 29 deletions(-) diff --git a/buildAndDeploy.sh b/buildAndDeploy.sh index 7fbfdff30..e1541c34c 100644 --- a/buildAndDeploy.sh +++ b/buildAndDeploy.sh @@ -25,7 +25,6 @@ CONTAINER_NAME=$1 IMAGE_NAME="consumer-ui" IMAGE_TAG="latest" -PASSPORT_VERSION="" VERSION="" API_TIMEOUT="" API_DELAY="" @@ -43,6 +42,6 @@ echo "Build docker image..." docker build -t ${IMAGE_NAME}:${IMAGE_TAG} . echo "Run docker container..." -docker run --name ${CONTAINER_NAME} -p 8080:80 -d -e PASS_VERSION=${PASSPORT_VERSION} -e APP_VERSION=${VERSION} -e APP_API_TIMEOUT=${API_TIMEOUT} -e APP_API_MAX_RETRIES=${API_MAX_RETRIES} -e APP_API_DELAY=${API_DELAY} -e IDENTITY_PROVIDER_URL=${IDP_URL} -e HOST_URL=${SERVER_URL} -e DATA_URL=${BACKEND_URL} -e KEYCLOAK_CLIENTID=${KEYCLOAK_CLIENTID} -e KEYCLOAK_REALM=${KEYCLOAK_REALM} -e KEYCLOAK_ONLOAD=${KEYCLOAK_ONLOAD} ${IMAGE_NAME}:${IMAGE_TAG} +docker run --name ${CONTAINER_NAME} -p 8080:80 -d -e APP_VERSION=${VERSION} -e APP_API_TIMEOUT=${API_TIMEOUT} -e APP_API_MAX_RETRIES=${API_MAX_RETRIES} -e APP_API_DELAY=${API_DELAY} -e IDENTITY_PROVIDER_URL=${IDP_URL} -e HOST_URL=${SERVER_URL} -e DATA_URL=${BACKEND_URL} -e KEYCLOAK_CLIENTID=${KEYCLOAK_CLIENTID} -e KEYCLOAK_REALM=${KEYCLOAK_REALM} -e KEYCLOAK_ONLOAD=${KEYCLOAK_ONLOAD} ${IMAGE_NAME}:${IMAGE_TAG} echo "Done" \ No newline at end of file diff --git a/charts/digital-product-pass/values-beta.yaml b/charts/digital-product-pass/values-beta.yaml index 07cb46c86..9ad978eb2 100644 --- a/charts/digital-product-pass/values-beta.yaml +++ b/charts/digital-product-pass/values-beta.yaml @@ -163,8 +163,9 @@ backend: encrypt: true indent: true dir: "data/transfer" - versions: - - 'v3.0.1' + aspects: + - "urn:bamm:io.catenax.generic.digital_product_passport:1.0.0#DigitalProductPassport" + - "urn:bamm:io.catenax.battery.battery_pass:3.0.1#BatteryPass" vault: type: 'local' diff --git a/charts/digital-product-pass/values-dev.yaml b/charts/digital-product-pass/values-dev.yaml index 68fab0371..672635d26 100644 --- a/charts/digital-product-pass/values-dev.yaml +++ b/charts/digital-product-pass/values-dev.yaml @@ -163,8 +163,9 @@ backend: encrypt: true indent: true dir: "data/transfer" - versions: - - 'v3.0.1' + aspects: + - "urn:bamm:io.catenax.generic.digital_product_passport:1.0.0#DigitalProductPassport" + - "urn:bamm:io.catenax.battery.battery_pass:3.0.1#BatteryPass" vault: type: 'local' diff --git a/charts/digital-product-pass/values-int.yaml b/charts/digital-product-pass/values-int.yaml index 627010601..b30f8a47e 100644 --- a/charts/digital-product-pass/values-int.yaml +++ b/charts/digital-product-pass/values-int.yaml @@ -161,8 +161,9 @@ backend: encrypt: true indent: true dir: "data/transfer" - versions: - - 'v3.0.1' + aspects: + - "urn:bamm:io.catenax.generic.digital_product_passport:1.0.0#DigitalProductPassport" + - "urn:bamm:io.catenax.battery.battery_pass:3.0.1#BatteryPass" vault: type: 'local' diff --git a/charts/digital-product-pass/values.yaml b/charts/digital-product-pass/values.yaml index 8b6b4ffaa..4d4a38a7d 100644 --- a/charts/digital-product-pass/values.yaml +++ b/charts/digital-product-pass/values.yaml @@ -52,9 +52,7 @@ frontend: backend_url: "" # -- url of the identity provider service idp_url: "" - # -- required: digital product passport version number - default value: v3.0.1 - passport: - version: "v3.0.1" ## Mandatory Field, passport version must be available (Semantic Structure) + # -- api timeouts api: # -- max retries for getting status max_retries: 30 @@ -197,9 +195,10 @@ backend: indent: true # -- directory to store the passport when is not linked to a process dir: "data/transfer" - # -- passport versions allowed - versions: - - 'v3.0.1' + # -- passport versions and aspects allowed + aspects: + - "urn:bamm:io.catenax.generic.digital_product_passport:1.0.0#DigitalProductPassport" + - "urn:bamm:io.catenax.battery.battery_pass:3.0.1#BatteryPass" # -- configuration of the spring boot server server: # -- configuration of backend errors diff --git a/entrypoint.sh b/entrypoint.sh index 570f7fdf9..a665e93ce 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -27,7 +27,6 @@ echo "Replacing docker environment constants in JavaScript files" for file in $ROOT_DIR/assets/index-*.js* $ROOT_DIR/index.html; do echo "Processing $file ..."; - sed -i 's|PASS_VERSION|'${PASSPORT_VERSION}'|g' $file sed -i 's|IDENTITY_PROVIDER_URL|'${IDP_URL}'|g' $file sed -i 's|HOST_URL|'${SERVER_URL}'|g' $file sed -i 's|DATA_URL|'${BACKEND_URL}'|g' $file diff --git a/src/services/BackendService.js b/src/services/BackendService.js index 299754f86..13ab5e4fd 100644 --- a/src/services/BackendService.js +++ b/src/services/BackendService.js @@ -54,7 +54,7 @@ export default class BackendService { } } - async getPassport(version, id, authentication) { + async getPassport(id, authentication) { let processResponse = null; // Try to get the negotiation contract let ids = null; @@ -105,7 +105,7 @@ export default class BackendService { // Try to get the negotiation contract try { - negotiationResponse = await this.searchContract(ids["serializedId"], version, processId, authentication); + negotiationResponse = await this.searchContract(ids["serializedId"], processId, authentication); } catch (e) { return negotiationResponse; } @@ -213,10 +213,9 @@ export default class BackendService { } } - getSearchBody(id, version, processId) { + getSearchBody(id, processId) { return { "id": id, - "version": version, "processId": processId } } @@ -278,9 +277,9 @@ export default class BackendService { }); }); } - async searchContract(id, version, processId, authentication) { + async searchContract(id, processId, authentication) { return new Promise(resolve => { - let body = this.getSearchBody(id, version, processId); + let body = this.getSearchBody(id, processId); axios.post(`${BACKEND_URL}/api/contract/search`, body, this.getHeaders(authentication)) .then((response) => { resolve(response.data); diff --git a/src/services/service.const.js b/src/services/service.const.js index a66380611..26de2338c 100644 --- a/src/services/service.const.js +++ b/src/services/service.const.js @@ -32,7 +32,6 @@ const IDP_URL = "IDENTITY_PROVIDER_URL"; // Get urls that can be empty let serverUrl = "HOST_URL"; let backendUrl = "DATA_URL"; -let passVer = 'PASS_VERSION'; let retries = 'APP_API_MAX_RETRIES'; let timeout = 'APP_API_TIMEOUT'; let delay = 'APP_API_DELAY'; @@ -45,7 +44,6 @@ let repoEndpoint = "REPO_ENDPOINT_URL"; // Default values if the value is not specified serverUrl = (serverUrl != null && serverUrl !== "") ? serverUrl : "https://materialpass.int.demo.catena-x.net" backendUrl = (backendUrl != null && backendUrl !== "") ? backendUrl : serverUrl -passVer = (passVer != null && passVer !== "") ? passVer : "v3.0.1" clientId = (clientId != null && clientId !== "") ? clientId : "Cl13-CX-Battery" realm = (realm != null && realm !== "") ? realm : "CX-Central" onLoad = (onLoad != null && onLoad !== "") ? onLoad : "login-required" @@ -58,7 +56,6 @@ retries = numberUtil.parseInt(retries, 20); // Define constants const SERVER_URL = serverUrl; const BACKEND_URL = backendUrl; -const PASSPORT_VERSION = passVer; const API_MAX_RETRIES = retries; const API_TIMEOUT = timeout; const API_DELAY = delay; @@ -85,4 +82,4 @@ if (window.location.href.includes("localhost")) { //Modify credentials for local REDIRECT_URI = SERVER_URL; } // Export all the CONSTANTS and VARIABLES -export { INIT_OPTIONS, REDIRECT_URI, SERVER_URL, IDP_URL, BACKEND_URL, PASSPORT_VERSION, VERSION, API_TIMEOUT, API_DELAY, API_MAX_RETRIES, COMMIT_ID, REPO_ENDPOINT }; \ No newline at end of file +export { INIT_OPTIONS, REDIRECT_URI, SERVER_URL, IDP_URL, BACKEND_URL, VERSION, API_TIMEOUT, API_DELAY, API_MAX_RETRIES, COMMIT_ID, REPO_ENDPOINT }; \ No newline at end of file diff --git a/src/views/PassportView.vue b/src/views/PassportView.vue index 2ad97747d..c457812d7 100644 --- a/src/views/PassportView.vue +++ b/src/views/PassportView.vue @@ -154,7 +154,7 @@ import BatteryCards from "@/components/passport/BatteryCards.vue"; import GeneralCards from "@/components/passport/GeneralCards.vue"; import FooterComponent from "@/components/general/Footer.vue"; import ErrorComponent from "@/components/general/ErrorComponent.vue"; -import { API_TIMEOUT, PASSPORT_VERSION } from "@/services/service.const"; +import { API_TIMEOUT } from "@/services/service.const"; import threadUtil from "@/utils/threadUtil.js"; import jsonUtil from "@/utils/jsonUtil.js"; import configUtil from "@/utils/configUtil.js"; @@ -225,8 +225,7 @@ export default { type: "error", status: 500, statusText: "Internal Server Error", - }, - version: PASSPORT_VERSION, + } }; }, @@ -302,7 +301,6 @@ export default { // Get access token from IDP // Get the aspect for the selected version response = await backendService.getPassport( - this.version, id, this.auth );