Skip to content
Snippets Groups Projects
Commit 794f2192 authored by Martin Weise's avatar Martin Weise
Browse files

connected the frontend with the gateway and discovery service

Former-commit-id: 32a3218c
parent 4d3502bc
No related branches found
No related tags found
1 merge request!42Fixed the query service tests
Showing
with 41 additions and 30 deletions
...@@ -22,5 +22,5 @@ logging: ...@@ -22,5 +22,5 @@ logging:
root: warn root: warn
at.tuwien.: debug at.tuwien.: debug
eureka: eureka:
instance.hostname: fda-discovery-service instance.hostname: fda-container-service
client.serviceUrl.defaultZone: http://fda-discovery-service:9090/eureka/ client.serviceUrl.defaultZone: http://fda-discovery-service:9090/eureka/
\ No newline at end of file
...@@ -22,5 +22,5 @@ logging: ...@@ -22,5 +22,5 @@ logging:
root: warn root: warn
at.tuwien.: debug at.tuwien.: debug
eureka: eureka:
instance.hostname: fda-discovery-service instance.hostname: fda-database-service
client.serviceUrl.defaultZone: http://fda-discovery-service:9090/eureka/ client.serviceUrl.defaultZone: http://fda-discovery-service:9090/eureka/
\ No newline at end of file
...@@ -21,16 +21,21 @@ public class GatewayConfig { ...@@ -21,16 +21,21 @@ public class GatewayConfig {
.method("POST","GET","PUT","DELETE") .method("POST","GET","PUT","DELETE")
.and() .and()
.uri("lb://fda-container-service")) .uri("lb://fda-container-service"))
.route("fda-database-service", r -> r.path("/api/database/**") .route("fda-query-service", r -> r.path("/api/database/**/query/**")
.and() .and()
.method("POST","GET","PUT","DELETE") .method("POST","GET","PUT","DELETE")
.and() .and()
.uri("lb://fda-database-service")) .uri("lb://fda-query-service"))
.route("fda-table-service", r -> r.path("/api/database/**/table/**") .route("fda-table-service", r -> r.path("/api/database/**/table/**")
.and() .and()
.method("POST","GET","PUT","DELETE") .method("POST","GET","PUT","DELETE")
.and() .and()
.uri("lb://fda-table-service")) .uri("lb://fda-table-service"))
.route("fda-database-service", r -> r.path("/api/database/**")
.and()
.method("POST","GET","PUT","DELETE")
.and()
.uri("lb://fda-database-service"))
.build(); .build();
} }
......
package at.tuwien.gatewayservice.config; package at.tuwien.gatewayservice.config;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.web.reactive.config.CorsRegistry; import org.springframework.web.reactive.config.CorsRegistry;
import org.springframework.web.reactive.config.WebFluxConfigurer; import org.springframework.web.reactive.config.WebFluxConfigurer;
import org.springframework.web.reactive.function.client.WebClient;
@Configuration @Configuration
public class WebConfig implements WebFluxConfigurer { public class WebConfig implements WebFluxConfigurer {
...@@ -13,4 +16,11 @@ public class WebConfig implements WebFluxConfigurer { ...@@ -13,4 +16,11 @@ public class WebConfig implements WebFluxConfigurer {
.allowedMethods("POST", "GET", "PUT", "DELETE") .allowedMethods("POST", "GET", "PUT", "DELETE")
.allowedOrigins("*"); .allowedOrigins("*");
} }
@Bean
@LoadBalanced
public WebClient.Builder loadBalancedWebClientBuilder() {
return WebClient.builder();
}
} }
...@@ -22,5 +22,5 @@ logging: ...@@ -22,5 +22,5 @@ logging:
root: warn root: warn
at.tuwien.: debug at.tuwien.: debug
eureka: eureka:
instance.hostname: fda-discovery-service instance.hostname: fda-query-service
client.serviceUrl.defaultZone: http://fda-discovery-service:9090/eureka/ client.serviceUrl.defaultZone: http://fda-discovery-service:9090/eureka/
\ No newline at end of file
...@@ -20,7 +20,7 @@ logging: ...@@ -20,7 +20,7 @@ logging:
root: warn root: warn
at.tuwien.: debug at.tuwien.: debug
eureka: eureka:
instance.hostname: fda-discovery-service instance.hostname: fda-table-service
client.serviceUrl.defaultZone: http://fda-discovery-service:9090/eureka/ client.serviceUrl.defaultZone: http://fda-discovery-service:9090/eureka/
fda: fda:
mapping.path: /root mapping.path: /root
......
# DB Service API url # DB Service API url
API_CONTAINER="http://localhost:9091" # GATEWAY SERVICE
API_IMAGE="http://localhost:9091" API="http://localhost:9095"
API_DATABASE="http://localhost:9092"
API_TABLES="http://localhost:9094"
API_ANALYSE="http://localhost:5000"
# DB Service API url
# GATEWAY SERVICE
API="http://fda-gateway-service:9095"
...@@ -17,7 +17,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ ...@@ -17,7 +17,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
libxtst6 libxtst6
# Our app # Our app
COPY ./.env ./ COPY ./.env-docker ./.env
COPY ./assets ./assets COPY ./assets ./assets
COPY ./ava.config.cjs ./ COPY ./ava.config.cjs ./
COPY ./babel.config.js ./ COPY ./babel.config.js ./
......
...@@ -104,7 +104,7 @@ export default { ...@@ -104,7 +104,7 @@ export default {
if (typeof this.panelIndex !== 'undefined') { if (typeof this.panelIndex !== 'undefined') {
const tableId = this.tables[this.panelIndex].id const tableId = this.tables[this.panelIndex].id
try { try {
const res = await this.$axios.get(`http://localhost:9094/api/database/${this.$route.params.database_id}/table/${tableId}`) const res = await this.$axios.get(`/api/database/${this.$route.params.database_id}/table/${tableId}`)
this.tableDetails = res.data this.tableDetails = res.data
} catch (err) { } catch (err) {
this.$toast.error('Could not get table details.') this.$toast.error('Could not get table details.')
...@@ -124,7 +124,7 @@ export default { ...@@ -124,7 +124,7 @@ export default {
let res let res
try { try {
res = await this.$axios.get( res = await this.$axios.get(
`http://localhost:9094/api/database/${this.$route.params.database_id}/table`) `/api/database/${this.$route.params.database_id}/table`)
this.tables = res.data this.tables = res.data
} catch (err) { } catch (err) {
this.$toast.error('Could not list table.') this.$toast.error('Could not list table.')
...@@ -133,7 +133,7 @@ export default { ...@@ -133,7 +133,7 @@ export default {
async deleteTable () { async deleteTable () {
try { try {
await this.$axios.delete( await this.$axios.delete(
`http://localhost:9094/api/database/${this.$route.params.database_id}/table/${this.deleteTableId}`) `/api/database/${this.$route.params.database_id}/table/${this.deleteTableId}`)
this.refresh() this.refresh()
} catch (err) { } catch (err) {
this.$toast.error('Could not delete table.') this.$toast.error('Could not delete table.')
......
...@@ -73,7 +73,7 @@ export default { ...@@ -73,7 +73,7 @@ export default {
// XXX same as in TableList // XXX same as in TableList
try { try {
const res = await this.$axios.get( const res = await this.$axios.get(
`http://localhost:9094/api/database/${this.$route.params.database_id}/table`) `/api/database/${this.$route.params.database_id}/table`)
this.tables = res.data this.tables = res.data
} catch (err) { } catch (err) {
this.$toast.error('Could not list table.') this.$toast.error('Could not list table.')
...@@ -102,7 +102,7 @@ export default { ...@@ -102,7 +102,7 @@ export default {
async loadColumns () { async loadColumns () {
const tableId = this.table.id const tableId = this.table.id
try { try {
const res = await this.$axios.get(`http://localhost:9094/api/database/${this.$route.params.database_id}/table/${tableId}`) const res = await this.$axios.get(`/api/database/${this.$route.params.database_id}/table/${tableId}`)
this.tableDetails = res.data this.tableDetails = res.data
this.buildQuery() this.buildQuery()
} catch (err) { } catch (err) {
......
...@@ -4,7 +4,7 @@ import colors from 'vuetify/es5/util/colors' ...@@ -4,7 +4,7 @@ import colors from 'vuetify/es5/util/colors'
// pick env vars from .env file or get them passed through docker-compose // pick env vars from .env file or get them passed through docker-compose
require('dotenv').config() require('dotenv').config()
if (!process.env.API_CONTAINER) { if (!process.env.API) {
throw new Error(`Environment variable API_CONTAINER not defined. throw new Error(`Environment variable API_CONTAINER not defined.
Have you passed env vars from docker-compose or defined them in your .env file?`) Have you passed env vars from docker-compose or defined them in your .env file?`)
...@@ -64,11 +64,7 @@ export default { ...@@ -64,11 +64,7 @@ export default {
}, },
proxy: { proxy: {
'/api/container': process.env.API_CONTAINER, '/api': process.env.API
'/api/image': process.env.API_IMAGE,
'/api/database': process.env.API_DATABASE,
'/api/analyse': process.env.API_ANALYSE,
'/api/table': process.env.API_TABLES
}, },
serverMiddleware: [ serverMiddleware: [
......
...@@ -71,7 +71,7 @@ export default { ...@@ -71,7 +71,7 @@ export default {
this.loading = false this.loading = false
return return
} }
const insertUrl = `http://localhost:9094/api/database/${this.$route.params.database_id}/table/${this.$route.params.table_id}/data` const insertUrl = `/api/database/${this.$route.params.database_id}/table/${this.$route.params.table_id}/data`
let insertResult let insertResult
try { try {
insertResult = await this.$axios.post(insertUrl, this.tableInsert) insertResult = await this.$axios.post(insertUrl, this.tableInsert)
......
...@@ -48,7 +48,7 @@ export default { ...@@ -48,7 +48,7 @@ export default {
methods: { methods: {
async loadProperties () { async loadProperties () {
try { try {
const res = await this.$axios.get(`http://localhost:9094/api/database/${this.$route.params.database_id}/table/${this.$route.params.table_id}`) const res = await this.$axios.get(`/api/database/${this.$route.params.database_id}/table/${this.$route.params.table_id}`)
this.table = res.data this.table = res.data
console.debug('headers', res.data.columns) console.debug('headers', res.data.columns)
this.headers = res.data.columns.map((c) => { this.headers = res.data.columns.map((c) => {
...@@ -64,7 +64,7 @@ export default { ...@@ -64,7 +64,7 @@ export default {
}, },
async loadData () { async loadData () {
try { try {
const res = await this.$axios.get(`http://localhost:9094/api/database/${this.$route.params.database_id}/table/${this.$route.params.table_id}/data`) const res = await this.$axios.get(`/api/database/${this.$route.params.database_id}/table/${this.$route.params.table_id}/data`)
this.rows = res.data.result this.rows = res.data.result
console.debug('table data', res.data) console.debug('table data', res.data)
} catch (err) { } catch (err) {
......
...@@ -140,7 +140,7 @@ export default { ...@@ -140,7 +140,7 @@ export default {
columns: this.columns columns: this.columns
} }
try { try {
const res = await this.$axios.post(`http://localhost:9094/api/database/${this.$route.params.database_id}/table`, data) const res = await this.$axios.post(`/api/database/${this.$route.params.database_id}/table`, data)
if (res.status === 201) { if (res.status === 201) {
this.$toast.success('Table created.') this.$toast.success('Table created.')
this.$root.$emit('table-create', res.data) this.$root.$emit('table-create', res.data)
......
...@@ -117,7 +117,7 @@ ...@@ -117,7 +117,7 @@
<v-stepper-content step="4"> <v-stepper-content step="4">
Proceed to table view. Proceed to table view.
<div class="mt-2"> <div class="mt-2">
<v-btn :to="`/database/${$route.params.database_id}/tables/${newTableId}`" outlined> <v-btn :to="`/databases/${$route.params.database_id}/tables/${newTableId}`" outlined>
<v-icon>mdi-table</v-icon> <v-icon>mdi-table</v-icon>
View View
</v-btn> </v-btn>
...@@ -208,7 +208,7 @@ export default { ...@@ -208,7 +208,7 @@ export default {
column.enumValues = column.enumValues.split(',') column.enumValues = column.enumValues.split(',')
} }
}) })
const createUrl = `http://localhost:9094/api/database/${this.$route.params.database_id}/table` const createUrl = `/api/database/${this.$route.params.database_id}/table`
let createResult let createResult
try { try {
createResult = await this.$axios.post(createUrl, this.tableCreate) createResult = await this.$axios.post(createUrl, this.tableCreate)
...@@ -218,7 +218,7 @@ export default { ...@@ -218,7 +218,7 @@ export default {
console.log(err) console.log(err)
return return
} }
const insertUrl = `http://localhost:9094/api/database/${this.$route.params.database_id}/table/${createResult.data.id}/data` const insertUrl = `/api/database/${this.$route.params.database_id}/table/${createResult.data.id}/data`
let insertResult let insertResult
try { try {
insertResult = await this.$axios.post(insertUrl, this.tableInsert) insertResult = await this.$axios.post(insertUrl, this.tableInsert)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment