diff --git a/.env.unix.example b/.env.unix.example index 8577b8c00e0a6426aed10c7c2afeed0225730eba..3ece8c28877959e1291dbcb8113f7f67bc45ad25 100644 --- a/.env.unix.example +++ b/.env.unix.example @@ -14,4 +14,5 @@ BROKER_PASSWORD=fda KEYCLOAK_ADMIN=fda KEYCLOAK_ADMIN_PASSWORD=fda BROKER_CONSUMERS=2 -WEBSITE=http://example.com \ No newline at end of file +WEBSITE=http://example.com +GATEWAY_ENDPOINT=http://gateway-service:9095 \ No newline at end of file diff --git a/fda-gateway-service/Dockerfile b/fda-gateway-service/Dockerfile index 125909033f3bf11b366d289cddfac7c21f57e315..7a9bf3614211731dfefefca40e41698bcde70614 100644 --- a/fda-gateway-service/Dockerfile +++ b/fda-gateway-service/Dockerfile @@ -19,7 +19,7 @@ FROM openjdk:11-jre-slim as runtime ENV METADATA_DB=fda ENV METADATA_USERNAME=postgres ENV METADATA_PASSWORD=postgres -ENV GATEWAY_ENDPOINT=https://gateway-service:9095 +ENV GATEWAY_ENDPOINT=http://gateway-service:9095 ENV LOG_LEVEL=debug WORKDIR /app diff --git a/fda-gateway-service/rest-service/src/main/resources/application-local.yml b/fda-gateway-service/rest-service/src/main/resources/application-local.yml index b53dbde5eee61dd749ccc089d7c9571656a62f56..f1c31c526a7c7ea57f54caf56dffba75a06ffa15 100644 --- a/fda-gateway-service/rest-service/src/main/resources/application-local.yml +++ b/fda-gateway-service/rest-service/src/main/resources/application-local.yml @@ -41,6 +41,6 @@ eureka: non-secure-port-enabled: false secure-port-enabled: true secure-port: 9095 - client.serviceUrl.defaultZone: http://discovery-service:9090/eureka/ + client.serviceUrl.defaultZone: http://localhost:9090/eureka/ fda: ready.path: ./ready \ No newline at end of file diff --git a/fda-identifier-service/rest-service/src/main/resources/application-local.yml b/fda-identifier-service/rest-service/src/main/resources/application-local.yml index bab1379f36617a8f7e9dc700f9737d476c896edb..3c25bac87e81573687bc5b89b201bed531fd743c 100644 --- a/fda-identifier-service/rest-service/src/main/resources/application-local.yml +++ b/fda-identifier-service/rest-service/src/main/resources/application-local.yml @@ -46,6 +46,6 @@ fda: gateway.endpoint: http://localhost:9095 website: http://localhost:3000 elastic: - endpoint: search-service:9200 + endpoint: localhost:9200 username: elastic password: elastic \ No newline at end of file diff --git a/fda-metadata-service/Dockerfile b/fda-metadata-service/Dockerfile index 0eb916d2c91e161d2f19878e324375116f24ad84..2b3a895f37bec83d81dd65d0d59ce42fdc55bfa1 100644 --- a/fda-metadata-service/Dockerfile +++ b/fda-metadata-service/Dockerfile @@ -24,7 +24,7 @@ FROM openjdk:11-jre-slim as runtime ENV METADATA_DB=fda ENV METADATA_USERNAME=root ENV METADATA_PASSWORD=dbrepo -ENV GATEWAY_ENDPOINT=https://gateway-service:9095 +ENV GATEWAY_ENDPOINT=http://gateway-service:9095 ENV PID_BASE="http://example.com/pid/" ENV REPOSITORY_NAME="Example Repository" ENV BASE_URL="http://example.com" diff --git a/fda-query-service/rest-service/src/main/resources/application-local.yml b/fda-query-service/rest-service/src/main/resources/application-local.yml index c842574f67fcb19dd703fd5ee87861d0d84e3598..aa9d106cff733e77b315edc91eb27c2dfef4cca5 100644 --- a/fda-query-service/rest-service/src/main/resources/application-local.yml +++ b/fda-query-service/rest-service/src/main/resources/application-local.yml @@ -55,6 +55,6 @@ fda: consumers: 2 unsupported: \*,AVG,BIT_AND,BIT_OR,BIT_XOR,COUNT,COUNTDISTINCT,GROUP_CONCAT,JSON_ARRAYAGG,JSON_OBJECTAGG,MAX,MIN,STD,STDDEV,STDDEV_POP,STDDEV_SAMP,SUM,VARIANCE,VAR_POP,VAR_SAMP,-- elastic: - endpoint: search-service:9200 + endpoint: localhost:9200 username: elastic password: elastic \ No newline at end of file diff --git a/fda-table-service/rest-service/src/main/resources/application-local.yml b/fda-table-service/rest-service/src/main/resources/application-local.yml index 87f46f3a0aa32935fdb312f4212bd6e10fa2e3ee..363fde214f05e5c43693731bc7f4fc9afdd854fb 100644 --- a/fda-table-service/rest-service/src/main/resources/application-local.yml +++ b/fda-table-service/rest-service/src/main/resources/application-local.yml @@ -49,6 +49,6 @@ fda: client_id: dbrepo-client gateway.endpoint: http://localhost:9095 elastic: - endpoint: search-service:9200 + endpoint: localhost:9200 username: elastic password: elastic \ No newline at end of file diff --git a/fda-table-service/rest-service/src/main/resources/application.yml b/fda-table-service/rest-service/src/main/resources/application.yml index 65c0aed65a13be256b13dd2c0af3ca3020778ac4..24e4a6534817db7d06711591e7ba03782bebdd8b 100644 --- a/fda-table-service/rest-service/src/main/resources/application.yml +++ b/fda-table-service/rest-service/src/main/resources/application.yml @@ -47,7 +47,7 @@ fda: public_key: "${JWT_PUBKEY}" client_secret: "${DBREPO_CLIENT_SECRET}" client_id: "${CLIENT_ID}" - gateway.endpoint: https://gateway-service:9095 + gateway.endpoint: http://gateway-service:9095 elastic: endpoint: search-service:9200 username: elastic diff --git a/fda-ui/Dockerfile b/fda-ui/Dockerfile index 2c2cd8c402e018c2986ad4c6e92e84cf8f821f0b..048398eebaa2a7b2b4b887c685df515a1adbaae5 100644 --- a/fda-ui/Dockerfile +++ b/fda-ui/Dockerfile @@ -8,7 +8,7 @@ ARG TAG=1.2 ENV NODE_ENV=production ENV HOST=0.0.0.0 -ENV API=https://gateway-service:9095 +ENV API=http://gateway-service:9095 WORKDIR /app @@ -42,7 +42,6 @@ MAINTAINER Martin Weise <martin.weise@tuwien.ac.at> EXPOSE 3000 EXPOSE 9100 -ENV API=https://gateway-service:9095 ENV BROKER_USERNAME=fda ENV BROKER_PASSWORD=fda ENV SANDBOX=false diff --git a/fda-ui/components/query/Builder.vue b/fda-ui/components/query/Builder.vue index 311aac14f2dce772d544e29c11b558dab57e9e9e..e8a93314c10d5eb105559cafc666f834c31694cf 100644 --- a/fda-ui/components/query/Builder.vue +++ b/fda-ui/components/query/Builder.vue @@ -325,9 +325,10 @@ export default { this.resultId = res.data.id console.debug('view', res.data) await this.loadDatabase() - } catch (err) { - console.error('Failed to create view', err) - this.$toast.error(err.response.data.message) + } catch (error) { + console.error('Failed to create view', error) + const { statusText } = error.response + this.$toast.error(`Failed to create view: ${statusText}`) } this.loadingQuery = false await Promise.all([this.$refs.queryResults.reExecute(this.resultId), this.$refs.queryResults.reExecuteCount(this.resultId)]) diff --git a/fda-ui/pages/user/info.vue b/fda-ui/pages/user/info.vue index 986e1f0cd51827eefcabef55370d9871cdbe91ba..104c4216d1dca4a7728f8f966c0611b61005c932 100644 --- a/fda-ui/pages/user/info.vue +++ b/fda-ui/pages/user/info.vue @@ -99,7 +99,7 @@ <script> import UserToolbar from '@/components/UserToolbar' -import { tokenToRoles, updateUser, toggleUserTheme, getThemeDark } from '@/api/user' +import { tokenToRoles, updateUser, toggleUserTheme, getThemeDark, findUser } from '@/api/user' export default { components: { @@ -130,9 +130,7 @@ export default { return this.$store.state.user }, roles () { - const roles = tokenToRoles(this.token) - console.debug('roles', roles) - return roles + return tokenToRoles(this.token) }, config () { if (this.token === null) { @@ -187,6 +185,7 @@ export default { async toggleTheme () { try { await toggleUserTheme(this.token, this.user.id, this.theme_dark) + await this.loadUser() this.$vuetify.theme.dark = this.theme_dark } catch (error) { const { message } = error.response @@ -195,6 +194,33 @@ export default { this.error = true } }, + async loadUser () { + if (!this.token) { + return + } + try { + const res = await findUser(this.token) + const user = res.data + console.debug('user', user) + this.$store.commit('SET_USER', user) + const roles = tokenToRoles(this.token) + this.$store.commit('SET_ROLES', roles) + this.$vuetify.theme.dark = getThemeDark(user) + this.loading = false + } catch (error) { + console.error('Failed to load user', error) + const { status } = error.response + if (status === 401) { + console.error('Token expired', error) + this.$toast.warning('Login has expired') + this.logout() + } else { + console.error('user data', error) + this.$toast.error('Failed to load user') + this.error = true + } + } + }, init () { if (!this.user) { return diff --git a/fda-user-service/rest-service/src/main/resources/application-local.yml b/fda-user-service/rest-service/src/main/resources/application-local.yml index 77662670bf1b7cc3924dfac97fb15801642794e1..7254853c6587abbdc9626ab11e2e43c3c56ab7b2 100644 --- a/fda-user-service/rest-service/src/main/resources/application-local.yml +++ b/fda-user-service/rest-service/src/main/resources/application-local.yml @@ -35,14 +35,14 @@ eureka: instance: hostname: user-service non-secure-port: 9098 - client.serviceUrl.defaultZone: http://discovery-service:9090/eureka/ + client.serviceUrl.defaultZone: http://localhost:9090/eureka/ fda: elastic: endpoint: localhost:9200 username: elastic password: elastic ready.path: ./ready - gateway.endpoint: http://gateway-service:9095 + gateway.endpoint: http://localhost:9095 default_role: default-researcher-roles jwt: issuer: https://localhost:8443/realms/dbrepo