diff --git a/dbrepo-auth-service/listeners/target/create-event-listener.jar b/dbrepo-auth-service/listeners/target/create-event-listener.jar index 76b1ad02357c308cc312c99ea8bf0e3c3b2e8b62..26cb91c37666c966f6382d35feaaf9f5da5c7f8c 100644 Binary files a/dbrepo-auth-service/listeners/target/create-event-listener.jar and b/dbrepo-auth-service/listeners/target/create-event-listener.jar differ diff --git a/dbrepo-ui/components/TimeDrift.vue b/dbrepo-ui/components/TimeDrift.vue deleted file mode 100644 index 2f2555f9f84f107dff1ffd12ad75533d388c1f62..0000000000000000000000000000000000000000 --- a/dbrepo-ui/components/TimeDrift.vue +++ /dev/null @@ -1,44 +0,0 @@ -<template> - <v-alert - v-cloak - v-if="timestamp && offSeconds > 3" - class="banner" - border="start" - type="warning"> - {{ $t('error.data.drift') + ' ' + offSeconds + 's' }} - </v-alert> -</template> - -<script> -import { formatTimestamp, timestampsToHumanDifference } from '@/utils' - -export default { - data () { - return { - timestamp: null - } - }, - computed: { - drift () { - return this.timestampsToHumanDifference(Date.now(), this.timestamp) - }, - offSeconds () { - if (!this.timestamp) { - return null - } - return (Date.now().valueOf() - Date.parse(this.timestamp)) / 1000 - } - }, - mounted() { - const databaseService = useDatabaseService() - databaseService.getServerTime() - .then((timestamp) => { - this.timestamp = timestamp - }) - }, - methods: { - formatTimestamp, - timestampsToHumanDifference - } -} -</script> diff --git a/dbrepo-ui/components/subset/Builder.vue b/dbrepo-ui/components/subset/Builder.vue index f19c595aadd95c5a4e3a9c550e1f166dce3e76ac..f670700f2f23aa2a08a6ecf8004fecfb899c6c00 100644 --- a/dbrepo-ui/components/subset/Builder.vue +++ b/dbrepo-ui/components/subset/Builder.vue @@ -31,14 +31,12 @@ :text="$t('pages.subset.subpages.create.expert.text')" /> </v-tabs> </v-toolbar> - <TimeDrift /> <v-card rounded="0" variant="flat"> <v-card-text> <v-form ref="form" - v-model="valid" @submit.prevent> <v-row v-if="isView" @@ -304,7 +302,6 @@ </template> <script> -import TimeDrift from '@/components/TimeDrift.vue' import Raw from '@/components/subset/Raw.vue' import Results from '@/components/subset/Results.vue' import { useCacheStore } from '@/stores/cache.js' @@ -314,7 +311,6 @@ export default { components: { Raw, Results, - TimeDrift }, props: { mode: { @@ -468,7 +464,7 @@ export default { if (!this.table) { return } - this.fetchTableColumns(this.table.id) + this.fetchTableColumns(this.table?.id) } }, mounted () { @@ -545,13 +541,24 @@ export default { this.view.query = this.sql const viewService = useViewService() viewService.create(this.$route.params.database_id, this.view) - .then(async (view) => { - this.resultId = view.id - this.cacheStore.reloadDatabase() - const toast = useToastInstance() - toast.success(this.$t('success.view.create')) - await this.$router.push(`/database/${this.$route.params.database_id}/view/${view.id}/data`) - this.loadingQuery = false + .then((simpleView) => { + this.resultId = simpleView.id + viewService.findOne(this.$route.params.database_id, simpleView.id) + .then(async (view) => { + this.cacheStore.setView(view) + const toast = useToastInstance() + toast.success(this.$t('success.view.create')) + await this.$router.push(`/database/${this.$route.params.database_id}/view/${view.id}/data`) + this.loadingQuery = false + }) + .catch(({code}) => { + this.loadingQuery = false + const toast = useToastInstance() + if (typeof code !== 'string') { + return + } + toast.error(this.$t(code)) + }) }) .catch(({code}) => { this.loadingQuery = false diff --git a/dbrepo-ui/components/subset/Results.vue b/dbrepo-ui/components/subset/Results.vue index 3948667518939fc6ae4d1a5d05502a81e3e14315..661c7d1a3d6e7502cf349a63cc695cf7d593f427 100644 --- a/dbrepo-ui/components/subset/Results.vue +++ b/dbrepo-ui/components/subset/Results.vue @@ -80,23 +80,6 @@ export default { } }, methods: { - executeFirstTime (parent, sql, timestamp) { - this.loading++ - const payload = { - statement: sql, - timestamp - } - const queryService = useQueryService() - queryService.execute(this.$route.params.database_id, payload, this.options.page - 1, this.options.itemsPerPage) - .then((result) => { - this.mapResults(result) - parent.resultId = result.id - this.id = result.id - }) - .finally(() => { - this.loading-- - }) - }, reExecute (id) { if (id === null) { return diff --git a/dbrepo-ui/composables/database-service.ts b/dbrepo-ui/composables/database-service.ts index 7956f7b4dff6cb748733fd381275dd6d0622b60c..f318e073054d6a4283b654bbae985b4f903aec00 100644 --- a/dbrepo-ui/composables/database-service.ts +++ b/dbrepo-ui/composables/database-service.ts @@ -66,23 +66,6 @@ export const useDatabaseService = (): any => { }); } - async function getServerTime(): Promise<Date> { - const axios = useAxiosInstance(); - console.debug('find server time'); - return new Promise<Date>((resolve, reject) => { - axios.head<Date>('/api/database') - .then((response) => { - const date: Date = new Date(response.headers['Date']) - console.info(`Found ${date} server time`); - resolve(date); - }) - .catch((error) => { - console.error('Failed to find server time', error); - reject(axiosErrorToApiError(error)); - }); - }); - } - async function findOne(id: number, rawError: boolean = false): Promise<DatabaseDto | null> { const axios = useAxiosInstance(); console.debug('find database with id', id); @@ -239,16 +222,12 @@ export const useDatabaseService = (): any => { refreshTablesMetadata, refreshViewsMetadata, findOne, - findPreviewImage, - findCount, - getServerTime, updateVisibility, updateImage, updateOwner, create, databaseToOwner, databaseToContact, - databaseToJsonLd, isOwner } } diff --git a/dbrepo-ui/composables/query-service.ts b/dbrepo-ui/composables/query-service.ts index 119915de2785763d549bdf3bf2d97379811f8fed..e314993ecd233c486198f7995dff4da5389eb06f 100644 --- a/dbrepo-ui/composables/query-service.ts +++ b/dbrepo-ui/composables/query-service.ts @@ -161,12 +161,12 @@ export const useQueryService = (): any => { } } sql += ` \`${clause.params[0]}\` ${clause.params[1]} ` - const filteredType = types.filter(t => t.value === filteredColumn[0].column_type) + const filteredType = types.filter(t => t.value === filteredColumn[0].type) if (filteredType.length === 0) { return { error: true, reason: 'exists', - column: filteredColumn[0].column_type, + column: filteredColumn[0].type, raw: null, formatted: null } @@ -175,7 +175,7 @@ export const useQueryService = (): any => { return { error: true, reason: 'build', - column: filteredColumn[0].column_type, + column: filteredColumn[0].type, raw: null, formatted: null } diff --git a/dbrepo-ui/nuxt.config.ts b/dbrepo-ui/nuxt.config.ts index 31e20b310db06a04f07e2320060419c4ad3e87d4..b3da7bd98c657513e85c64cd51fac4c118d433b7 100644 --- a/dbrepo-ui/nuxt.config.ts +++ b/dbrepo-ui/nuxt.config.ts @@ -16,6 +16,12 @@ if (process.env.NODE_ENV === 'development') { } process.env.VERSION = 'bun-dev' process.env.NUXT_PUBLIC_API_SERVER = api + process.env.NUXT_OIDC_PROVIDERS_KEYCLOAK_AUTHORIZATION_URL = api + '/realms/dbrepo/protocol/openid-connect/auth' + process.env.NUXT_OIDC_PROVIDERS_KEYCLOAK_LOGOUT_REDIRECT_URI = api + ':3001' + process.env.NUXT_OIDC_PROVIDERS_KEYCLOAK_LOGOUT_URL = api + '/realms/dbrepo/protocol/openid-connect/logout' + process.env.NUXT_OIDC_PROVIDERS_KEYCLOAK_REDIRECT_URI = api + ':3001/auth/keycloak/callback' + process.env.NUXT_OIDC_PROVIDERS_KEYCLOAK_TOKEN_URL = api + '/realms/dbrepo/protocol/openid-connect/token' + process.env.NUXT_OIDC_PROVIDERS_KEYCLOAK_USER_INFO_URL = api + '/realms/dbrepo/protocol/openid-connect/userinfo' } /** diff --git a/dbrepo-ui/pages/database/[database_id]/view/[view_id]/data.vue b/dbrepo-ui/pages/database/[database_id]/view/[view_id]/data.vue index 2b0936cba506ce7ddf2170feaf186e81ed965c16..f732661f369710b4637f01952f5fab930e9e4812 100644 --- a/dbrepo-ui/pages/database/[database_id]/view/[view_id]/data.vue +++ b/dbrepo-ui/pages/database/[database_id]/view/[view_id]/data.vue @@ -22,7 +22,6 @@ :loading="loadingData" @click="reload" /> </v-toolbar> - <TimeDrift /> <v-card tile> <QueryResults id="query-results" @@ -35,13 +34,11 @@ </template> <script> -import TimeDrift from '@/components/TimeDrift.vue' import QueryResults from '@/components/subset/Results.vue' export default { components: { - QueryResults, - TimeDrift + QueryResults }, data () { return {