diff --git a/webapp/locales/de.json b/webapp/locales/de.json index a28baa2f9..ca8cc71e4 100644 --- a/webapp/locales/de.json +++ b/webapp/locales/de.json @@ -1,4 +1,9 @@ { + "maintenance": { + "title": "Human Connection befindet sich in der Wartung", + "explanation": "Zurzeit führen wir einige geplante Wartungsarbeiten durch, bitte versuch es später erneut.", + "questions": "Bei Fragen oder Problemen erreichst du uns per E-Mail an" + }, "index": { "no-results": "Keine Beiträge gefunden.", "change-filter-settings": "Verändere die Filter-Einstellungen um mehr Ergebnisse zu erhalten." diff --git a/webapp/locales/en.json b/webapp/locales/en.json index e08f7bdad..1898f8c4d 100644 --- a/webapp/locales/en.json +++ b/webapp/locales/en.json @@ -1,4 +1,9 @@ { + "maintenance": { + "title": "Human Connection is under maintenance", + "explanation": "At the moment we are doing some scheduled maintenance, please try again later.", + "questions": "Any Questions or concerns, send an email to" + }, "index": { "no-results": "No contributions found.", "change-filter-settings": "Change your filter settings to get more results." diff --git a/webapp/maintenance/maintenance.vue b/webapp/maintenance/maintenance.vue new file mode 100644 index 000000000..771ff6610 --- /dev/null +++ b/webapp/maintenance/maintenance.vue @@ -0,0 +1,55 @@ + + + diff --git a/webapp/middleware/maintenance.js b/webapp/middleware/maintenance.js new file mode 100644 index 000000000..087dedf93 --- /dev/null +++ b/webapp/middleware/maintenance.js @@ -0,0 +1,4 @@ + +export default async ({ redirect }) => { + return redirect('/maintenance') +} diff --git a/webapp/nuxt.config.js b/webapp/nuxt.config.js index f4287da1c..cb7b64a82 100644 --- a/webapp/nuxt.config.js +++ b/webapp/nuxt.config.js @@ -1,5 +1,6 @@ +import path from 'path' const pkg = require('./package') -const envWhitelist = ['NODE_ENV', 'MAINTENANCE', 'MAPBOX_TOKEN'] +export const envWhitelist = ['NODE_ENV', 'MAPBOX_TOKEN'] const dev = process.env.NODE_ENV !== 'production' const styleguidePath = '../Nitro-Styleguide' @@ -15,7 +16,7 @@ const buildDir = process.env.NUXT_BUILD || '.nuxt' const additionalSentryConfig = {} if (process.env.COMMIT) additionalSentryConfig.release = process.env.COMMIT -module.exports = { +export default { buildDir, mode: 'universal', @@ -310,7 +311,6 @@ module.exports = { */ extend(config, ctx) { if (process.env.STYLEGUIDE_DEV) { - const path = require('path') config.resolve.alias['@@'] = path.resolve(__dirname, `${styleguidePath}/src/system`) config.module.rules.push({ resourceQuery: /blockType=docs/, diff --git a/webapp/nuxt.config.maintenance.js b/webapp/nuxt.config.maintenance.js new file mode 100644 index 000000000..280a22d75 --- /dev/null +++ b/webapp/nuxt.config.maintenance.js @@ -0,0 +1,70 @@ +import defaultNuxtConfig, { envWhitelist } from './nuxt.config.js' + +export default { + ...defaultNuxtConfig, + head: { + title: 'Human Connection', + meta: [ + { + charset: 'utf-8', + }, + { + name: 'viewport', + content: 'width=device-width, initial-scale=1', + }, + { + hid: 'description', + name: 'description', + content: 'Maintenance page for Human Connection' + }, + ], + link: [ + { + rel: 'icon', + type: 'image/x-icon', + href: '/favicon.ico', + }, + ], + }, + env: { + ...defaultNuxtConfig.env, + maintenance: true, + }, + + /* + ** Plugins to load before mounting the App + */ + plugins: [ + { src: `~/plugins/styleguide.js`, ssr: true }, + { src: '~/plugins/i18n.js', ssr: true }, + { src: '~/plugins/v-tooltip.js', ssr: false }, + ], + + + /* + ** Nuxt.js modules + */ + modules: [ + [ + 'nuxt-env', + { + keys: envWhitelist, + }, + ], + 'cookie-universal-nuxt', + '@nuxtjs/style-resources', + '@nuxtjs/sentry', + ], + + + router: { + middleware: ['maintenance'], + extendRoutes (routes, resolve) { + routes.push({ + name: 'maintenance', + path: '*', + component: resolve(__dirname, 'maintenance/maintenance.vue'), + }) + } + }, +} diff --git a/webapp/package.json b/webapp/package.json index a5db37e72..b0a09d817 100644 --- a/webapp/package.json +++ b/webapp/package.json @@ -15,6 +15,7 @@ "storybook": "start-storybook -p 3002 -c storybook/", "build": "nuxt build", "start": "nuxt start", + "generate:maintenance": "nuxt generate -c nuxt.config.maintenance.js", "generate": "nuxt generate", "lint": "eslint --ext .js,.vue .", "precommit": "yarn lint", diff --git a/webapp/store/auth.js b/webapp/store/auth.js index 498477660..6d1b1078b 100644 --- a/webapp/store/auth.js +++ b/webapp/store/auth.js @@ -53,6 +53,7 @@ export const actions = { if (!process.server) { return } + if (this.app.$env.maintenance) return const token = this.app.$apolloHelpers.getToken() if (!token) { return