Merge branch 'monterail_vue3_migration_admin_update' into user-page-apollo-toast-packages

This commit is contained in:
Kamila 2024-07-12 15:41:14 +02:00
commit b0b44b49d5
12 changed files with 409 additions and 3696 deletions

View File

@ -25,7 +25,7 @@ module.exports = {
// add your custom rules here
rules: {
'no-console': ['error'],
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
'no-debugger': import.meta.env.NODE_ENV === 'production' ? 'error' : 'off',
'vue/component-name-in-template-casing': ['error', 'kebab-case'],
'vue/no-static-inline-styles': [
'error',

View File

@ -4,7 +4,7 @@ module.exports = function (api) {
const presets = ['@babel/preset-env']
const plugins = []
if (process.env.NODE_ENV === 'test') {
if (import.meta.env.NODE_ENV === 'test') {
plugins.push('transform-require-context')
}

21
admin/index.html Normal file
View File

@ -0,0 +1,21 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<link rel="icon" type="image/png" sizes="96x96" href="/favicon.png">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<title>Gradido Admin Interface</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<!-- Fonts -->
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.3/css/all.css" integrity="sha384-UHRtZLI+pbxtHCWp1t77Bi1L4ZtiqrqD80Kn4Z8NTSRyMA2Fd33n5dQ8lWUE00s/" crossorigin="anonymous">
</head>
<body>
<div class="wrapper" id="app"></div>
<script type="module" src="/src/main.js"></script>
<!-- built files will be auto injected -->
</body>
</html>

View File

@ -8,11 +8,10 @@
"private": false,
"scripts": {
"start": "node run/server.js",
"serve": "vue-cli-service serve --open",
"build": "vue-cli-service build",
"dev": "vite",
"build": "vite build",
"serve": "vite preview",
"postbuild": "find build -type f -regex '.*\\.\\(html\\|js\\|css\\|svg\\|json\\)' -exec gzip -9 -k {} +",
"dev": "yarn run serve",
"analyse-bundle": "yarn build && webpack-bundle-analyzer build/webpack.stats.json",
"lint": "eslint --max-warnings=0 --ext .js,.vue,.json .",
"stylelint": "stylelint --max-warnings=0 '**/*.{scss,vue}'",
"test": "cross-env TZ=UTC jest",
@ -23,6 +22,7 @@
"@babel/core": "^7.15.8",
"@babel/node": "^7.15.8",
"@babel/preset-env": "^7.15.8",
"@vitejs/plugin-vue": "3.2.0",
"@vue/apollo-option": "^4.0.0",
"@vue/cli-plugin-unit-jest": "~5.0.8",
"@vue/compat": "3.4.31",
@ -36,19 +36,20 @@
"babel-preset-vue": "^2.0.2",
"bootstrap": "^5.3.3",
"bootstrap-vue-next": "^0.23.2",
"core-js": "^3.6.5",
"date-fns": "^2.29.3",
"dotenv-webpack": "^7.0.3",
"express": "^4.17.1",
"graphql": "^15.6.1",
"graphql": "^16.9.0",
"graphql-tag": "^2.12.6",
"identity-obj-proxy": "^3.0.0",
"jest": "26.6.3",
"jest-canvas-mock": "^2.3.1",
"jest-environment-jsdom-sixteen": "^2.0.0",
"portal-vue": "3.0.0",
"qrcanvas-vue": "2.1.1",
"qrcanvas-vue": "3.0.0",
"regenerator-runtime": "^0.13.9",
"stats-webpack-plugin": "^0.7.0",
"vite": "3.2.10",
"vite-plugin-commonjs": "^0.10.1",
"vue": "3.4.31",
"vue-apollo": "3.1.2",
"vue-i18n": "9.13.1",
@ -61,11 +62,7 @@
"@apollo/client": "^3.10.8",
"@babel/eslint-parser": "^7.15.8",
"@intlify/eslint-plugin-vue-i18n": "^1.4.0",
"@vue/cli-plugin-babel": "~5.0.8",
"@vue/cli-plugin-eslint": "~5.0.8",
"@vue/cli-service": "~5.0.8",
"@vue/compiler-sfc": "3.4.31",
"babel-eslint": "^10.1.0",
"babel-plugin-transform-require-context": "^0.1.1",
"cross-env": "^7.0.3",
"eslint": "7.25.0",
@ -78,7 +75,7 @@
"eslint-plugin-prettier": "3.3.1",
"eslint-plugin-promise": "^5.1.1",
"eslint-plugin-vue": "^7.20.0",
"jest": "^27.1.0",
"jest": "29.7.0",
"mock-apollo-client": "^1.2.1",
"postcss": "^8.4.8",
"postcss-html": "^1.3.0",
@ -86,8 +83,7 @@
"stylelint": "^14.5.3",
"stylelint-config-recommended-vue": "^1.3.0",
"stylelint-config-standard-scss": "^3.0.0",
"unplugin-vue-components": "^0.27.2",
"vue-cli-plugin-i18n": "~2.3.2"
"unplugin-vue-components": "^0.27.2"
},
"browserslist": [
"> 1%",

View File

@ -4,7 +4,7 @@ const path = require('path')
// Host & Port
const hostname = '127.0.0.1'
const port = process.env.PORT || 8080
const port = import.meta.env.PORT || 8080
// Express Server
const app = express()

View File

@ -15,7 +15,7 @@
<b>{{ $t('statistic.totalUsers') }}</b>
</BTd>
<BTd class="text-right">
{{ value.totalUsers }}
{{ modelValue.totalUsers }}
</BTd>
<BTd></BTd>
</BTr>
@ -24,7 +24,7 @@
<b>{{ $t('statistic.activeUsers') }}</b>
</BTd>
<BTd class="text-right">
{{ value.activeUsers }}
{{ modelValue.activeUsers }}
</BTd>
<BTd></BTd>
</BTr>
@ -33,7 +33,7 @@
<b>{{ $t('statistic.deletedUsers') }}</b>
</BTd>
<BTd class="text-right">
{{ value.deletedUsers }}
{{ modelValue.deletedUsers }}
</BTd>
<BTd></BTd>
</BTr>
@ -42,11 +42,11 @@
<b>{{ $t('statistic.totalGradidoCreated') }}</b>
</BTd>
<BTd class="text-right">
<!-- {{ $n(value.totalGradidoCreated, 'decimal') }} {{ $t('GDD') }}-->
<!-- {{ $n(modelValue.totalGradidoCreated, 'decimal') }} {{ $t('GDD') }}-->
4500
</BTd>
<BTd class="text-right">
{{ value.totalGradidoCreated }}
{{ modelValue.totalGradidoCreated }}
</BTd>
</BTr>
<BTr>
@ -54,21 +54,21 @@
<b>{{ $t('statistic.totalGradidoDecayed') }}</b>
</BTd>
<BTd class="text-right">
<!-- {{ $n(value.totalGradidoDecayed, 'decimal') }} {{ $t('GDD') }}-->
<!-- {{ $n(modelValue.totalGradidoDecayed, 'decimal') }} {{ $t('GDD') }}-->
100
</BTd>
<BTd class="text-right">{{ value.totalGradidoDecayed }}</BTd>
<BTd class="text-right">{{ modelValue.totalGradidoDecayed }}</BTd>
</BTr>
<BTr>
<BTd>
<b>{{ $t('statistic.totalGradidoAvailable') }}</b>
</BTd>
<BTd class="text-right">
<!-- {{ $n(value.totalGradidoAvailable, 'decimal') }} {{ $t('GDD') }}-->
<!-- {{ $n(modelValue.totalGradidoAvailable, 'decimal') }} {{ $t('GDD') }}-->
500
</BTd>
<BTd class="text-right">
{{ value.totalGradidoAvailable }}
{{ modelValue.totalGradidoAvailable }}
</BTd>
</BTr>
<BTr>
@ -76,11 +76,11 @@
<b>{{ $t('statistic.totalGradidoUnbookedDecayed') }}</b>
</BTd>
<BTd class="text-right">
<!-- {{ $n(value.totalGradidoUnbookedDecayed, 'decimal') }} {{ $t('GDD') }}-->
<!-- {{ $n(modelValue.totalGradidoUnbookedDecayed, 'decimal') }} {{ $t('GDD') }}-->
600
</BTd>
<BTd class="text-right">
{{ value.totalGradidoUnbookedDecayed }}
{{ modelValue.totalGradidoUnbookedDecayed }}
</BTd>
</BTr>
</BTbody>
@ -92,7 +92,7 @@ import { defineProps } from 'vue'
import { BTableSimple, BThead, BTr, BTh, BTbody, BTd } from 'bootstrap-vue-next'
const props = defineProps({
value: {
modelValue: {
type: Object,
required: true,
},

View File

@ -14,38 +14,38 @@ const constants = {
const version = {
APP_VERSION: pkg.version,
BUILD_COMMIT: process.env.BUILD_COMMIT ?? null,
BUILD_COMMIT: import.meta.env.BUILD_COMMIT ?? null,
// self reference of `version.BUILD_COMMIT` is not possible at this point, hence the duplicate code
BUILD_COMMIT_SHORT: (process.env.BUILD_COMMIT ?? '0000000').slice(0, 7),
PORT: process.env.PORT ?? 8080,
BUILD_COMMIT_SHORT: (import.meta.env.BUILD_COMMIT ?? '0000000').slice(0, 7),
PORT: import.meta.env.PORT ?? 8080,
}
const environment = {
NODE_ENV: process.env.NODE_ENV,
DEBUG: process.env.NODE_ENV !== 'production' ?? false,
PRODUCTION: process.env.NODE_ENV === 'production' ?? false,
NODE_ENV: import.meta.env.NODE_ENV,
DEBUG: import.meta.env.NODE_ENV !== 'production' ?? false,
PRODUCTION: import.meta.env.NODE_ENV === 'production' ?? false,
}
const COMMUNITY_HOST = process.env.COMMUNITY_HOST ?? undefined
const URL_PROTOCOL = process.env.URL_PROTOCOL ?? 'http'
const COMMUNITY_HOST = import.meta.env.COMMUNITY_HOST ?? undefined
const URL_PROTOCOL = import.meta.env.URL_PROTOCOL ?? 'http'
const COMMUNITY_URL =
COMMUNITY_HOST && URL_PROTOCOL ? URL_PROTOCOL + '://' + COMMUNITY_HOST : undefined
const WALLET_URL = process.env.WALLET_URL ?? COMMUNITY_URL ?? 'http://localhost'
const WALLET_URL = import.meta.env.WALLET_URL ?? COMMUNITY_URL ?? 'http://localhost'
const endpoints = {
GRAPHQL_URL:
(process.env.GRAPHQL_URL ?? COMMUNITY_URL ?? 'http://localhost:4000') +
process.env.GRAPHQL_PATH ?? '/graphql',
WALLET_AUTH_URL: WALLET_URL + (process.env.WALLET_AUTH_PATH ?? '/authenticate?token={token}'),
WALLET_LOGIN_URL: WALLET_URL + (process.env.WALLET_LOGIN_PATH ?? '/login'),
(import.meta.env.GRAPHQL_URL ?? COMMUNITY_URL ?? 'http://localhost:4000') +
import.meta.env.GRAPHQL_PATH ?? '/graphql',
WALLET_AUTH_URL: WALLET_URL + (import.meta.env.WALLET_AUTH_PATH ?? '/authenticate?token={token}'),
WALLET_LOGIN_URL: WALLET_URL + (import.meta.env.WALLET_LOGIN_PATH ?? '/login'),
}
const debug = {
DEBUG_DISABLE_AUTH: process.env.DEBUG_DISABLE_AUTH === 'true' ?? false,
DEBUG_DISABLE_AUTH: import.meta.env.DEBUG_DISABLE_AUTH === 'true' ?? false,
}
// Check config version
constants.CONFIG_VERSION.CURRENT = process.env.CONFIG_VERSION ?? constants.CONFIG_VERSION.DEFAULT
constants.CONFIG_VERSION.CURRENT = import.meta.env.CONFIG_VERSION ?? constants.CONFIG_VERSION.DEFAULT
if (
![constants.CONFIG_VERSION.EXPECTED, constants.CONFIG_VERSION.DEFAULT].includes(
constants.CONFIG_VERSION.CURRENT,
@ -64,4 +64,4 @@ const CONFIG = {
...debug,
}
module.exports = CONFIG
export default CONFIG

View File

@ -1,17 +1,6 @@
import { createI18n } from 'vue-i18n'
const loadLocaleMessages = () => {
const locales = require.context('./locales/', true, /[A-Za-z0-9-_,\s]+\.json$/i)
const messages = {}
locales.keys().forEach((key) => {
const matched = key.match(/([A-Za-z0-9-_]+)\./i)
if (matched && matched.length > 1) {
const locale = matched[1]
messages[locale] = locales(key)
}
})
return messages
}
import de from "./locales/de.json"
import en from "./locales/en.json"
const numberFormats = {
en: {
@ -97,7 +86,7 @@ const i18n = createI18n({
locale: 'en',
legacy: false,
fallbackLocale: 'en',
messages: loadLocaleMessages(),
messages: { de, en },
numberFormats,
datetimeFormats,
})

View File

@ -11,7 +11,7 @@ import addNavigationGuards from './router/guards'
import i18n from './i18n'
import VueApollo from 'vue-apollo'
// import VueApollo from 'vue-apollo'
import PortalVue from 'portal-vue'
@ -33,7 +33,7 @@ app.use(i18n)
app.use(PortalVue)
app.use(createBootstrap())
app.use(VueApollo)
// app.use(VueApollo)
app.use(apolloProvider)
app.mixin(toasters)

20
admin/vite.config.js Normal file
View File

@ -0,0 +1,20 @@
import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
import commonjs from "vite-plugin-commonjs";
const path = require('path')
export default defineConfig({
base: '/admin/',
server: {
port: 8080
},
resolve: {
alias: {
'@': path.resolve(__dirname, './src'),
assets: path.join(__dirname, 'src/assets'),
},
extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json', '.vue'],
},
plugins: [vue(), commonjs()],
})

View File

@ -52,7 +52,7 @@ module.exports = {
// 'process.env.DOCKER_WORKDIR': JSON.stringify(process.env.DOCKER_WORKDIR),
// 'process.env.BUILD_DATE': JSON.stringify(process.env.BUILD_DATE),
// 'process.env.BUILD_VERSION': JSON.stringify(process.env.BUILD_VERSION),
'process.env.BUILD_COMMIT': JSON.stringify(CONFIG.BUILD_COMMIT),
'import.meta.env.BUILD_COMMIT': JSON.stringify(CONFIG.BUILD_COMMIT),
// 'process.env.PORT': JSON.stringify(process.env.PORT),
}),
// generate webpack stats to allow analysis of the bundlesize

File diff suppressed because it is too large Load Diff