Skip to content

Commit 5ceae6c

Browse files
authored
Nuxt3 migration continue (baserow#4578)
* fix nuxt.test.config for saas * add .nuxtrc * Enhance Nuxt configuration to ignore sourcemaps from node_modules * Add nuxt-prepare command to docker-entrypoint.sh for generating .nuxt directory * Refactor license.vue to use Composition API * Add korean language support * Add impersonate middleware to dashboard and workspace pages * Mount local backend/media folder in docker-compose for Caddy to serve uploaded files during development * Fix invitation related issues * Update email configuration for local development with Mailhog integration * Add moment-guess to optimizeDeps in Nuxt configuration to pre-bundle and avoid missing source map warnings * Refactor login components to use Composition API and improve routing structure for login pages * Update sidebar user context to conditionally display workspace creation option based on user permissions * Centralize locale definitions in a new config file * please linter
1 parent 4cfd24c commit 5ceae6c

File tree

30 files changed

+441
-375
lines changed

30 files changed

+441
-375
lines changed

.env.local-dev.example

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,11 @@ SYNC_TEMPLATES_ON_STARTUP=false
5151
MIGRATE_ON_STARTUP=false
5252

5353
# =============================================================================
54-
# Optional: Email (use console backend for local dev)
54+
# Email (mailhog via Docker - intercepts all emails)
5555
# =============================================================================
56-
# EMAIL_BACKEND=django.core.mail.backends.console.EmailBackend
56+
# Mailhog web UI: http://localhost:8025
57+
EMAIL_HOST=localhost
58+
EMAIL_PORT=1025
5759

5860
# =============================================================================
5961
# Optional: Celery

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ typings/
7070

7171
# nuxt.js build output
7272
.nuxt
73+
.nuxtrc
7374

7475
# Nuxt generate
7576
dist

backend/src/baserow/config/settings/dev.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,9 @@
5757

5858
CELERY_EMAIL_BACKEND = "django.core.mail.backends.smtp.EmailBackend"
5959
EMAIL_USE_TLS = False
60-
EMAIL_HOST = "mailhog"
61-
EMAIL_PORT = 1025
60+
# Use localhost for local dev (just dev up), mailhog for docker dev (just dc-dev up)
61+
EMAIL_HOST = os.getenv("EMAIL_HOST", "mailhog")
62+
EMAIL_PORT = int(os.getenv("EMAIL_PORT", "1025"))
6263

6364
BASEROW_MAX_ROW_REPORT_ERROR_COUNT = 10 # To trigger this exception easily
6465

docker-compose.dev.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ services:
2020
caddy:
2121
volumes:
2222
- $PWD/Caddyfile.dev:/etc/caddy/Caddyfile
23+
# For local development, mount the local backend/media folder so Caddy can
24+
# serve files uploaded by the native backend process.
25+
- $PWD/backend/media:/baserow/media
2326

2427
backend:
2528
image: baserow_backend:dev
@@ -192,6 +195,7 @@ services:
192195
logging:
193196
driver: "none" # disable saving logs
194197
ports:
198+
- "${HOST_PUBLISH_IP:-127.0.0.1}:1025:1025" # smtp
195199
- "8025:8025" # web ui
196200
networks:
197201
local:

enterprise/web-frontend/modules/baserow_enterprise/module.js

Lines changed: 10 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,7 @@ import {
66
extendPages,
77
} from 'nuxt/kit'
88
import { routes, rootChildRoutes } from './routes'
9-
10-
import en from './locales/en.json'
11-
import fr from './locales/fr.json'
12-
import nl from './locales/nl.json'
13-
import de from './locales/de.json'
14-
import es from './locales/es.json'
15-
import it from './locales/it.json'
16-
import pl from './locales/pl.json'
17-
import ko from './locales/ko.json'
18-
19-
const locales = [
20-
{ code: 'en', name: 'English', file: 'en.json' },
21-
{ code: 'fr', name: 'Français', file: 'fr.json' },
22-
{ code: 'nl', name: 'Nederlands', file: 'nl.json' },
23-
{ code: 'de', name: 'Deutsch', file: 'de.json' },
24-
{ code: 'es', name: 'Español', file: 'es.json' },
25-
{ code: 'it', name: 'Italiano', file: 'it.json' },
26-
{ code: 'pl', name: 'Polski (Beta)', file: 'pl.json' },
27-
]
9+
import { locales } from '../../../../web-frontend/config/locales.js'
2810

2911
export default defineNuxtModule({
3012
meta: {
@@ -65,8 +47,15 @@ export default defineNuxtModule({
6547
}
6648
})
6749

68-
// Add top-level routes (login pages, etc.)
69-
pages.push(...routes)
50+
// Add login pages as children of login-pages (inherit login layout)
51+
const loginPagesRoute = pages.find((route) => route.name === 'login-pages')
52+
if (loginPagesRoute) {
53+
routes.forEach((route) => {
54+
if (!loginPagesRoute.children.find(({ name }) => name === route.name)) {
55+
loginPagesRoute.children.push(route)
56+
}
57+
})
58+
}
7059
})
7160

7261
nuxt.hook('i18n:registerModule', (register) => {

enterprise/web-frontend/modules/baserow_enterprise/pages/login/loginError.vue

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -26,24 +26,30 @@
2626
</div>
2727
</template>
2828

29-
<script>
30-
export default {
29+
<script setup>
30+
import { computed } from 'vue'
31+
import { useRoute } from 'vue-router'
32+
import { useI18n } from 'vue-i18n'
33+
34+
definePageMeta({
3135
layout: 'login',
32-
asyncData({ route, i18n }) {
33-
const { error } = route.query
34-
const errorMessageI18nKey = `loginError.${error}`
35-
let errorMessage = i18n.t('loginError.defaultErrorMessage')
36-
if (i18n.te(errorMessageI18nKey)) {
37-
errorMessage = i18n.t(`loginError.${error}`)
38-
}
39-
return {
40-
errorMessage,
41-
}
42-
},
43-
head() {
44-
return {
45-
title: this.$t('loginError.title'),
46-
}
47-
},
48-
}
36+
})
37+
38+
const route = useRoute()
39+
const { t, te } = useI18n()
40+
41+
// Compute error message based on query param
42+
const errorMessage = computed(() => {
43+
const { error } = route.query
44+
const errorMessageI18nKey = `loginError.${error}`
45+
if (te(errorMessageI18nKey)) {
46+
return t(errorMessageI18nKey)
47+
}
48+
return t('loginError.defaultErrorMessage')
49+
})
50+
51+
// Head
52+
useHead({
53+
title: t('loginError.title'),
54+
})
4955
</script>

0 commit comments

Comments
 (0)