From 35b3ad94f6b2240b681b72e9ee719f275a5d9771 Mon Sep 17 00:00:00 2001
From: Martin Weise <martin.weise@tuwien.ac.at>
Date: Mon, 1 May 2023 16:16:22 +0200
Subject: [PATCH] Hotfix doi display in the frontend

---
 .env.unix.example                             | 10 ++---
 dbrepo-container-service/Dockerfile           |  2 +-
 .../src/main/resources/application-local.yml  |  2 +-
 dbrepo-database-service/Dockerfile            |  2 +-
 .../src/main/resources/application-local.yml  |  2 +-
 dbrepo-discovery-service/Dockerfile           |  2 +-
 dbrepo-gateway-service/Dockerfile             |  2 +-
 dbrepo-identifier-service/Dockerfile          |  2 +-
 .../tuwien/endpoints/IdentifierEndpoint.java  |  2 +-
 .../src/main/resources/application-local.yml  |  2 +-
 dbrepo-metadata-db/Dockerfile                 |  2 +-
 dbrepo-metadata-service/Dockerfile            |  2 +-
 dbrepo-query-service/Dockerfile               |  2 +-
 .../src/main/resources/application-local.yml  |  2 +-
 dbrepo-table-service/Dockerfile               |  2 +-
 .../src/main/resources/application-local.yml  |  2 +-
 dbrepo-ui/components/identifier/Banner.vue    | 42 +++++++++++++------
 dbrepo-ui/nuxt.config.js                      |  5 ++-
 dbrepo-user-service/Dockerfile                |  2 +-
 docker-compose.yml                            |  2 +
 20 files changed, 55 insertions(+), 36 deletions(-)

diff --git a/.env.unix.example b/.env.unix.example
index f4b233b80f..eec8b3c7bd 100644
--- a/.env.unix.example
+++ b/.env.unix.example
@@ -18,8 +18,8 @@ WEBSITE=http://localhost
 GATEWAY_ENDPOINT=http://gateway-service:9095
 TOKEN_MAX=5
 LOG_LEVEL=trace # error, warning, info, debug, trace
-DOI_URL=https://doi.org
-DATACITE_URL=https://api.datacite.org
-DATACITE_PREFIX=10.1234
-DATACITE_USERNAME=username
-DATACITE_PASSWORD=password
\ No newline at end of file
+DOI_URL="https://doi.org"
+DATACITE_URL="https://api.datacite.org"
+DATACITE_PREFIX="10.1234"
+DATACITE_USERNAME="username"
+DATACITE_PASSWORD="password"
diff --git a/dbrepo-container-service/Dockerfile b/dbrepo-container-service/Dockerfile
index 71b0991dcc..cab97691b1 100644
--- a/dbrepo-container-service/Dockerfile
+++ b/dbrepo-container-service/Dockerfile
@@ -16,7 +16,7 @@ COPY ./services ./services
 COPY ./report ./report
 
 # Make sure it compiles
-RUN mvn -q clean package -DskipTests > /dev/null
+RUN mvn -q clean package -DskipTests
 
 ###### THIRD STAGE ######
 FROM openjdk:11-jre-slim as runtime
diff --git a/dbrepo-container-service/rest-service/src/main/resources/application-local.yml b/dbrepo-container-service/rest-service/src/main/resources/application-local.yml
index c02b1b829c..ca57158d4d 100644
--- a/dbrepo-container-service/rest-service/src/main/resources/application-local.yml
+++ b/dbrepo-container-service/rest-service/src/main/resources/application-local.yml
@@ -46,7 +46,7 @@ fda:
   mount.path: /tmp
   ready.path: ./ready
   jwt:
-    issuer: http://localhost:8443/realms/dbrepo
+    issuer: https://localhost:8443/realms/dbrepo
     public_key: MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqqnHQ2BWWW9vDNLRCcxD++xZg/16oqMo/c1l+lcFEjjAIJjJp/HqrPYU/U9GvquGE6PbVFtTzW1KcKawOW+FJNOA3CGo8Q1TFEfz43B8rZpKsFbJKvQGVv1Z4HaKPvLUm7iMm8Hv91cLduuoWx6Q3DPe2vg13GKKEZe7UFghF+0T9u8EKzA/XqQ0OiICmsmYPbwvf9N3bCKsB/Y10EYmZRb8IhCoV9mmO5TxgWgiuNeCTtNCv2ePYqL/U0WvyGFW0reasIK8eg3KrAUj8DpyOgPOVBn3lBGf+3KFSYi+0bwZbJZWqbC/Xlk20Go1YfeJPRIt7ImxD27R/lNjgDO/MwIDAQAB
   client_secret: client-secret
   client_id: dbrepo-client
diff --git a/dbrepo-database-service/Dockerfile b/dbrepo-database-service/Dockerfile
index f287e8e51c..b181da3570 100644
--- a/dbrepo-database-service/Dockerfile
+++ b/dbrepo-database-service/Dockerfile
@@ -16,7 +16,7 @@ COPY ./services ./services
 COPY ./report ./report
 
 # Make sure it compiles
-RUN mvn -q clean package -DskipTests > /dev/null
+RUN mvn -q clean package -DskipTests
 
 ###### THIRD STAGE ######
 FROM openjdk:11-jre-slim as runtime
diff --git a/dbrepo-database-service/rest-service/src/main/resources/application-local.yml b/dbrepo-database-service/rest-service/src/main/resources/application-local.yml
index 9329557588..c6bb7a1caa 100644
--- a/dbrepo-database-service/rest-service/src/main/resources/application-local.yml
+++ b/dbrepo-database-service/rest-service/src/main/resources/application-local.yml
@@ -47,7 +47,7 @@ fda:
     password: elastic
   ready.path: ./ready
   jwt:
-    issuer: http://localhost:8443/realms/dbrepo
+    issuer: https://localhost:8443/realms/dbrepo
     public_key: MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqqnHQ2BWWW9vDNLRCcxD++xZg/16oqMo/c1l+lcFEjjAIJjJp/HqrPYU/U9GvquGE6PbVFtTzW1KcKawOW+FJNOA3CGo8Q1TFEfz43B8rZpKsFbJKvQGVv1Z4HaKPvLUm7iMm8Hv91cLduuoWx6Q3DPe2vg13GKKEZe7UFghF+0T9u8EKzA/XqQ0OiICmsmYPbwvf9N3bCKsB/Y10EYmZRb8IhCoV9mmO5TxgWgiuNeCTtNCv2ePYqL/U0WvyGFW0reasIK8eg3KrAUj8DpyOgPOVBn3lBGf+3KFSYi+0bwZbJZWqbC/Xlk20Go1YfeJPRIt7ImxD27R/lNjgDO/MwIDAQAB
   client_secret: client-secret
   client_id: dbrepo-client
diff --git a/dbrepo-discovery-service/Dockerfile b/dbrepo-discovery-service/Dockerfile
index 8cbe9357c0..b216c09e09 100644
--- a/dbrepo-discovery-service/Dockerfile
+++ b/dbrepo-discovery-service/Dockerfile
@@ -16,7 +16,7 @@ COPY ./services ./services
 COPY ./report ./report
 
 # Make sure it compiles
-RUN mvn -q clean package -DskipTests > /dev/null
+RUN mvn -q clean package -DskipTests
 
 ###### THIRD STAGE ######
 FROM openjdk:11-jre-slim as runtime
diff --git a/dbrepo-gateway-service/Dockerfile b/dbrepo-gateway-service/Dockerfile
index c30a04e0c4..7fd33750f7 100644
--- a/dbrepo-gateway-service/Dockerfile
+++ b/dbrepo-gateway-service/Dockerfile
@@ -15,7 +15,7 @@ COPY ./report ./report
 COPY ./rest-service ./rest-service
 
 # Make sure it compiles
-RUN mvn -q clean package -DskipTests > /dev/null
+RUN mvn -q clean package -DskipTests
 
 ###### SECOND STAGE ######
 FROM openjdk:11-jre-slim as runtime
diff --git a/dbrepo-identifier-service/Dockerfile b/dbrepo-identifier-service/Dockerfile
index 13204336ab..b8343cc968 100644
--- a/dbrepo-identifier-service/Dockerfile
+++ b/dbrepo-identifier-service/Dockerfile
@@ -17,7 +17,7 @@ COPY ./services ./services
 COPY ./report ./report
 
 # Make sure it compiles
-RUN mvn -q clean package -DskipTests > /dev/null
+RUN mvn -q clean package -DskipTests
 
 ###### THIRD STAGE ######
 FROM openjdk:11-jre-slim as runtime
diff --git a/dbrepo-identifier-service/rest-service/src/main/java/at/tuwien/endpoints/IdentifierEndpoint.java b/dbrepo-identifier-service/rest-service/src/main/java/at/tuwien/endpoints/IdentifierEndpoint.java
index f92574b85f..eb7f335e0e 100644
--- a/dbrepo-identifier-service/rest-service/src/main/java/at/tuwien/endpoints/IdentifierEndpoint.java
+++ b/dbrepo-identifier-service/rest-service/src/main/java/at/tuwien/endpoints/IdentifierEndpoint.java
@@ -135,7 +135,7 @@ public class IdentifierEndpoint {
                                                 @NotNull Principal principal)
             throws IdentifierAlreadyExistsException, QueryNotFoundException, IdentifierPublishingNotAllowedException,
             RemoteUnavailableException, UserNotFoundException, DatabaseNotFoundException, IdentifierRequestException, AccessDeniedException {
-        log.debug("endpoint create identifier, data={}, authorization={}, principal={}", data, authorization, principal);
+        log.debug("endpoint create identifier, data={}, authorization=(hidden), principal={}", data, principal);
         if (data.getType().equals(IdentifierTypeDto.SUBSET) && data.getQid() == null) {
             log.error("Identifier of type subset need to have a qid present");
             throw new IdentifierRequestException("Identifier of type subset need to have a qid present");
diff --git a/dbrepo-identifier-service/rest-service/src/main/resources/application-local.yml b/dbrepo-identifier-service/rest-service/src/main/resources/application-local.yml
index 5e5f8130a7..bb5c0681e3 100644
--- a/dbrepo-identifier-service/rest-service/src/main/resources/application-local.yml
+++ b/dbrepo-identifier-service/rest-service/src/main/resources/application-local.yml
@@ -44,7 +44,7 @@ eureka:
 fda:
   ready.path: ./ready
   jwt:
-    issuer: http://localhost:8443/realms/dbrepo
+    issuer: https://localhost:8443/realms/dbrepo
     public_key: MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqqnHQ2BWWW9vDNLRCcxD++xZg/16oqMo/c1l+lcFEjjAIJjJp/HqrPYU/U9GvquGE6PbVFtTzW1KcKawOW+FJNOA3CGo8Q1TFEfz43B8rZpKsFbJKvQGVv1Z4HaKPvLUm7iMm8Hv91cLduuoWx6Q3DPe2vg13GKKEZe7UFghF+0T9u8EKzA/XqQ0OiICmsmYPbwvf9N3bCKsB/Y10EYmZRb8IhCoV9mmO5TxgWgiuNeCTtNCv2ePYqL/U0WvyGFW0reasIK8eg3KrAUj8DpyOgPOVBn3lBGf+3KFSYi+0bwZbJZWqbC/Xlk20Go1YfeJPRIt7ImxD27R/lNjgDO/MwIDAQAB
   client_secret: client-secret
   client_id: dbrepo-client
diff --git a/dbrepo-metadata-db/Dockerfile b/dbrepo-metadata-db/Dockerfile
index 6dccde6ac2..264b9e76f3 100644
--- a/dbrepo-metadata-db/Dockerfile
+++ b/dbrepo-metadata-db/Dockerfile
@@ -14,7 +14,7 @@ COPY ./querystore ./querystore
 COPY ./test ./test
 
 # Make sure it compiles
-RUN mvn -q clean package -DskipTests > /dev/null
+RUN mvn -q clean package -DskipTests
 
 # Install to local repository
 RUN mvn -q clean install > /dev/null
diff --git a/dbrepo-metadata-service/Dockerfile b/dbrepo-metadata-service/Dockerfile
index f9f4f11e7a..af0e2b6da4 100644
--- a/dbrepo-metadata-service/Dockerfile
+++ b/dbrepo-metadata-service/Dockerfile
@@ -16,7 +16,7 @@ COPY ./services ./services
 COPY ./report ./report
 
 # Make sure it compiles
-RUN mvn -q clean package -DskipTests > /dev/null
+RUN mvn -q clean package -DskipTests
 
 ###### THIRD STAGE ######
 FROM openjdk:11-jre-slim as runtime
diff --git a/dbrepo-query-service/Dockerfile b/dbrepo-query-service/Dockerfile
index 481a93ad52..a8114f56c6 100644
--- a/dbrepo-query-service/Dockerfile
+++ b/dbrepo-query-service/Dockerfile
@@ -17,7 +17,7 @@ COPY ./report ./report
 COPY ./api ./api
 
 # Make sure it compiles
-RUN mvn -q clean package -DskipTests > /dev/null
+RUN mvn -q clean package -DskipTests
 
 ###### THIRD STAGE ######
 FROM openjdk:11-jre-slim as runtime
diff --git a/dbrepo-query-service/rest-service/src/main/resources/application-local.yml b/dbrepo-query-service/rest-service/src/main/resources/application-local.yml
index aa9d106cff..ac9c7fb360 100644
--- a/dbrepo-query-service/rest-service/src/main/resources/application-local.yml
+++ b/dbrepo-query-service/rest-service/src/main/resources/application-local.yml
@@ -48,7 +48,7 @@ fda:
   gateway.endpoint: http://localhost:9095
   ready.path: ./ready
   jwt:
-    issuer: http://localhost:8443/realms/dbrepo
+    issuer: https://localhost:8443/realms/dbrepo
     public_key: MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqqnHQ2BWWW9vDNLRCcxD++xZg/16oqMo/c1l+lcFEjjAIJjJp/HqrPYU/U9GvquGE6PbVFtTzW1KcKawOW+FJNOA3CGo8Q1TFEfz43B8rZpKsFbJKvQGVv1Z4HaKPvLUm7iMm8Hv91cLduuoWx6Q3DPe2vg13GKKEZe7UFghF+0T9u8EKzA/XqQ0OiICmsmYPbwvf9N3bCKsB/Y10EYmZRb8IhCoV9mmO5TxgWgiuNeCTtNCv2ePYqL/U0WvyGFW0reasIK8eg3KrAUj8DpyOgPOVBn3lBGf+3KFSYi+0bwZbJZWqbC/Xlk20Go1YfeJPRIt7ImxD27R/lNjgDO/MwIDAQAB
   client_secret: client-secret
   client_id: dbrepo-client
diff --git a/dbrepo-table-service/Dockerfile b/dbrepo-table-service/Dockerfile
index ebb3999b62..f4741fc864 100644
--- a/dbrepo-table-service/Dockerfile
+++ b/dbrepo-table-service/Dockerfile
@@ -16,7 +16,7 @@ COPY ./services ./services
 COPY ./report ./report
 
 # Make sure it compiles
-RUN mvn -q clean package -DskipTests > /dev/null
+RUN mvn -q clean package -DskipTests
 
 ###### THIRD STAGE ######
 FROM openjdk:11-jre-slim as runtime
diff --git a/dbrepo-table-service/rest-service/src/main/resources/application-local.yml b/dbrepo-table-service/rest-service/src/main/resources/application-local.yml
index 71eabd9ce4..ea99819af3 100644
--- a/dbrepo-table-service/rest-service/src/main/resources/application-local.yml
+++ b/dbrepo-table-service/rest-service/src/main/resources/application-local.yml
@@ -43,7 +43,7 @@ eureka:
 fda:
   ready.path: ./ready
   jwt:
-    issuer: http://localhost:8443/realms/dbrepo
+    issuer: https://localhost:8443/realms/dbrepo
     public_key: MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqqnHQ2BWWW9vDNLRCcxD++xZg/16oqMo/c1l+lcFEjjAIJjJp/HqrPYU/U9GvquGE6PbVFtTzW1KcKawOW+FJNOA3CGo8Q1TFEfz43B8rZpKsFbJKvQGVv1Z4HaKPvLUm7iMm8Hv91cLduuoWx6Q3DPe2vg13GKKEZe7UFghF+0T9u8EKzA/XqQ0OiICmsmYPbwvf9N3bCKsB/Y10EYmZRb8IhCoV9mmO5TxgWgiuNeCTtNCv2ePYqL/U0WvyGFW0reasIK8eg3KrAUj8DpyOgPOVBn3lBGf+3KFSYi+0bwZbJZWqbC/Xlk20Go1YfeJPRIt7ImxD27R/lNjgDO/MwIDAQAB
   client_secret: client-secret
   client_id: dbrepo-client
diff --git a/dbrepo-ui/components/identifier/Banner.vue b/dbrepo-ui/components/identifier/Banner.vue
index 8756962c9e..ece371663f 100644
--- a/dbrepo-ui/components/identifier/Banner.vue
+++ b/dbrepo-ui/components/identifier/Banner.vue
@@ -1,10 +1,9 @@
 <template>
-  <p v-if="identifier?.doi">DOI: <a :href="doiUrl(identifier.doi)">{{ identifier.doi }}</a></p>
-  <p v-else-if="identifier?.id"><a :href="pidUrl(identifier.id)">{{ pidUrl(identifier.id) }}</a></p>
+  <div>
+    {{ prefix }}: <a :href="pidUrl">{{ displayName }}</a>
+  </div>
 </template>
-yarn dev
 <script>
-
 export default {
   props: {
     identifier: {
@@ -17,17 +16,34 @@ export default {
   computed: {
     baseUrl () {
       return `${location.protocol}//${location.host}`
-    }
-  },
-  methods: {
-    pidUrl (pid) {
-      return `${this.baseUrl}/pid/${pid}`
     },
-    doiUrl (doi) {
-      return `${this.$config.doiUrl}/${doi}`
+    baseDoi () {
+      return this.$config.doiUrl
+    },
+    isDoi () {
+      if (!this.identifier) {
+        return null
+      }
+      return this.identifier.doi !== null
+    },
+    prefix () {
+      if (!this.identifier) {
+        return null
+      }
+      return this.isDoi ? 'DOI' : 'URI'
+    },
+    pidUrl () {
+      if (!this.identifier) {
+        return null
+      }
+      return this.isDoi ? `${this.baseDoi}/${this.identifier.doi}` : `${this.baseUrl}/pid/${this.identifier.id}`
+    },
+    displayName () {
+      if (!this.identifier) {
+        return null
+      }
+      return this.isDoi ? `${this.identifier.doi}` : `/pid/${this.identifier.id}`
     }
   }
 }
 </script>
-
-<style scoped></style>
diff --git a/dbrepo-ui/nuxt.config.js b/dbrepo-ui/nuxt.config.js
index bdb8304b47..5cf3275c27 100644
--- a/dbrepo-ui/nuxt.config.js
+++ b/dbrepo-ui/nuxt.config.js
@@ -1,6 +1,6 @@
 import path from 'path'
 import colors from 'vuetify/es5/util/colors'
-import { api, icon, search, clientSecret, title, sandbox, logo, version, defaultPublisher } from './config'
+import { api, icon, search, clientSecret, title, sandbox, logo, version, defaultPublisher, doiUrl } from './config'
 
 const proxy = {}
 
@@ -92,7 +92,8 @@ export default {
     version,
     logo,
     clientSecret,
-    defaultPublisher
+    defaultPublisher,
+    doiUrl
   },
 
   serverMiddleware: [
diff --git a/dbrepo-user-service/Dockerfile b/dbrepo-user-service/Dockerfile
index f4fb17c5e4..58faa272f6 100644
--- a/dbrepo-user-service/Dockerfile
+++ b/dbrepo-user-service/Dockerfile
@@ -16,7 +16,7 @@ COPY ./services ./services
 COPY ./report ./report
 
 # Make sure it compiles
-RUN mvn -q clean package -DskipTests > /dev/null
+RUN mvn -q clean package -DskipTests
 
 ###### THIRD STAGE ######
 FROM openjdk:11-jre-slim as runtime
diff --git a/docker-compose.yml b/docker-compose.yml
index f4364d1bb4..6f1c13cbb5 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -213,6 +213,8 @@ services:
       - "9096:9096"
     env_file:
       - .env
+    environment:
+      - SPRING_PROFILES_ACTIVE=doi
     depends_on:
       dbrepo-query-service:
         condition: service_healthy
-- 
GitLab