From db020da38701c52e46f59c0c187caf00466274c4 Mon Sep 17 00:00:00 2001 From: einhornimmond Date: Mon, 6 Sep 2021 16:14:39 +0200 Subject: [PATCH 01/93] add commit hash with link to github into frontend --- .env.shell | 1 + deployment/bare_metal/build_frontend.sh | 4 +++- frontend/src/views/Layout/ContentFooter.vue | 5 +++++ frontend/vue.config.js | 2 ++ 4 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 .env.shell diff --git a/.env.shell b/.env.shell new file mode 100644 index 000000000..ac6181fc5 --- /dev/null +++ b/.env.shell @@ -0,0 +1 @@ +BUILD_COMMIT="$(git rev-parse HEAD)" \ No newline at end of file diff --git a/deployment/bare_metal/build_frontend.sh b/deployment/bare_metal/build_frontend.sh index fc0feb747..2e7e59381 100755 --- a/deployment/bare_metal/build_frontend.sh +++ b/deployment/bare_metal/build_frontend.sh @@ -2,7 +2,9 @@ # For that to work, node v12.19.0 needs to be installed with nvm for root # or NPM_BIN Path and NVM_DIR must be adjusted -cd /var/www/html/gradido/frontend +cd /var/www/html/gradido +eval "echo \"$(cat .env.shell)\"" > .env +cd frontend NPM_BIN=/root/.nvm/versions/node/v12.19.0/bin/npm diff --git a/frontend/src/views/Layout/ContentFooter.vue b/frontend/src/views/Layout/ContentFooter.vue index 09a2418fd..2584747b1 100755 --- a/frontend/src/views/Layout/ContentFooter.vue +++ b/frontend/src/views/Layout/ContentFooter.vue @@ -15,6 +15,9 @@ App version {{ version }} + + {{ shortHash }} + @@ -59,6 +62,8 @@ export default { return { year: new Date().getFullYear(), version: CONFIG.APP_VERSION, + hash: process.env.VUE_APP_BUILD_COMMIT, + shortHash: process.env.VUE_APP_BUILD_COMMIT.substr(0, 8), } }, } diff --git a/frontend/vue.config.js b/frontend/vue.config.js index 9fffda28c..698aca1de 100644 --- a/frontend/vue.config.js +++ b/frontend/vue.config.js @@ -1,6 +1,8 @@ const path = require('path') const dotenv = require('dotenv-webpack') +process.env.VUE_APP_BUILD_COMMIT = process.env.BUILD_COMMIT + // vue.config.js module.exports = { devServer: { From 0413e13ee0efe9a1be979228a3fb425547678be9 Mon Sep 17 00:00:00 2001 From: einhornimmond Date: Mon, 6 Sep 2021 17:12:53 +0200 Subject: [PATCH 02/93] add BUILD_COMMIT to test --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4606566df..04b004ae3 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -297,7 +297,7 @@ jobs: ########################################################################## - name: frontend | Unit tests run: | - docker run -v ~/coverage:/app/coverage --rm gradido/frontend:test yarn run test + docker run -e BUILD_COMMIT="$(git rev-parse HEAD)" -v ~/coverage:/app/coverage --rm gradido/frontend:test yarn run test cp -r ~/coverage ./coverage ########################################################################## # COVERAGE REPORT FRONTEND ################################################ From 761bd17290c55fd42632f47d5d9fea5913987680 Mon Sep 17 00:00:00 2001 From: einhornimmond Date: Mon, 6 Sep 2021 17:27:51 +0200 Subject: [PATCH 03/93] next try --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 04b004ae3..b12e1c152 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -22,7 +22,7 @@ jobs: ########################################################################## - name: Frontend | Build `test` image run: | - docker build --target test -t "gradido/frontend:test" frontend/ + docker build -e BUILD_COMMIT="$(git rev-parse HEAD)" --target test -t "gradido/frontend:test" frontend/ docker save "gradido/frontend:test" > /tmp/frontend.tar - name: Upload Artifact uses: actions/upload-artifact@v2 From 2937fc7c07c1058bb66f5db34b952e407791574a Mon Sep 17 00:00:00 2001 From: einhornimmond Date: Mon, 6 Sep 2021 17:32:23 +0200 Subject: [PATCH 04/93] replace -e with --build-arg in docker build call --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b12e1c152..f79959234 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -22,7 +22,7 @@ jobs: ########################################################################## - name: Frontend | Build `test` image run: | - docker build -e BUILD_COMMIT="$(git rev-parse HEAD)" --target test -t "gradido/frontend:test" frontend/ + docker build --build-arg BUILD_COMMIT="$(git rev-parse HEAD)" --target test -t "gradido/frontend:test" frontend/ docker save "gradido/frontend:test" > /tmp/frontend.tar - name: Upload Artifact uses: actions/upload-artifact@v2 From e7c1771d2adca5a52afd41cb34bd80f17d868e3a Mon Sep 17 00:00:00 2001 From: einhornimmond Date: Mon, 6 Sep 2021 17:44:44 +0200 Subject: [PATCH 05/93] try with default value --- .github/workflows/test.yml | 4 ++-- frontend/vue.config.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f79959234..4606566df 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -22,7 +22,7 @@ jobs: ########################################################################## - name: Frontend | Build `test` image run: | - docker build --build-arg BUILD_COMMIT="$(git rev-parse HEAD)" --target test -t "gradido/frontend:test" frontend/ + docker build --target test -t "gradido/frontend:test" frontend/ docker save "gradido/frontend:test" > /tmp/frontend.tar - name: Upload Artifact uses: actions/upload-artifact@v2 @@ -297,7 +297,7 @@ jobs: ########################################################################## - name: frontend | Unit tests run: | - docker run -e BUILD_COMMIT="$(git rev-parse HEAD)" -v ~/coverage:/app/coverage --rm gradido/frontend:test yarn run test + docker run -v ~/coverage:/app/coverage --rm gradido/frontend:test yarn run test cp -r ~/coverage ./coverage ########################################################################## # COVERAGE REPORT FRONTEND ################################################ diff --git a/frontend/vue.config.js b/frontend/vue.config.js index 698aca1de..dc406c98a 100644 --- a/frontend/vue.config.js +++ b/frontend/vue.config.js @@ -1,7 +1,7 @@ const path = require('path') const dotenv = require('dotenv-webpack') -process.env.VUE_APP_BUILD_COMMIT = process.env.BUILD_COMMIT +process.env.VUE_APP_BUILD_COMMIT = process.env.BUILD_COMMIT ? process.env.BUILD_COMMIT : '000000000' // vue.config.js module.exports = { From e355271ea80a30026d775354209aa1a9c61a3863 Mon Sep 17 00:00:00 2001 From: einhornimmond Date: Tue, 7 Sep 2021 11:36:11 +0200 Subject: [PATCH 06/93] update default --- frontend/vue.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/vue.config.js b/frontend/vue.config.js index dc406c98a..5a8495cc2 100644 --- a/frontend/vue.config.js +++ b/frontend/vue.config.js @@ -1,7 +1,7 @@ const path = require('path') const dotenv = require('dotenv-webpack') -process.env.VUE_APP_BUILD_COMMIT = process.env.BUILD_COMMIT ? process.env.BUILD_COMMIT : '000000000' +process.env.VUE_APP_BUILD_COMMIT = process.env.BUILD_COMMIT || '000000000' // vue.config.js module.exports = { From e24c3e21a689f47ed025498c6d18d62cd64ef645 Mon Sep 17 00:00:00 2001 From: einhornimmond Date: Tue, 7 Sep 2021 11:48:42 +0200 Subject: [PATCH 07/93] additional zero check for fixing broken tests --- frontend/src/views/Layout/ContentFooter.vue | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/frontend/src/views/Layout/ContentFooter.vue b/frontend/src/views/Layout/ContentFooter.vue index 2584747b1..6bf24af23 100755 --- a/frontend/src/views/Layout/ContentFooter.vue +++ b/frontend/src/views/Layout/ContentFooter.vue @@ -63,7 +63,10 @@ export default { year: new Date().getFullYear(), version: CONFIG.APP_VERSION, hash: process.env.VUE_APP_BUILD_COMMIT, - shortHash: process.env.VUE_APP_BUILD_COMMIT.substr(0, 8), + shortHash: + process.env.VUE_APP_BUILD_COMMIT !== undefined + ? process.env.VUE_APP_BUILD_COMMIT.substr(0, 8) + : '00000000', } }, } From 434fbb6d2f9f93ea4543c4df25ba6e9faf6e14be Mon Sep 17 00:00:00 2001 From: einhornimmond Date: Thu, 9 Sep 2021 12:52:54 +0200 Subject: [PATCH 08/93] adding moritz suggestion to don't show the commit hash link if no commit hash was given --- frontend/src/views/Layout/ContentFooter.vue | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/frontend/src/views/Layout/ContentFooter.vue b/frontend/src/views/Layout/ContentFooter.vue index 6bf24af23..97c27230f 100755 --- a/frontend/src/views/Layout/ContentFooter.vue +++ b/frontend/src/views/Layout/ContentFooter.vue @@ -15,7 +15,11 @@ App version {{ version }} - + {{ shortHash }} From 27e99fbd03f256362d81c4132ad0431db7971399 Mon Sep 17 00:00:00 2001 From: einhornimmond Date: Thu, 9 Sep 2021 13:04:04 +0200 Subject: [PATCH 09/93] make it possible to use additional local .env entries --- .env.local.dist | 1 + deployment/bare_metal/build_frontend.sh | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 .env.local.dist diff --git a/.env.local.dist b/.env.local.dist new file mode 100644 index 000000000..951a04b94 --- /dev/null +++ b/.env.local.dist @@ -0,0 +1 @@ +// for local .env entries \ No newline at end of file diff --git a/deployment/bare_metal/build_frontend.sh b/deployment/bare_metal/build_frontend.sh index 2e7e59381..2e968179d 100755 --- a/deployment/bare_metal/build_frontend.sh +++ b/deployment/bare_metal/build_frontend.sh @@ -3,7 +3,8 @@ # or NPM_BIN Path and NVM_DIR must be adjusted cd /var/www/html/gradido -eval "echo \"$(cat .env.shell)\"" > .env +eval "echo \"$(cat .env.local)\"" > .env +eval "echo \"$(cat .env.shell)\"" >> .env cd frontend NPM_BIN=/root/.nvm/versions/node/v12.19.0/bin/npm From a1db1153368a42daf921e3dc5fb8c4a8bf1c0761 Mon Sep 17 00:00:00 2001 From: einhornimmond Date: Fri, 10 Sep 2021 15:38:05 +0200 Subject: [PATCH 10/93] encapsulate --- frontend/src/config/index.js | 1 + frontend/src/views/Layout/ContentFooter.vue | 7 ++----- frontend/vue.config.js | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/frontend/src/config/index.js b/frontend/src/config/index.js index dd35eb185..fbef2abbb 100644 --- a/frontend/src/config/index.js +++ b/frontend/src/config/index.js @@ -20,6 +20,7 @@ const CONFIG = { ...environment, ...server, APP_VERSION: pkg.version, + COMMIT_HASH: process.env.VUE_APP_BUILD_COMMIT, } export default CONFIG diff --git a/frontend/src/views/Layout/ContentFooter.vue b/frontend/src/views/Layout/ContentFooter.vue index 97c27230f..c18608545 100755 --- a/frontend/src/views/Layout/ContentFooter.vue +++ b/frontend/src/views/Layout/ContentFooter.vue @@ -66,11 +66,8 @@ export default { return { year: new Date().getFullYear(), version: CONFIG.APP_VERSION, - hash: process.env.VUE_APP_BUILD_COMMIT, - shortHash: - process.env.VUE_APP_BUILD_COMMIT !== undefined - ? process.env.VUE_APP_BUILD_COMMIT.substr(0, 8) - : '00000000', + hash: CONFIG.COMMIT_HASH, + shortHash: CONFIG.COMMIT_HASH.substr(0, 8), } }, } diff --git a/frontend/vue.config.js b/frontend/vue.config.js index 5a8495cc2..79917948c 100644 --- a/frontend/vue.config.js +++ b/frontend/vue.config.js @@ -1,7 +1,7 @@ const path = require('path') const dotenv = require('dotenv-webpack') -process.env.VUE_APP_BUILD_COMMIT = process.env.BUILD_COMMIT || '000000000' +process.env.VUE_APP_BUILD_COMMIT = process.env.BUILD_COMMIT || '00000000' // vue.config.js module.exports = { From b5eaf30ee44a53cf985eff64a26cb32563e3a25a Mon Sep 17 00:00:00 2001 From: einhornimmond Date: Fri, 10 Sep 2021 18:05:11 +0200 Subject: [PATCH 11/93] add additional check --- frontend/src/config/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/config/index.js b/frontend/src/config/index.js index fbef2abbb..a7807b57c 100644 --- a/frontend/src/config/index.js +++ b/frontend/src/config/index.js @@ -20,7 +20,7 @@ const CONFIG = { ...environment, ...server, APP_VERSION: pkg.version, - COMMIT_HASH: process.env.VUE_APP_BUILD_COMMIT, + COMMIT_HASH: process.env.VUE_APP_BUILD_COMMIT || '00000000', } export default CONFIG From 6e1b0e8586c4be11aa39ff79f8e4ee7f15f608f0 Mon Sep 17 00:00:00 2001 From: einhornimmond Date: Tue, 14 Sep 2021 11:23:41 +0200 Subject: [PATCH 12/93] ... --- frontend/src/config/index.js | 8 +++++++- frontend/vue.config.js | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/frontend/src/config/index.js b/frontend/src/config/index.js index a7807b57c..878ed3c55 100644 --- a/frontend/src/config/index.js +++ b/frontend/src/config/index.js @@ -16,11 +16,17 @@ const server = { GRAPHQL_URI: process.env.GRAPHQL_URI || 'http://localhost:4000/graphql', } +// eslint-disable-next-line no-console +console.log('hash: %o', process.env.VUE_APP_BUILD_COMMIT) + const CONFIG = { ...environment, ...server, APP_VERSION: pkg.version, - COMMIT_HASH: process.env.VUE_APP_BUILD_COMMIT || '00000000', + COMMIT_HASH: + process.env.VUE_APP_BUILD_COMMIT === 'undefined' + ? '00000000' + : process.env.VUE_APP_BUILD_COMMIT, } export default CONFIG diff --git a/frontend/vue.config.js b/frontend/vue.config.js index 79917948c..698aca1de 100644 --- a/frontend/vue.config.js +++ b/frontend/vue.config.js @@ -1,7 +1,7 @@ const path = require('path') const dotenv = require('dotenv-webpack') -process.env.VUE_APP_BUILD_COMMIT = process.env.BUILD_COMMIT || '00000000' +process.env.VUE_APP_BUILD_COMMIT = process.env.BUILD_COMMIT // vue.config.js module.exports = { From 980e6e0a1cde1a32efb2f511aa4a4965a239f812 Mon Sep 17 00:00:00 2001 From: einhornimmond Date: Mon, 6 Sep 2021 16:14:39 +0200 Subject: [PATCH 13/93] add commit hash with link to github into frontend --- .env.shell | 1 + deployment/bare_metal/build_frontend.sh | 4 +++- frontend/src/views/Layout/ContentFooter.vue | 5 +++++ frontend/vue.config.js | 2 ++ 4 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 .env.shell diff --git a/.env.shell b/.env.shell new file mode 100644 index 000000000..ac6181fc5 --- /dev/null +++ b/.env.shell @@ -0,0 +1 @@ +BUILD_COMMIT="$(git rev-parse HEAD)" \ No newline at end of file diff --git a/deployment/bare_metal/build_frontend.sh b/deployment/bare_metal/build_frontend.sh index fc0feb747..2e7e59381 100755 --- a/deployment/bare_metal/build_frontend.sh +++ b/deployment/bare_metal/build_frontend.sh @@ -2,7 +2,9 @@ # For that to work, node v12.19.0 needs to be installed with nvm for root # or NPM_BIN Path and NVM_DIR must be adjusted -cd /var/www/html/gradido/frontend +cd /var/www/html/gradido +eval "echo \"$(cat .env.shell)\"" > .env +cd frontend NPM_BIN=/root/.nvm/versions/node/v12.19.0/bin/npm diff --git a/frontend/src/views/Layout/ContentFooter.vue b/frontend/src/views/Layout/ContentFooter.vue index 09a2418fd..2584747b1 100755 --- a/frontend/src/views/Layout/ContentFooter.vue +++ b/frontend/src/views/Layout/ContentFooter.vue @@ -15,6 +15,9 @@ App version {{ version }} + + {{ shortHash }} + @@ -59,6 +62,8 @@ export default { return { year: new Date().getFullYear(), version: CONFIG.APP_VERSION, + hash: process.env.VUE_APP_BUILD_COMMIT, + shortHash: process.env.VUE_APP_BUILD_COMMIT.substr(0, 8), } }, } diff --git a/frontend/vue.config.js b/frontend/vue.config.js index 9fffda28c..698aca1de 100644 --- a/frontend/vue.config.js +++ b/frontend/vue.config.js @@ -1,6 +1,8 @@ const path = require('path') const dotenv = require('dotenv-webpack') +process.env.VUE_APP_BUILD_COMMIT = process.env.BUILD_COMMIT + // vue.config.js module.exports = { devServer: { From 2cbe284069e2942f1303f35395eb5f3e71ca21c1 Mon Sep 17 00:00:00 2001 From: einhornimmond Date: Mon, 6 Sep 2021 17:12:53 +0200 Subject: [PATCH 14/93] add BUILD_COMMIT to test --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4606566df..04b004ae3 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -297,7 +297,7 @@ jobs: ########################################################################## - name: frontend | Unit tests run: | - docker run -v ~/coverage:/app/coverage --rm gradido/frontend:test yarn run test + docker run -e BUILD_COMMIT="$(git rev-parse HEAD)" -v ~/coverage:/app/coverage --rm gradido/frontend:test yarn run test cp -r ~/coverage ./coverage ########################################################################## # COVERAGE REPORT FRONTEND ################################################ From 49d6d75f6338e5e09b0412aae5ba0d457503f008 Mon Sep 17 00:00:00 2001 From: einhornimmond Date: Mon, 6 Sep 2021 17:27:51 +0200 Subject: [PATCH 15/93] next try --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 04b004ae3..b12e1c152 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -22,7 +22,7 @@ jobs: ########################################################################## - name: Frontend | Build `test` image run: | - docker build --target test -t "gradido/frontend:test" frontend/ + docker build -e BUILD_COMMIT="$(git rev-parse HEAD)" --target test -t "gradido/frontend:test" frontend/ docker save "gradido/frontend:test" > /tmp/frontend.tar - name: Upload Artifact uses: actions/upload-artifact@v2 From 97b6ef0ac219349af886ab1951e83cb5558ab887 Mon Sep 17 00:00:00 2001 From: einhornimmond Date: Mon, 6 Sep 2021 17:32:23 +0200 Subject: [PATCH 16/93] replace -e with --build-arg in docker build call --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b12e1c152..f79959234 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -22,7 +22,7 @@ jobs: ########################################################################## - name: Frontend | Build `test` image run: | - docker build -e BUILD_COMMIT="$(git rev-parse HEAD)" --target test -t "gradido/frontend:test" frontend/ + docker build --build-arg BUILD_COMMIT="$(git rev-parse HEAD)" --target test -t "gradido/frontend:test" frontend/ docker save "gradido/frontend:test" > /tmp/frontend.tar - name: Upload Artifact uses: actions/upload-artifact@v2 From a29ade293068b76a398f328795b211086952ba15 Mon Sep 17 00:00:00 2001 From: einhornimmond Date: Mon, 6 Sep 2021 17:44:44 +0200 Subject: [PATCH 17/93] try with default value --- .github/workflows/test.yml | 4 ++-- frontend/vue.config.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f79959234..4606566df 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -22,7 +22,7 @@ jobs: ########################################################################## - name: Frontend | Build `test` image run: | - docker build --build-arg BUILD_COMMIT="$(git rev-parse HEAD)" --target test -t "gradido/frontend:test" frontend/ + docker build --target test -t "gradido/frontend:test" frontend/ docker save "gradido/frontend:test" > /tmp/frontend.tar - name: Upload Artifact uses: actions/upload-artifact@v2 @@ -297,7 +297,7 @@ jobs: ########################################################################## - name: frontend | Unit tests run: | - docker run -e BUILD_COMMIT="$(git rev-parse HEAD)" -v ~/coverage:/app/coverage --rm gradido/frontend:test yarn run test + docker run -v ~/coverage:/app/coverage --rm gradido/frontend:test yarn run test cp -r ~/coverage ./coverage ########################################################################## # COVERAGE REPORT FRONTEND ################################################ diff --git a/frontend/vue.config.js b/frontend/vue.config.js index 698aca1de..dc406c98a 100644 --- a/frontend/vue.config.js +++ b/frontend/vue.config.js @@ -1,7 +1,7 @@ const path = require('path') const dotenv = require('dotenv-webpack') -process.env.VUE_APP_BUILD_COMMIT = process.env.BUILD_COMMIT +process.env.VUE_APP_BUILD_COMMIT = process.env.BUILD_COMMIT ? process.env.BUILD_COMMIT : '000000000' // vue.config.js module.exports = { From d4ca210e8f5d93c604f2513c86460af4fb922b38 Mon Sep 17 00:00:00 2001 From: einhornimmond Date: Tue, 7 Sep 2021 11:36:11 +0200 Subject: [PATCH 18/93] update default --- frontend/vue.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/vue.config.js b/frontend/vue.config.js index dc406c98a..5a8495cc2 100644 --- a/frontend/vue.config.js +++ b/frontend/vue.config.js @@ -1,7 +1,7 @@ const path = require('path') const dotenv = require('dotenv-webpack') -process.env.VUE_APP_BUILD_COMMIT = process.env.BUILD_COMMIT ? process.env.BUILD_COMMIT : '000000000' +process.env.VUE_APP_BUILD_COMMIT = process.env.BUILD_COMMIT || '000000000' // vue.config.js module.exports = { From 9787764e6c840a50e497b3803c028e131844438c Mon Sep 17 00:00:00 2001 From: einhornimmond Date: Tue, 7 Sep 2021 11:48:42 +0200 Subject: [PATCH 19/93] additional zero check for fixing broken tests --- frontend/src/views/Layout/ContentFooter.vue | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/frontend/src/views/Layout/ContentFooter.vue b/frontend/src/views/Layout/ContentFooter.vue index 2584747b1..6bf24af23 100755 --- a/frontend/src/views/Layout/ContentFooter.vue +++ b/frontend/src/views/Layout/ContentFooter.vue @@ -63,7 +63,10 @@ export default { year: new Date().getFullYear(), version: CONFIG.APP_VERSION, hash: process.env.VUE_APP_BUILD_COMMIT, - shortHash: process.env.VUE_APP_BUILD_COMMIT.substr(0, 8), + shortHash: + process.env.VUE_APP_BUILD_COMMIT !== undefined + ? process.env.VUE_APP_BUILD_COMMIT.substr(0, 8) + : '00000000', } }, } From 47e283ac6599d0e69725decfff5e637592e509db Mon Sep 17 00:00:00 2001 From: einhornimmond Date: Thu, 9 Sep 2021 12:52:54 +0200 Subject: [PATCH 20/93] adding moritz suggestion to don't show the commit hash link if no commit hash was given --- frontend/src/views/Layout/ContentFooter.vue | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/frontend/src/views/Layout/ContentFooter.vue b/frontend/src/views/Layout/ContentFooter.vue index 6bf24af23..97c27230f 100755 --- a/frontend/src/views/Layout/ContentFooter.vue +++ b/frontend/src/views/Layout/ContentFooter.vue @@ -15,7 +15,11 @@ App version {{ version }} - + {{ shortHash }} From 6569ec0743eedf415c62189e336a0651083bd8f9 Mon Sep 17 00:00:00 2001 From: einhornimmond Date: Thu, 9 Sep 2021 13:04:04 +0200 Subject: [PATCH 21/93] make it possible to use additional local .env entries --- .env.local.dist | 1 + deployment/bare_metal/build_frontend.sh | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 .env.local.dist diff --git a/.env.local.dist b/.env.local.dist new file mode 100644 index 000000000..951a04b94 --- /dev/null +++ b/.env.local.dist @@ -0,0 +1 @@ +// for local .env entries \ No newline at end of file diff --git a/deployment/bare_metal/build_frontend.sh b/deployment/bare_metal/build_frontend.sh index 2e7e59381..2e968179d 100755 --- a/deployment/bare_metal/build_frontend.sh +++ b/deployment/bare_metal/build_frontend.sh @@ -3,7 +3,8 @@ # or NPM_BIN Path and NVM_DIR must be adjusted cd /var/www/html/gradido -eval "echo \"$(cat .env.shell)\"" > .env +eval "echo \"$(cat .env.local)\"" > .env +eval "echo \"$(cat .env.shell)\"" >> .env cd frontend NPM_BIN=/root/.nvm/versions/node/v12.19.0/bin/npm From abdbbab2ea2503266e69522ccbb04fe99ece2198 Mon Sep 17 00:00:00 2001 From: einhornimmond Date: Fri, 10 Sep 2021 15:38:05 +0200 Subject: [PATCH 22/93] encapsulate --- frontend/src/config/index.js | 1 + frontend/src/views/Layout/ContentFooter.vue | 7 ++----- frontend/vue.config.js | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/frontend/src/config/index.js b/frontend/src/config/index.js index dd35eb185..fbef2abbb 100644 --- a/frontend/src/config/index.js +++ b/frontend/src/config/index.js @@ -20,6 +20,7 @@ const CONFIG = { ...environment, ...server, APP_VERSION: pkg.version, + COMMIT_HASH: process.env.VUE_APP_BUILD_COMMIT, } export default CONFIG diff --git a/frontend/src/views/Layout/ContentFooter.vue b/frontend/src/views/Layout/ContentFooter.vue index 97c27230f..c18608545 100755 --- a/frontend/src/views/Layout/ContentFooter.vue +++ b/frontend/src/views/Layout/ContentFooter.vue @@ -66,11 +66,8 @@ export default { return { year: new Date().getFullYear(), version: CONFIG.APP_VERSION, - hash: process.env.VUE_APP_BUILD_COMMIT, - shortHash: - process.env.VUE_APP_BUILD_COMMIT !== undefined - ? process.env.VUE_APP_BUILD_COMMIT.substr(0, 8) - : '00000000', + hash: CONFIG.COMMIT_HASH, + shortHash: CONFIG.COMMIT_HASH.substr(0, 8), } }, } diff --git a/frontend/vue.config.js b/frontend/vue.config.js index 5a8495cc2..79917948c 100644 --- a/frontend/vue.config.js +++ b/frontend/vue.config.js @@ -1,7 +1,7 @@ const path = require('path') const dotenv = require('dotenv-webpack') -process.env.VUE_APP_BUILD_COMMIT = process.env.BUILD_COMMIT || '000000000' +process.env.VUE_APP_BUILD_COMMIT = process.env.BUILD_COMMIT || '00000000' // vue.config.js module.exports = { From 133a394158a2645d566172865e2df75f0b95dca8 Mon Sep 17 00:00:00 2001 From: einhornimmond Date: Fri, 10 Sep 2021 18:05:11 +0200 Subject: [PATCH 23/93] add additional check --- frontend/src/config/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/config/index.js b/frontend/src/config/index.js index fbef2abbb..a7807b57c 100644 --- a/frontend/src/config/index.js +++ b/frontend/src/config/index.js @@ -20,7 +20,7 @@ const CONFIG = { ...environment, ...server, APP_VERSION: pkg.version, - COMMIT_HASH: process.env.VUE_APP_BUILD_COMMIT, + COMMIT_HASH: process.env.VUE_APP_BUILD_COMMIT || '00000000', } export default CONFIG From 01cb8fae90d3043d0a625f6a3434e516cfa93e6d Mon Sep 17 00:00:00 2001 From: einhornimmond Date: Tue, 14 Sep 2021 11:23:41 +0200 Subject: [PATCH 24/93] ... --- frontend/src/config/index.js | 8 +++++++- frontend/vue.config.js | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/frontend/src/config/index.js b/frontend/src/config/index.js index a7807b57c..878ed3c55 100644 --- a/frontend/src/config/index.js +++ b/frontend/src/config/index.js @@ -16,11 +16,17 @@ const server = { GRAPHQL_URI: process.env.GRAPHQL_URI || 'http://localhost:4000/graphql', } +// eslint-disable-next-line no-console +console.log('hash: %o', process.env.VUE_APP_BUILD_COMMIT) + const CONFIG = { ...environment, ...server, APP_VERSION: pkg.version, - COMMIT_HASH: process.env.VUE_APP_BUILD_COMMIT || '00000000', + COMMIT_HASH: + process.env.VUE_APP_BUILD_COMMIT === 'undefined' + ? '00000000' + : process.env.VUE_APP_BUILD_COMMIT, } export default CONFIG diff --git a/frontend/vue.config.js b/frontend/vue.config.js index 79917948c..698aca1de 100644 --- a/frontend/vue.config.js +++ b/frontend/vue.config.js @@ -1,7 +1,7 @@ const path = require('path') const dotenv = require('dotenv-webpack') -process.env.VUE_APP_BUILD_COMMIT = process.env.BUILD_COMMIT || '00000000' +process.env.VUE_APP_BUILD_COMMIT = process.env.BUILD_COMMIT // vue.config.js module.exports = { From 489b62b27a05eae16248e6c352917a0c088909c2 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Wed, 15 Sep 2021 00:11:56 +0200 Subject: [PATCH 25/93] added .env(docker) to ignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 02347691f..a5dadd281 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ messages.pot .skeema nbproject .metadata +/.env From 5b6d1b4ca29a4ed6050d78d8afc851ceb8d1094a Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Wed, 15 Sep 2021 00:32:22 +0200 Subject: [PATCH 26/93] updated yarn lock(?) --- frontend/yarn.lock | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/frontend/yarn.lock b/frontend/yarn.lock index c910ea9de..eff78ada1 100644 --- a/frontend/yarn.lock +++ b/frontend/yarn.lock @@ -13576,13 +13576,6 @@ vue-jest@^3.0.5, vue-jest@^3.0.7: tsconfig "^7.0.0" vue-template-es2015-compiler "^1.6.0" -vue-jwt-decode@^0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/vue-jwt-decode/-/vue-jwt-decode-0.1.0.tgz#f9caf7b9030d5459cc567b1c3117d9d1f291458f" - integrity sha512-4iP0NzYHkAF7G13tYPc/nudk4oNpB8GCVZupc7lekxXok1XKEgefNaGTpDT14g7RKe5H9GaMphPduDj4UVfZwQ== - dependencies: - vue "^2.3.3" - vue-loader@^15.7.0: version "15.9.6" resolved "https://registry.yarnpkg.com/vue-loader/-/vue-loader-15.9.6.tgz#f4bb9ae20c3a8370af3ecf09b8126d38ffdb6b8b" @@ -13662,11 +13655,6 @@ vue@^2.2.6, vue@^2.5.17, vue@^2.6.11: resolved "https://registry.yarnpkg.com/vue/-/vue-2.6.12.tgz#f5ebd4fa6bd2869403e29a896aed4904456c9123" integrity sha512-uhmLFETqPPNyuLLbsKz6ioJ4q7AZHzD8ZVFNATNyICSZouqP2Sz0rotWQC8UNBF6VGSCs5abnKJoStA6JbCbfg== -vue@^2.3.3: - version "2.6.14" - resolved "https://registry.yarnpkg.com/vue/-/vue-2.6.14.tgz#e51aa5250250d569a3fbad3a8a5a687d6036e235" - integrity sha512-x2284lgYvjOMj3Za7kqzRcUSxBboHqtgRE2zlos1qWaOye5yUmHn42LB1250NJBLRwEcdrB0JRwyPTEPhfQjiQ== - vuex-persistedstate@^4.0.0-beta.3: version "4.0.0-beta.3" resolved "https://registry.yarnpkg.com/vuex-persistedstate/-/vuex-persistedstate-4.0.0-beta.3.tgz#89dd712de72d28e85cc95467d066002c1405f277" From 871d0fc76df15c98274a9aac18feab919a4a3ede Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Wed, 15 Sep 2021 02:36:00 +0200 Subject: [PATCH 27/93] default value for BUILD_COMMIT in .env in frontend, but not active --- frontend/.env.dist | 1 + 1 file changed, 1 insertion(+) diff --git a/frontend/.env.dist b/frontend/.env.dist index a22b31307..1252faf5b 100644 --- a/frontend/.env.dist +++ b/frontend/.env.dist @@ -2,3 +2,4 @@ LOGIN_API_URL=http://localhost/login_api/ COMMUNITY_API_URL=http://localhost/api/ ALLOW_REGISTER=true GRAPHQL_URI=http://localhost:4000/graphql +//BUILD_COMMIT=0000000 \ No newline at end of file From f9021a8b2e47b5a7ba3dab62af17b5218cca37b9 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Wed, 15 Sep 2021 10:19:01 +0200 Subject: [PATCH 28/93] remove .env.local.dist since this is a structure relevant for vue, but this is a docker .env --- .env.local.dist | 1 - 1 file changed, 1 deletion(-) delete mode 100644 .env.local.dist diff --git a/.env.local.dist b/.env.local.dist deleted file mode 100644 index 951a04b94..000000000 --- a/.env.local.dist +++ /dev/null @@ -1 +0,0 @@ -// for local .env entries \ No newline at end of file From 32c69a376065ab8ad8c1d52d782dbe8f731cbfe1 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Wed, 15 Sep 2021 10:19:28 +0200 Subject: [PATCH 29/93] removed .env.local from eval shell --- deployment/bare_metal/build_frontend.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/deployment/bare_metal/build_frontend.sh b/deployment/bare_metal/build_frontend.sh index 2e968179d..2e7e59381 100755 --- a/deployment/bare_metal/build_frontend.sh +++ b/deployment/bare_metal/build_frontend.sh @@ -3,8 +3,7 @@ # or NPM_BIN Path and NVM_DIR must be adjusted cd /var/www/html/gradido -eval "echo \"$(cat .env.local)\"" > .env -eval "echo \"$(cat .env.shell)\"" >> .env +eval "echo \"$(cat .env.shell)\"" > .env cd frontend NPM_BIN=/root/.nvm/versions/node/v12.19.0/bin/npm From 4a2ee3d16207a9a632032aa155568de811d90e4b Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Wed, 15 Sep 2021 10:20:00 +0200 Subject: [PATCH 30/93] remove nuxt reference, we do not use nuxt --- docker-compose.override.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/docker-compose.override.yml b/docker-compose.override.yml index 5eb808b99..84906a5a9 100644 --- a/docker-compose.override.yml +++ b/docker-compose.override.yml @@ -13,7 +13,6 @@ services: environment: - NODE_ENV="development" # - DEBUG=true - - NUXT_BUILD=/tmp/nuxt # avoid file permission issues when `rm -rf .nuxt/` volumes: # This makes sure the docker container has its own node modules. # Therefore it is possible to have a different node version on the host machine From 9024534eaca7591866eba404b7ee8d94c91328e9 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Wed, 15 Sep 2021 10:24:36 +0200 Subject: [PATCH 31/93] restructured config, refactor BUILD_COMMIT --- frontend/src/config/index.js | 34 +++++++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/frontend/src/config/index.js b/frontend/src/config/index.js index 878ed3c55..1409db9ad 100644 --- a/frontend/src/config/index.js +++ b/frontend/src/config/index.js @@ -1,13 +1,31 @@ -// ATTENTION: DO NOT PUT ANY SECRETS IN HERE (or the .env) +// ATTENTION: DO NOT PUT ANY SECRETS IN HERE (or the .env). +// The whole contents is exposed to the client // Load Package Details for some default values const pkg = require('../../package') +const version = { + APP_VERSION: pkg.version, + BUILD_COMMIT: + process.env.BUILD_COMMIT || + // the check for undefined is because of a conflict between webpack-dotenv and vue cli env filtering + (process.env.VUE_APP_BUILD_COMMIT !== 'undefined' ? process.env.VUE_APP_BUILD_COMMIT : null) || + null, + // self reference of `version.BUILD_COMMIT` is not possible at this point, hence the duplicate code + BUILD_COMMIT_SHORT: ( + process.env.BUILD_COMMIT || + (process.env.VUE_APP_BUILD_COMMIT !== 'undefined' ? process.env.VUE_APP_BUILD_COMMIT : null) || + '0000000' + ).substr(0, 7), + // unused + // BUILD_DATE: process.env.BUILD_DATE || process.env.VUE_APP_BUILD_DATE || '1970-01-01T00:00:00.00Z', + // BUILD_VERSION: process.env.BUILD_VERSION || process.env.VUE_APP_BUILD_VERSION || '0.0.0.0', +} + const environment = { NODE_ENV: process.env.NODE_ENV, DEBUG: process.env.NODE_ENV !== 'production' || false, PRODUCTION: process.env.NODE_ENV === 'production' || false, - ALLOW_REGISTER: process.env.ALLOW_REGISTER !== 'false', } const server = { @@ -16,17 +34,15 @@ const server = { GRAPHQL_URI: process.env.GRAPHQL_URI || 'http://localhost:4000/graphql', } -// eslint-disable-next-line no-console -console.log('hash: %o', process.env.VUE_APP_BUILD_COMMIT) +const options = { + ALLOW_REGISTER: process.env.ALLOW_REGISTER !== 'false', +} const CONFIG = { + ...version, ...environment, ...server, - APP_VERSION: pkg.version, - COMMIT_HASH: - process.env.VUE_APP_BUILD_COMMIT === 'undefined' - ? '00000000' - : process.env.VUE_APP_BUILD_COMMIT, + ...options, } export default CONFIG From 3eb2e4b5414b4375aa519d2bcb8aef0d35c6d843 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Wed, 15 Sep 2021 10:25:41 +0200 Subject: [PATCH 32/93] Contentfooter - brackets - use BUILD_COMMIT and BUILD_COMMIT_SHORT - check for null value instead of 0000000 --- frontend/src/views/Layout/ContentFooter.vue | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/frontend/src/views/Layout/ContentFooter.vue b/frontend/src/views/Layout/ContentFooter.vue index c18608545..4350e3f55 100755 --- a/frontend/src/views/Layout/ContentFooter.vue +++ b/frontend/src/views/Layout/ContentFooter.vue @@ -16,11 +16,11 @@ App version {{ version }} - {{ shortHash }} + ({{ shortHash }}) @@ -66,8 +66,8 @@ export default { return { year: new Date().getFullYear(), version: CONFIG.APP_VERSION, - hash: CONFIG.COMMIT_HASH, - shortHash: CONFIG.COMMIT_HASH.substr(0, 8), + hash: CONFIG.BUILD_COMMIT, + shortHash: CONFIG.BUILD_COMMIT_SHORT, } }, } From f3e7917d415cd0b6e36a57df385ed1dbcb283bfe Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Wed, 15 Sep 2021 10:27:24 +0200 Subject: [PATCH 33/93] remove empty default values and reference the .env file instead --- docker-compose.yml | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 70d36521e..8fdab9f17 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -22,14 +22,13 @@ services: # Envs used in Dockerfile # - DOCKER_WORKDIR="/app" # - PORT=3000 - - BUILD_DATE - - BUILD_VERSION - - BUILD_COMMIT + # - BUILD_DATE="1970-01-01T00:00:00.00Z" + # - BUILD_VERSION="0.0.0.0" + # - BUILD_COMMIT="0000000" - NODE_ENV="production" - # Application only envs - #- HOST=0.0.0.0 # This is nuxt specific, alternative value is HOST=webapp - #env_file: - # - ./frontend/.env + env_file: + - ./.env + # - ./frontend/.env ######################################################### ## MARIADB ############################################## From 9cf1221040f65415e19114b6e5bda180b2742d7d Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Wed, 15 Sep 2021 10:28:10 +0200 Subject: [PATCH 34/93] update docker file to properly transmit cli parameters to vue --- frontend/Dockerfile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/frontend/Dockerfile b/frontend/Dockerfile index 5ec90fe81..b222d7f1a 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -8,14 +8,18 @@ FROM node:12.19.0-alpine3.10 as base ENV DOCKER_WORKDIR="/app" ## We Cannot do `$(date -u +'%Y-%m-%dT%H:%M:%SZ')` here so we use unix timestamp=0 ENV BUILD_DATE="1970-01-01T00:00:00.00Z" +ENV VUE_APP_BUILD_DATE="${BUILD_DATE}" ## We cannot do $(npm run version).${BUILD_NUMBER} here so we default to 0.0.0.0 ENV BUILD_VERSION="0.0.0.0" +ENV VUE_APP_BUILD_VERSION="${BUILD_VERSION}" ## We cannot do `$(git rev-parse --short HEAD)` here so we default to 0000000 ENV BUILD_COMMIT="0000000" +ENV VUE_APP_BUILD_COMMIT="${BUILD_COMMIT}" ## SET NODE_ENV ENV NODE_ENV="production" ## App relevant Envs ENV PORT="3000" +# TODO ENV VUE_APP_PORT="${PORT}" # Labels LABEL org.label-schema.build-date="${BUILD_DATE}" From f9af5f961f3b48d9c31060c8c00da144d14b127d Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Wed, 15 Sep 2021 14:30:11 +0200 Subject: [PATCH 35/93] env/process.env working in docker & without --- frontend/Dockerfile | 4 ---- frontend/src/config/index.js | 15 ++------------- frontend/vue.config.js | 18 +++++++++++++----- 3 files changed, 15 insertions(+), 22 deletions(-) diff --git a/frontend/Dockerfile b/frontend/Dockerfile index b222d7f1a..5ec90fe81 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -8,18 +8,14 @@ FROM node:12.19.0-alpine3.10 as base ENV DOCKER_WORKDIR="/app" ## We Cannot do `$(date -u +'%Y-%m-%dT%H:%M:%SZ')` here so we use unix timestamp=0 ENV BUILD_DATE="1970-01-01T00:00:00.00Z" -ENV VUE_APP_BUILD_DATE="${BUILD_DATE}" ## We cannot do $(npm run version).${BUILD_NUMBER} here so we default to 0.0.0.0 ENV BUILD_VERSION="0.0.0.0" -ENV VUE_APP_BUILD_VERSION="${BUILD_VERSION}" ## We cannot do `$(git rev-parse --short HEAD)` here so we default to 0000000 ENV BUILD_COMMIT="0000000" -ENV VUE_APP_BUILD_COMMIT="${BUILD_COMMIT}" ## SET NODE_ENV ENV NODE_ENV="production" ## App relevant Envs ENV PORT="3000" -# TODO ENV VUE_APP_PORT="${PORT}" # Labels LABEL org.label-schema.build-date="${BUILD_DATE}" diff --git a/frontend/src/config/index.js b/frontend/src/config/index.js index 1409db9ad..54c2c7aeb 100644 --- a/frontend/src/config/index.js +++ b/frontend/src/config/index.js @@ -6,20 +6,9 @@ const pkg = require('../../package') const version = { APP_VERSION: pkg.version, - BUILD_COMMIT: - process.env.BUILD_COMMIT || - // the check for undefined is because of a conflict between webpack-dotenv and vue cli env filtering - (process.env.VUE_APP_BUILD_COMMIT !== 'undefined' ? process.env.VUE_APP_BUILD_COMMIT : null) || - null, + BUILD_COMMIT: process.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 || - (process.env.VUE_APP_BUILD_COMMIT !== 'undefined' ? process.env.VUE_APP_BUILD_COMMIT : null) || - '0000000' - ).substr(0, 7), - // unused - // BUILD_DATE: process.env.BUILD_DATE || process.env.VUE_APP_BUILD_DATE || '1970-01-01T00:00:00.00Z', - // BUILD_VERSION: process.env.BUILD_VERSION || process.env.VUE_APP_BUILD_VERSION || '0.0.0.0', + BUILD_COMMIT_SHORT: (process.env.BUILD_COMMIT || '0000000').substr(0, 7), } const environment = { diff --git a/frontend/vue.config.js b/frontend/vue.config.js index 698aca1de..45903e9cf 100644 --- a/frontend/vue.config.js +++ b/frontend/vue.config.js @@ -1,7 +1,6 @@ const path = require('path') -const dotenv = require('dotenv-webpack') - -process.env.VUE_APP_BUILD_COMMIT = process.env.BUILD_COMMIT +const webpack = require('webpack') +const Dotenv = require('dotenv-webpack') // vue.config.js module.exports = { @@ -25,8 +24,17 @@ module.exports = { assets: path.join(__dirname, 'src/assets'), }, }, - // eslint-disable-next-line new-cap - plugins: [new dotenv()], + plugins: [ + new Dotenv(), + new webpack.DefinePlugin({ + // Those are Environment Variables transmitted via Docker + // '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(process.env.BUILD_COMMIT), + // 'process.env.PORT': JSON.stringify(process.env.PORT), + }), + ], }, css: { // Enable CSS source maps. From afcfe1d913921f06b57c3e6457d2cce4d8b8c790 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Wed, 15 Sep 2021 14:47:55 +0200 Subject: [PATCH 36/93] do not reference the .env file at given point - in development mode we will have 0000000 as hash displayed --- docker-compose.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 8fdab9f17..652daae13 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -26,8 +26,8 @@ services: # - BUILD_VERSION="0.0.0.0" # - BUILD_COMMIT="0000000" - NODE_ENV="production" - env_file: - - ./.env + # env_file: + # - ./.env # - ./frontend/.env ######################################################### From ba1f3c0fc6d7c57c5ed9cb13a8447edde004f0f9 Mon Sep 17 00:00:00 2001 From: einhornimmond Date: Wed, 15 Sep 2021 15:06:52 +0200 Subject: [PATCH 37/93] removed old code --- frontend/src/config/index.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/frontend/src/config/index.js b/frontend/src/config/index.js index e372a033f..54c2c7aeb 100644 --- a/frontend/src/config/index.js +++ b/frontend/src/config/index.js @@ -32,10 +32,6 @@ const CONFIG = { ...environment, ...server, ...options, - COMMIT_HASH: - process.env.VUE_APP_BUILD_COMMIT === 'undefined' - ? '00000000' - : process.env.VUE_APP_BUILD_COMMIT, } export default CONFIG From de750e79a2a51167fba7bce07657c4e4e821597f Mon Sep 17 00:00:00 2001 From: einhornimmond Date: Wed, 15 Sep 2021 15:13:05 +0200 Subject: [PATCH 38/93] add as env on shell --- deployment/bare_metal/build_frontend.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/deployment/bare_metal/build_frontend.sh b/deployment/bare_metal/build_frontend.sh index 2e7e59381..4b3a8a444 100755 --- a/deployment/bare_metal/build_frontend.sh +++ b/deployment/bare_metal/build_frontend.sh @@ -4,6 +4,7 @@ cd /var/www/html/gradido eval "echo \"$(cat .env.shell)\"" > .env +export BUILD_COMMIT="$(git rev-parse HEAD)" cd frontend NPM_BIN=/root/.nvm/versions/node/v12.19.0/bin/npm From 827cdd636f9564a55aede36315a1980a6a2b091f Mon Sep 17 00:00:00 2001 From: einhornimmond Date: Thu, 16 Sep 2021 13:01:00 +0200 Subject: [PATCH 39/93] remove old code --- frontend/vue.config.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/frontend/vue.config.js b/frontend/vue.config.js index fa12f8200..45903e9cf 100644 --- a/frontend/vue.config.js +++ b/frontend/vue.config.js @@ -2,8 +2,6 @@ const path = require('path') const webpack = require('webpack') const Dotenv = require('dotenv-webpack') -process.env.VUE_APP_BUILD_COMMIT = process.env.BUILD_COMMIT - // vue.config.js module.exports = { devServer: { From db15a5da4e5ccf64775674e6e3746025ccf2e06a Mon Sep 17 00:00:00 2001 From: einhornimmond Date: Fri, 17 Sep 2021 13:19:10 +0200 Subject: [PATCH 40/93] add tests for commit hash --- frontend/src/views/Layout/ContentFooter.spec.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/frontend/src/views/Layout/ContentFooter.spec.js b/frontend/src/views/Layout/ContentFooter.spec.js index 8d0c6dfbd..368b6c743 100644 --- a/frontend/src/views/Layout/ContentFooter.spec.js +++ b/frontend/src/views/Layout/ContentFooter.spec.js @@ -59,6 +59,16 @@ describe('ContentFooter', () => { 'https://github.com/gradido/gradido/releases/latest', ) }) + + it('git commit hash and link', async () => { + wrapper.setData({ shortHash: 'ACCEDED' }) + wrapper.setData({ hash: 'ACCEDEDC001D00DC001D00DC001D00DC001CAFA' }) + await wrapper.vm.$nextTick() + expect(wrapper.find('div.copyright').findAll('a').at(2).text()).toEqual('(ACCEDED)') + expect(wrapper.find('div.copyright').findAll('a').at(2).attributes('href')).toEqual( + 'https://github.com/gradido/gradido/commit/ACCEDEDC001D00DC001D00DC001D00DC001CAFA', + ) + }) }) describe('links to gradido.net', () => { From 675917a8c0a2e111731a69c5240bbb739123cd72 Mon Sep 17 00:00:00 2001 From: einhornimmond Date: Fri, 17 Sep 2021 16:37:39 +0200 Subject: [PATCH 41/93] split test in two --- frontend/src/views/Layout/ContentFooter.spec.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/frontend/src/views/Layout/ContentFooter.spec.js b/frontend/src/views/Layout/ContentFooter.spec.js index 368b6c743..4b360d581 100644 --- a/frontend/src/views/Layout/ContentFooter.spec.js +++ b/frontend/src/views/Layout/ContentFooter.spec.js @@ -60,11 +60,16 @@ describe('ContentFooter', () => { ) }) - it('git commit hash and link', async () => { + it('has last commit hash', async () => { wrapper.setData({ shortHash: 'ACCEDED' }) wrapper.setData({ hash: 'ACCEDEDC001D00DC001D00DC001D00DC001CAFA' }) await wrapper.vm.$nextTick() expect(wrapper.find('div.copyright').findAll('a').at(2).text()).toEqual('(ACCEDED)') + }) + + it('links to last release commit', async () => { + wrapper.setData({ hash: 'ACCEDEDC001D00DC001D00DC001D00DC001CAFA' }) + await wrapper.vm.$nextTick() expect(wrapper.find('div.copyright').findAll('a').at(2).attributes('href')).toEqual( 'https://github.com/gradido/gradido/commit/ACCEDEDC001D00DC001D00DC001D00DC001CAFA', ) From 0c7bb13b4e1e414b751d6ec12b1ccd349eb8eea3 Mon Sep 17 00:00:00 2001 From: Einhornimmond Date: Fri, 17 Sep 2021 21:13:14 +0200 Subject: [PATCH 42/93] change state_users table to user and rename colums in camelCase, adapt --- backend/src/index.ts | 2 +- .../src/Controller/AppController.php | 16 +++--- .../JsonRequestHandlerController.php | 6 +- .../Controller/StateUserRolesController.php | 4 +- .../src/Controller/StateUsersController.php | 18 +++--- .../TransactionCreationsController.php | 20 +++---- .../src/Model/Entity/StateUser.php | 14 ++--- .../src/Model/Table/StateUsersTable.php | 16 ++---- .../Model/Transactions/TransactionBase.php | 6 +- .../Transactions/TransactionCreation.php | 4 +- .../Transactions/TransactionTransfer.php | 4 +- database/migrations/0002-update_user.ts | 56 +++++++++++++++++++ 12 files changed, 106 insertions(+), 60 deletions(-) create mode 100644 database/migrations/0002-update_user.ts diff --git a/backend/src/index.ts b/backend/src/index.ts index b99e5bee4..07086c544 100644 --- a/backend/src/index.ts +++ b/backend/src/index.ts @@ -21,7 +21,7 @@ import { isAuthorized } from './auth/auth' // TODO implement // import queryComplexity, { simpleEstimator, fieldConfigEstimator } from "graphql-query-complexity"; -const DB_VERSION = '0001-init_db' +const DB_VERSION = '0002-update_user' const context = (args: any) => { const authorization = args.req.headers.authorization diff --git a/community_server/src/Controller/AppController.php b/community_server/src/Controller/AppController.php index e70b8e7bd..2c4b2b5e5 100644 --- a/community_server/src/Controller/AppController.php +++ b/community_server/src/Controller/AppController.php @@ -223,22 +223,22 @@ class AppController extends Controller $public_key_bin = hex2bin($json['user']['public_hex']); $stateUserQuery = $stateUserTable ->find('all') - ->where(['public_key' => $public_key_bin]) + ->where(['pubkey' => $public_key_bin]) ->contain('StateBalances', function ($q) { return $q->order(['record_date' => 'DESC']) ->limit(1); }); if ($stateUserQuery->count() == 1) { $stateUser = $stateUserQuery->first(); - if ($stateUser->first_name != $json['user']['first_name'] || - $stateUser->last_name != $json['user']['last_name'] || + if ($stateUser->firstName != $json['user']['first_name'] || + $stateUser->lastName != $json['user']['last_name'] || $stateUser->disabled != $json['user']['disabled'] || //$stateUser->username != $json['user']['username'] || // -> throws error $stateUser->email != $json['user']['email'] ) { - $stateUser->first_name = $json['user']['first_name']; - $stateUser->last_name = $json['user']['last_name']; + $stateUser->firstName = $json['user']['first_name']; + $stateUser->lastName = $json['user']['last_name']; $stateUser->disabled = intval($json['user']['disabled']); //$stateUser->username = $json['user']['username']; $stateUser->email = $json['user']['email']; @@ -250,9 +250,9 @@ class AppController extends Controller //echo $stateUser['id']; } else { $newStateUser = $stateUserTable->newEntity(); - $newStateUser->public_key = $public_key_bin; - $newStateUser->first_name = $json['user']['first_name']; - $newStateUser->last_name = $json['user']['last_name']; + $newStateUser->pubkey = $public_key_bin; + $newStateUser->firstName = $json['user']['first_name']; + $newStateUser->lastName = $json['user']['last_name']; $newStateUser->disabled = intval($json['user']['disabled']); //$newStateUser->username = $json['user']['username']; $newStateUser->email = $json['user']['email']; diff --git a/community_server/src/Controller/JsonRequestHandlerController.php b/community_server/src/Controller/JsonRequestHandlerController.php index 611984118..150cce4ae 100644 --- a/community_server/src/Controller/JsonRequestHandlerController.php +++ b/community_server/src/Controller/JsonRequestHandlerController.php @@ -308,7 +308,7 @@ class JsonRequestHandlerController extends AppController { $stateError = $stateErrorTable->newEntity(); // $pubkey = hex2bin($jsonData->public_key); - $user_query = $stateUsersTable->find('all')->select(['id'])->where(['public_key' => $pubkey]); + $user_query = $stateUsersTable->find('all')->select(['id'])->where(['pubkey' => $pubkey]); if($user_query->count() != 1) { return $this->returnJson(['state' => 'error', 'msg' => 'user not found', 'details' => 'user pubkey hex:' . $jsonData->public_key]); } @@ -412,7 +412,7 @@ class JsonRequestHandlerController extends AppController { //$pubkeys->sender //$pubkeys->receiver $stateUserTable = TableRegistry::getTableLocator()->get('StateUsers'); - $user = $stateUserTable->find('all')->where(['public_key' => hex2bin($pubkeys->sender)])->contain(['StateBalances']); + $user = $stateUserTable->find('all')->where(['pubkey' => hex2bin($pubkeys->sender)])->contain(['StateBalances']); if(!$user->count()) { return $this->returnJson(['state' => 'not found', 'msg' => 'user not found or empty balance']); } @@ -461,7 +461,7 @@ class JsonRequestHandlerController extends AppController { private function userDelete($userPubkeyHex) { $stateUserTable = TableRegistry::getTableLocator()->get('StateUsers'); - $user = $stateUserTable->find('all')->where(['public_key' => hex2bin($userPubkeyHex)]); + $user = $stateUserTable->find('all')->where(['pubkey' => hex2bin($userPubkeyHex)]); if(!$user || $user->count == 0) { return $this->returnJson(['state' => 'error', 'msg' => 'user not found']); } diff --git a/community_server/src/Controller/StateUserRolesController.php b/community_server/src/Controller/StateUserRolesController.php index 9238c7ad6..80b168f35 100644 --- a/community_server/src/Controller/StateUserRolesController.php +++ b/community_server/src/Controller/StateUserRolesController.php @@ -132,7 +132,7 @@ class StateUserRolesController extends AppController $public_hex = hex2bin($requestData['public_hex']); - $stateUser = $this->StateUsers->find('all')->where(['public_key' => $public_hex])->first(); + $stateUser = $this->StateUsers->find('all')->where(['pubkey' => $public_hex])->first(); foreach($requestData['role_id'] as $role_id) { @@ -158,7 +158,7 @@ class StateUserRolesController extends AppController $publichex = hex2bin($public_hex); - $stateUser = $this->StateUsers->find('all')->where(['public_key' => $publichex])->first(); + $stateUser = $this->StateUsers->find('all')->where(['pubkey' => $publichex])->first(); $stateUserRoles = $this->StateUserRoles->find('all')->where(['state_user_id' => $stateUser->id])->all(); diff --git a/community_server/src/Controller/StateUsersController.php b/community_server/src/Controller/StateUsersController.php index fc6ec8614..25171f462 100644 --- a/community_server/src/Controller/StateUsersController.php +++ b/community_server/src/Controller/StateUsersController.php @@ -182,15 +182,15 @@ class StateUsersController extends AppController if($account_state == 'email not activated') { if(count($pubkeySorted) > 0) { - $communityUsers->where(['hex(public_key) IN' => array_keys($pubkeySorted)]); + $communityUsers->where(['hex(pubkey) IN' => array_keys($pubkeySorted)]); } else { $communityUsers = null; } } else { $globalSearch = '%' . $searchString . '%'; $communityUsers->where(['OR' => [ - 'first_name LIKE' => $globalSearch, - 'last_name LIKE' => $globalSearch, + 'firstName LIKE' => $globalSearch, + 'lastName LIKE' => $globalSearch, 'email LIKE' => $globalSearch ]]); } @@ -199,7 +199,7 @@ class StateUsersController extends AppController //var_dump($communityUsers->toArray()); if($communityUsers) { foreach($communityUsers as $u) { - $pubkey_hex = bin2hex(stream_get_contents($u->public_key)); + $pubkey_hex = bin2hex(stream_get_contents($u->pubkey)); $u->public_hex = $pubkey_hex; if(!isset($pubkeySorted[$pubkey_hex])) { $pubkeySorted[$pubkey_hex] = ['login' => [], 'community' => []]; @@ -229,9 +229,9 @@ class StateUsersController extends AppController $color = 'danger'; if(count($user['community']) == 1) { $c_user = $user['community'][0]; - $finalUser['name'] = $c_user->first_name . ' ' . $c_user->last_name; - $finalUser['first_name'] = $c_user->first_name; - $finalUser['last_name'] = $c_user->last_name; + $finalUser['name'] = $c_user->firstName . ' ' . $c_user->lastName; + $finalUser['first_name'] = $c_user->firstName; + $finalUser['last_name'] = $c_user->lastName; $finalUser['email'] = $c_user->email; } } else if(count($user['login']) == 1) { @@ -415,7 +415,7 @@ class StateUsersController extends AppController //$user = $jsonData['user']; //var_dump($jsonData); $pubkey = hex2bin($jsonData['pubkeyhex']); - $stateUsers = $this->StateUsers->find('all')->where(['public_key' => $pubkey]); + $stateUsers = $this->StateUsers->find('all')->where(['pubkey' => $pubkey]); if($stateUsers->count() != 1) { return $this->returnJson(['state' => 'error', 'msg' => 'invalid result count']); } @@ -448,7 +448,7 @@ class StateUsersController extends AppController $pubkey = hex2bin($jsonData['pubkeyhex']); $stateUsers = $this->StateUsers ->find('all') - ->where(['public_key' => $pubkey]) + ->where(['pubkey' => $pubkey]) ->select(['id']); if($stateUsers->count() != 1) { return $this->returnJson(['state' => 'error', 'msg' => 'invalid result count']); diff --git a/community_server/src/Controller/TransactionCreationsController.php b/community_server/src/Controller/TransactionCreationsController.php index d02320d25..f024e5cb4 100644 --- a/community_server/src/Controller/TransactionCreationsController.php +++ b/community_server/src/Controller/TransactionCreationsController.php @@ -101,7 +101,7 @@ class TransactionCreationsController extends AppController $receiverProposal = []; foreach ($stateUsers as $stateUser) { $name = $stateUser->email; - $keyHex = bin2hex(stream_get_contents($stateUser->public_key)); + $keyHex = bin2hex(stream_get_contents($stateUser->pubkey)); if ($name === null) { $name = $stateUser->first_name . ' ' . $stateUser->last_name; } @@ -241,14 +241,14 @@ class TransactionCreationsController extends AppController $this->log("search for text: ".$requestData['searchText'], 'debug'); $stateUsers = $stateUserTable ->find('all') - ->select(['id', 'first_name', 'last_name', 'email']) - ->order(['first_name', 'last_name']) + ->select(['id', 'firstName', 'lastName', 'email']) + ->order(['firstName', 'lastName']) ->where( ['AND' => [ 'disabled' => 0, 'OR' => [ - 'LOWER(first_name) LIKE' => '%'.strtolower($requestData['searchText']).'%', - 'LOWER(last_name) LIKE' => '%'.strtolower($requestData['searchText']).'%', + 'LOWER(firstName) LIKE' => '%'.strtolower($requestData['searchText']).'%', + 'LOWER(lastName) LIKE' => '%'.strtolower($requestData['searchText']).'%', 'LOWER(email) LIKE' => '%'.strtolower($requestData['searchText']).'%' ] ] @@ -265,10 +265,10 @@ class TransactionCreationsController extends AppController } else { $stateUsers = $stateUserTable ->find('all') - ->select(['id', 'first_name', 'last_name', 'email']) + ->select(['id', 'firstName', 'lastName', 'email']) //->order(['id']) ->where(['disabled' => 0]) - ->order(['first_name', 'last_name']) + ->order(['firstName', 'lastName']) ->contain(['TransactionCreations' => [ 'fields' => [ 'TransactionCreations.amount', @@ -300,7 +300,7 @@ class TransactionCreationsController extends AppController //if($sumAmount < 20000000) { array_push($possibleReceivers, [ - 'name' => $stateUser->first_name . ' ' . $stateUser->last_name, + 'name' => $stateUser->firstName . ' ' . $stateUser->lastName, 'id' => $stateUser->id, 'email' => $stateUser->email, 'amount' => $sumAmount, @@ -353,7 +353,7 @@ class TransactionCreationsController extends AppController } $receiverUsers = $stateUserTable->find('all') ->where(['id IN' => array_keys($users)]) - ->select(['public_key', 'email', 'id']) + ->select(['pubkey', 'email', 'id']) ->contain(false); foreach ($receiverUsers as $receiverUser) { @@ -371,7 +371,7 @@ class TransactionCreationsController extends AppController } else { $pendings[$id] = $localAmountCent; } - $pubKeyHex = bin2hex(stream_get_contents($receiverUser->public_key)); + $pubKeyHex = bin2hex(stream_get_contents($receiverUser->pubkey)); $requestAnswear = $this->JsonRequestClient->sendRequest(json_encode([ 'session_id' => $session->read('session_id'), 'email' => $receiverUser->email, diff --git a/community_server/src/Model/Entity/StateUser.php b/community_server/src/Model/Entity/StateUser.php index 5fac7cda7..374e8d608 100644 --- a/community_server/src/Model/Entity/StateUser.php +++ b/community_server/src/Model/Entity/StateUser.php @@ -30,16 +30,14 @@ class StateUser extends Entity * @var array */ protected $_accessible = [ - 'index_id' => true, - 'state_group_id' => true, - 'public_key' => true, + 'groupId' => true, + 'pubkey' => true, 'email' => true, - 'first_name' => true, - 'last_name' => true, + 'firstName' => true, + 'lastName' => true, 'disabled' => true, 'username' => true, 'index' => true, - 'state_group' => true, 'state_balances' => true, 'state_created' => true, 'transaction_creations' => true, @@ -48,11 +46,11 @@ class StateUser extends Entity public function getEmailWithName() { - return $this->first_name . ' ' . $this->last_name . ' <' . $this->email . '>'; + return $this->firstName . ' ' . $this->lastName . ' <' . $this->email . '>'; } public function getNames() { - return $this->first_name . ' ' . $this->last_name; + return $this->firstName . ' ' . $this->lastName; } } diff --git a/community_server/src/Model/Table/StateUsersTable.php b/community_server/src/Model/Table/StateUsersTable.php index 5b01609f3..729b7800a 100644 --- a/community_server/src/Model/Table/StateUsersTable.php +++ b/community_server/src/Model/Table/StateUsersTable.php @@ -37,18 +37,10 @@ class StateUsersTable extends Table { parent::initialize($config); - $this->setTable('state_users'); + $this->setTable('user'); $this->setDisplayField('email'); $this->setPrimaryKey('id'); - /*$this->belongsTo('Indices', [ - 'foreignKey' => 'index_id', - 'joinType' => 'INNER' - ]);*/ - $this->belongsTo('StateGroups', [ - 'foreignKey' => 'state_group_id', - 'joinType' => 'INNER' - ]); $this->hasMany('StateBalances', [ 'foreignKey' => 'state_user_id' ]); @@ -80,8 +72,8 @@ class StateUsersTable extends Table ->allowEmptyString('id', null, 'create'); $validator - ->requirePresence('public_key', 'create') - ->notEmptyString('public_key'); + ->requirePresence('pubkey', 'create') + ->notEmptyString('pubkey'); return $validator; } @@ -124,7 +116,7 @@ class StateUsersTable extends Table $involvedUser = $this->find('all', [ 'contain' => [], 'where' => ['id IN' => $involvedUserIds], - 'fields' => ['id', 'first_name', 'last_name', 'email'], + 'fields' => ['id', 'firstName', 'lastName', 'email'], ]); //var_dump($involvedUser->toArray()); $involvedUserIndices = []; diff --git a/community_server/src/Model/Transactions/TransactionBase.php b/community_server/src/Model/Transactions/TransactionBase.php index 6b3817201..8c2709a96 100644 --- a/community_server/src/Model/Transactions/TransactionBase.php +++ b/community_server/src/Model/Transactions/TransactionBase.php @@ -49,13 +49,13 @@ class TransactionBase { protected function getStateUserId($publicKey) { $stateUsersTable = self::getTable('state_users'); - $stateUser = $stateUsersTable->find('all')->select(['id'])->where(['public_key' => $publicKey])->first(); + $stateUser = $stateUsersTable->find('all')->select(['id'])->where(['pubkey' => $publicKey])->first(); if($stateUser) { return $stateUser->id; } // create new entry $stateUserEntity = $stateUsersTable->newEntity(); - $stateUserEntity->public_key = $publicKey; + $stateUserEntity->pubkey = $publicKey; if($stateUsersTable->save($stateUserEntity)) { return $stateUserEntity->id; } else { @@ -77,7 +77,7 @@ class TransactionBase { protected function getStateUserFromPublickey($publicKey) { $stateUsersTable = self::getTable('state_users'); - $stateUser = $stateUsersTable->find('all')->where(['public_key' => $publicKey])->first(); + $stateUser = $stateUsersTable->find('all')->where(['pubkey' => $publicKey])->first(); if($stateUser) { return $stateUser; } diff --git a/community_server/src/Model/Transactions/TransactionCreation.php b/community_server/src/Model/Transactions/TransactionCreation.php index 87f2d2104..a8263c60d 100644 --- a/community_server/src/Model/Transactions/TransactionCreation.php +++ b/community_server/src/Model/Transactions/TransactionCreation.php @@ -95,7 +95,7 @@ class TransactionCreation extends TransactionBase { $existingCreations2 = $this->transactionCreationsTable ->find('all') ->select(['amount', 'state_user_id', 'target_date']) - ->contain(['StateUsers' => ['fields' => ['StateUsers.public_key']]]); + ->contain(['StateUsers' => ['fields' => ['StateUsers.pubkey']]]); $q = $existingCreations2; $targetDate = $this->protoTransactionCreation->getTargetDate(); @@ -230,7 +230,7 @@ class TransactionCreation extends TransactionBase { $receiverAmount = new \Proto\Gradido\TransferAmount(); - $receiverAmount->setPubkey(stream_get_contents($stateUser->public_key)); + $receiverAmount->setPubkey(stream_get_contents($stateUser->pubkey)); $receiverAmount->setAmount($transactionCreationEntity->amount); $protoCreation->setReceiver($receiverAmount); diff --git a/community_server/src/Model/Transactions/TransactionTransfer.php b/community_server/src/Model/Transactions/TransactionTransfer.php index dc1606f55..2bd470e73 100644 --- a/community_server/src/Model/Transactions/TransactionTransfer.php +++ b/community_server/src/Model/Transactions/TransactionTransfer.php @@ -96,7 +96,7 @@ class TransactionTransfer extends TransactionBase { $user = $stateUsersTable ->find('all') ->select(['id']) - ->where(['public_key' => $senderPublic]) + ->where(['pubkey' => $senderPublic]) ->contain(['StateBalances' => ['fields' => ['amount', 'state_user_id']]])->first(); if(!$user) { $this->addError($functionName, 'couldn\'t find sender in db' ); @@ -114,7 +114,7 @@ class TransactionTransfer extends TransactionBase { return false; } // check if receiver exist - $receiver_user = $stateUsersTable->find('all')->select(['id'])->where(['public_key' => $receiver_public_key])->first(); + $receiver_user = $stateUsersTable->find('all')->select(['id'])->where(['pubkey' => $receiver_public_key])->first(); if(!$receiver_user) { $this->addError($functionName, 'couldn\'t find receiver in db' ); return false; diff --git a/database/migrations/0002-update_user.ts b/database/migrations/0002-update_user.ts new file mode 100644 index 000000000..54e6acc7e --- /dev/null +++ b/database/migrations/0002-update_user.ts @@ -0,0 +1,56 @@ +/* FIRST MIGRATION + * + * This migration is special since it takes into account that + * the database can be setup already but also may not be. + * Therefore you will find all `CREATE TABLE` statements with + * a `IF NOT EXISTS`, all `INSERT` with an `IGNORE` and in the + * downgrade function all `DROP TABLE` with a `IF EXISTS`. + * This ensures compatibility for existing or non-existing + * databases. + */ + +export async function upgrade(queryFn: (query: string, values?: any[]) => Promise>) { + // write upgrade logic as parameter of queryFn + + // rename table + await queryFn(` + ALTER TABLE state_users + RENAME TO user; + `) + // drop not used columns + await queryFn(` + ALTER TABLE user + DROP COLUMN index_id; + `) + // rename from snake case to camel case (cakePHP standard to typeorm standard) + await queryFn(` + ALTER TABLE user + CHANGE COLUMN group_id groupId int(10) unsigned NOT NULL DEFAULT '0', + CHANGE COLUMN public_key pubkey binary(32) NOT NULL, + CHANGE COLUMN first_name firstName varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + CHANGE COLUMN last_name lastName varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL; + `) + } + + export async function downgrade(queryFn: (query: string, values?: any[]) => Promise>) { + // write downgrade logic as parameter of queryFn + // rename table + await queryFn(` + ALTER TABLE user + RENAME TO state_users; + `) + // put back dropped column + await queryFn(` + ALTER TABLE state_users + ADD index_id smallint(6) NOT NULL DEFAULT '0'; + `) + // rename from camel case to snake case (typeorm standard to cakePHP standard) + await queryFn(` + ALTER TABLE state_users + CHANGE COLUMN groupId group_id int(10) unsigned NOT NULL DEFAULT '0', + CHANGE COLUMN pubkey public_key binary(32) NOT NULL, + CHANGE COLUMN firstName first_name varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + CHANGE COLUMN lastName last_name varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL; + `) + } + \ No newline at end of file From 95cb6a5bb8783dc499d897c5d596efa25b6c17be Mon Sep 17 00:00:00 2001 From: Einhornimmond Date: Fri, 17 Sep 2021 21:34:04 +0200 Subject: [PATCH 43/93] fix linting and community server test --- ...{StateUsersFixture.php => UserFixture.php} | 19 +++++---- .../JsonRequestHandlerControllerTest.php | 2 +- database/migrations/0002-update_user.ts | 39 +++++++++---------- 3 files changed, 29 insertions(+), 31 deletions(-) rename community_server/tests/Fixture/{StateUsersFixture.php => UserFixture.php} (55%) diff --git a/community_server/tests/Fixture/StateUsersFixture.php b/community_server/tests/Fixture/UserFixture.php similarity index 55% rename from community_server/tests/Fixture/StateUsersFixture.php rename to community_server/tests/Fixture/UserFixture.php index a9b033bf7..e6d59a238 100644 --- a/community_server/tests/Fixture/StateUsersFixture.php +++ b/community_server/tests/Fixture/UserFixture.php @@ -6,7 +6,7 @@ use Cake\TestSuite\Fixture\TestFixture; /** * StateUsersFixture */ -class StateUsersFixture extends BaseTestFixture +class UserFixture extends BaseTestFixture { /** * Fields @@ -16,17 +16,16 @@ class StateUsersFixture extends BaseTestFixture // @codingStandardsIgnoreStart public $fields = [ 'id' => ['type' => 'integer', 'length' => 10, 'unsigned' => true, 'null' => false, 'default' => null, 'comment' => '', 'autoIncrement' => true, 'precision' => null], - 'index_id' => ['type' => 'smallinteger', 'length' => 6, 'unsigned' => false, 'null' => false, 'default' => '0', 'comment' => '', 'precision' => null], - 'group_id' => ['type' => 'integer', 'length' => 10, 'unsigned' => true, 'null' => false, 'default' => '0', 'comment' => '', 'precision' => null, 'autoIncrement' => null], - 'public_key' => ['type' => 'binary', 'length' => 32, 'null' => false, 'default' => null, 'comment' => '', 'precision' => null], + 'groupId' => ['type' => 'integer', 'length' => 10, 'unsigned' => true, 'null' => false, 'default' => '0', 'comment' => '', 'precision' => null, 'autoIncrement' => null], + 'pubkey' => ['type' => 'binary', 'length' => 32, 'null' => false, 'default' => null, 'comment' => '', 'precision' => null], 'email' => ['type' => 'string', 'length' => 255, 'null' => true, 'default' => null, 'collate' => 'utf8mb4_unicode_ci', 'comment' => '', 'precision' => null, 'fixed' => null], - 'first_name' => ['type' => 'string', 'length' => 255, 'null' => true, 'default' => null, 'collate' => 'utf8mb4_unicode_ci', 'comment' => '', 'precision' => null, 'fixed' => null], - 'last_name' => ['type' => 'string', 'length' => 255, 'null' => true, 'default' => null, 'collate' => 'utf8mb4_unicode_ci', 'comment' => '', 'precision' => null, 'fixed' => null], + 'firstNname' => ['type' => 'string', 'length' => 255, 'null' => true, 'default' => null, 'collate' => 'utf8mb4_unicode_ci', 'comment' => '', 'precision' => null, 'fixed' => null], + 'lastName' => ['type' => 'string', 'length' => 255, 'null' => true, 'default' => null, 'collate' => 'utf8mb4_unicode_ci', 'comment' => '', 'precision' => null, 'fixed' => null], 'username' => ['type' => 'string', 'length' => 255, 'null' => true, 'default' => null, 'collate' => 'utf8mb4_unicode_ci', 'comment' => '', 'precision' => null, 'fixed' => null], 'disabled' => ['type' => 'tinyinteger', 'length' => 4, 'unsigned' => false, 'null' => true, 'default' => '0', 'comment' => '', 'precision' => null], '_constraints' => [ 'primary' => ['type' => 'primary', 'columns' => ['id'], 'length' => []], - 'public_key' => ['type' => 'unique', 'columns' => ['public_key'], 'length' => []], + 'pubkey' => ['type' => 'unique', 'columns' => ['pubkey'], 'length' => []], ], '_options' => [ 'engine' => 'InnoDB', @@ -44,9 +43,9 @@ class StateUsersFixture extends BaseTestFixture public function init() { $sql_entrys = [ - [1, 0, 0, 'f7f4a49a4ac10379f8b9ddcb731c4d9ec495e6edd16075f52672cd25e3179f0f', 'test1.gmail.de', 'Max', 'Mustermann', NULL, 0], - [3, 0, 0, '131c7f68dd94b2be4c913400ff7ff4cdc03ac2bda99c2d29edcacb3b065c67e6', 'test2.gmail.com', 'Ines', 'Mustermann', NULL, 0], - [4, 0, 0, 'e3369de3623ce8446d0424c4013e7a1d71a2671ae3d7bf1e798ebf0665d145f2', 'test3.yahoo.com', 'Samuel', 'Schmied', NULL, 0] + [1, 0, 'f7f4a49a4ac10379f8b9ddcb731c4d9ec495e6edd16075f52672cd25e3179f0f', 'test1.gmail.de', 'Max', 'Mustermann', NULL, 0], + [3, 0, '131c7f68dd94b2be4c913400ff7ff4cdc03ac2bda99c2d29edcacb3b065c67e6', 'test2.gmail.com', 'Ines', 'Mustermann', NULL, 0], + [4, 0, 'e3369de3623ce8446d0424c4013e7a1d71a2671ae3d7bf1e798ebf0665d145f2', 'test3.yahoo.com', 'Samuel', 'Schmied', NULL, 0] ]; $this->records = $this->sqlEntrysToRecords($sql_entrys, $this->fields); parent::init(); diff --git a/community_server/tests/TestCase/Controller/JsonRequestHandlerControllerTest.php b/community_server/tests/TestCase/Controller/JsonRequestHandlerControllerTest.php index f990b3e57..496e7e3c5 100644 --- a/community_server/tests/TestCase/Controller/JsonRequestHandlerControllerTest.php +++ b/community_server/tests/TestCase/Controller/JsonRequestHandlerControllerTest.php @@ -21,7 +21,7 @@ class JsonRequestHandlerControllerTest extends TestCase public $fixtures = [ 'app.TransactionCreations', 'app.Transactions', - 'app.StateUsers', + 'app.User', 'app.StateUserTransactions', 'app.StateErrors', 'app.TransactionSignatures', diff --git a/database/migrations/0002-update_user.ts b/database/migrations/0002-update_user.ts index 54e6acc7e..d23beab90 100644 --- a/database/migrations/0002-update_user.ts +++ b/database/migrations/0002-update_user.ts @@ -10,47 +10,46 @@ */ export async function upgrade(queryFn: (query: string, values?: any[]) => Promise>) { - // write upgrade logic as parameter of queryFn - - // rename table - await queryFn(` + // write upgrade logic as parameter of queryFn + + // rename table + await queryFn(` ALTER TABLE state_users RENAME TO user; `) - // drop not used columns - await queryFn(` + // drop not used columns + await queryFn(` ALTER TABLE user DROP COLUMN index_id; `) - // rename from snake case to camel case (cakePHP standard to typeorm standard) - await queryFn(` + // rename from snake case to camel case (cakePHP standard to typeorm standard) + await queryFn(` ALTER TABLE user CHANGE COLUMN group_id groupId int(10) unsigned NOT NULL DEFAULT '0', CHANGE COLUMN public_key pubkey binary(32) NOT NULL, CHANGE COLUMN first_name firstName varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, CHANGE COLUMN last_name lastName varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL; `) - } - - export async function downgrade(queryFn: (query: string, values?: any[]) => Promise>) { - // write downgrade logic as parameter of queryFn - // rename table - await queryFn(` +} + +export async function downgrade(queryFn: (query: string, values?: any[]) => Promise>) { + // write downgrade logic as parameter of queryFn + // rename table + await queryFn(` ALTER TABLE user RENAME TO state_users; `) - // put back dropped column - await queryFn(` + // put back dropped column + await queryFn(` ALTER TABLE state_users ADD index_id smallint(6) NOT NULL DEFAULT '0'; `) - // rename from camel case to snake case (typeorm standard to cakePHP standard) - await queryFn(` + // rename from camel case to snake case (typeorm standard to cakePHP standard) + await queryFn(` ALTER TABLE state_users CHANGE COLUMN groupId group_id int(10) unsigned NOT NULL DEFAULT '0', CHANGE COLUMN pubkey public_key binary(32) NOT NULL, CHANGE COLUMN firstName first_name varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, CHANGE COLUMN lastName last_name varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL; `) - } - \ No newline at end of file +} From 8d668aebdc60b257b8879b1fac8a0e422e03c704 Mon Sep 17 00:00:00 2001 From: Einhornimmond Date: Fri, 17 Sep 2021 21:49:23 +0200 Subject: [PATCH 44/93] fix test --- .../tests/TestCase/Controller/AdminErrorsControllerTest.php | 2 +- .../tests/TestCase/Controller/ProfilesControllerTest.php | 2 +- .../tests/TestCase/Controller/StateBalancesControllerTest.php | 2 +- .../tests/TestCase/Controller/StateErrorsControllerTest.php | 2 +- .../TestCase/Controller/StateUserTransactionsControllerTest.php | 2 +- .../TestCase/Controller/TransactionCreationsControllerTest.php | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/community_server/tests/TestCase/Controller/AdminErrorsControllerTest.php b/community_server/tests/TestCase/Controller/AdminErrorsControllerTest.php index a9044b4ae..04aee90fa 100644 --- a/community_server/tests/TestCase/Controller/AdminErrorsControllerTest.php +++ b/community_server/tests/TestCase/Controller/AdminErrorsControllerTest.php @@ -21,7 +21,7 @@ class AdminErrorsControllerTest extends TestCase */ public $fixtures = [ 'app.AdminErrors', - 'app.StateUsers' + 'app.User' ]; /** diff --git a/community_server/tests/TestCase/Controller/ProfilesControllerTest.php b/community_server/tests/TestCase/Controller/ProfilesControllerTest.php index d87558e55..77e2576ef 100644 --- a/community_server/tests/TestCase/Controller/ProfilesControllerTest.php +++ b/community_server/tests/TestCase/Controller/ProfilesControllerTest.php @@ -20,7 +20,7 @@ class ProfilesControllerTest extends TestCase * @var array */ public $fixtures = [ - 'app.StateUsers', + 'app.User', 'app.CommunityProfiles', ]; diff --git a/community_server/tests/TestCase/Controller/StateBalancesControllerTest.php b/community_server/tests/TestCase/Controller/StateBalancesControllerTest.php index 9ef8d28e9..f533f344e 100644 --- a/community_server/tests/TestCase/Controller/StateBalancesControllerTest.php +++ b/community_server/tests/TestCase/Controller/StateBalancesControllerTest.php @@ -24,7 +24,7 @@ class StateBalancesControllerTest extends TestCase public $fixtures = [ 'app.TransactionCreations', 'app.Transactions', - 'app.StateUsers', + 'app.User', 'app.StateUserTransactions', 'app.StateErrors', 'app.TransactionSignatures', diff --git a/community_server/tests/TestCase/Controller/StateErrorsControllerTest.php b/community_server/tests/TestCase/Controller/StateErrorsControllerTest.php index 452af54fc..df45ff59d 100644 --- a/community_server/tests/TestCase/Controller/StateErrorsControllerTest.php +++ b/community_server/tests/TestCase/Controller/StateErrorsControllerTest.php @@ -21,7 +21,7 @@ class StateErrorsControllerTest extends TestCase */ public $fixtures = [ 'app.StateErrors', - 'app.StateUsers', + 'app.User', 'app.TransactionTypes' ]; diff --git a/community_server/tests/TestCase/Controller/StateUserTransactionsControllerTest.php b/community_server/tests/TestCase/Controller/StateUserTransactionsControllerTest.php index 0c9e0a513..39be9ec66 100644 --- a/community_server/tests/TestCase/Controller/StateUserTransactionsControllerTest.php +++ b/community_server/tests/TestCase/Controller/StateUserTransactionsControllerTest.php @@ -21,7 +21,7 @@ class StateUserTransactionsControllerTest extends TestCase */ public $fixtures = [ 'app.StateUserTransactions', - 'app.StateUsers', + 'app.User', 'app.Transactions', 'app.TransactionTypes', ]; diff --git a/community_server/tests/TestCase/Controller/TransactionCreationsControllerTest.php b/community_server/tests/TestCase/Controller/TransactionCreationsControllerTest.php index 74c0e4b1e..7a34c52a5 100644 --- a/community_server/tests/TestCase/Controller/TransactionCreationsControllerTest.php +++ b/community_server/tests/TestCase/Controller/TransactionCreationsControllerTest.php @@ -22,7 +22,7 @@ class TransactionCreationsControllerTest extends TestCase public $fixtures = [ 'app.TransactionCreations', 'app.Transactions', - 'app.StateUsers' + 'app.User' ]; /** From e6d386c5984898985449599f862b1997614946f0 Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Mon, 20 Sep 2021 11:22:00 +0200 Subject: [PATCH 45/93] refactor: Queries to Mutations --- backend/src/graphql/resolvers/UserResolver.ts | 6 ++-- .../src/components/LanguageSwitch.spec.js | 8 ++--- frontend/src/components/LanguageSwitch.vue | 6 ++-- frontend/src/graphql/mutations.js | 32 +++++++++++++++++++ frontend/src/graphql/queries.js | 32 ------------------- .../src/views/Pages/ResetPassword.spec.js | 8 +++-- frontend/src/views/Pages/ResetPassword.vue | 7 ++-- .../UserProfile/UserCard_FormUserData.spec.js | 2 +- .../UserProfile/UserCard_FormUserData.vue | 6 ++-- .../UserProfile/UserCard_FormUserMail.spec.js | 2 +- .../UserProfile/UserCard_FormUserMail.vue | 6 ++-- .../UserCard_FormUserPasswort.spec.js | 2 +- .../UserProfile/UserCard_FormUserPasswort.vue | 6 ++-- .../UserProfile/UserCard_FormUsername.spec.js | 2 +- .../UserProfile/UserCard_FormUsername.vue | 6 ++-- .../UserProfile/UserCard_Language.spec.js | 2 +- .../Pages/UserProfile/UserCard_Language.vue | 6 ++-- 17 files changed, 71 insertions(+), 68 deletions(-) diff --git a/backend/src/graphql/resolvers/UserResolver.ts b/backend/src/graphql/resolvers/UserResolver.ts index 7e618cf42..93172875c 100644 --- a/backend/src/graphql/resolvers/UserResolver.ts +++ b/backend/src/graphql/resolvers/UserResolver.ts @@ -1,7 +1,7 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ /* eslint-disable @typescript-eslint/explicit-module-boundary-types */ -import { Resolver, Query, Args, Arg, Authorized, Ctx, UseMiddleware } from 'type-graphql' +import { Resolver, Query, Args, Arg, Authorized, Ctx, UseMiddleware, Mutation } from 'type-graphql' import CONFIG from '../../config' import { CheckUsernameResponse } from '../models/CheckUsernameResponse' import { LoginViaVerificationCode } from '../models/LoginViaVerificationCode' @@ -104,7 +104,7 @@ export class UserResolver { return new SendPasswordResetEmailResponse(response.data) } - @Query(() => String) + @Mutation(() => String) async resetPassword( @Args() { sessionId, email, password }: ChangePasswordArgs, @@ -122,7 +122,7 @@ export class UserResolver { } @Authorized() - @Query(() => UpdateUserInfosResponse) + @Mutation(() => UpdateUserInfosResponse) async updateUserInfos( @Args() { diff --git a/frontend/src/components/LanguageSwitch.spec.js b/frontend/src/components/LanguageSwitch.spec.js index afe98b357..dc76d854b 100644 --- a/frontend/src/components/LanguageSwitch.spec.js +++ b/frontend/src/components/LanguageSwitch.spec.js @@ -3,7 +3,7 @@ import LanguageSwitch from './LanguageSwitch' const localVue = global.localVue -const updateUserInfosQueryMock = jest.fn().mockResolvedValue({ +const updateUserInfosMutationMock = jest.fn().mockResolvedValue({ data: { updateUserInfos: { validValues: 1, @@ -28,7 +28,7 @@ describe('LanguageSwitch', () => { locale: 'en', }, $apollo: { - query: updateUserInfosQueryMock, + mutate: updateUserInfosMutationMock, }, } @@ -119,7 +119,7 @@ describe('LanguageSwitch', () => { describe('calls the API', () => { it("with locale 'en'", () => { wrapper.findAll('li').at(0).find('a').trigger('click') - expect(updateUserInfosQueryMock).toBeCalledWith( + expect(updateUserInfosMutationMock).toBeCalledWith( expect.objectContaining({ variables: { email: 'he@ho.he', @@ -131,7 +131,7 @@ describe('LanguageSwitch', () => { it("with locale 'de'", () => { wrapper.findAll('li').at(1).find('a').trigger('click') - expect(updateUserInfosQueryMock).toBeCalledWith( + expect(updateUserInfosMutationMock).toBeCalledWith( expect.objectContaining({ variables: { email: 'he@ho.he', diff --git a/frontend/src/components/LanguageSwitch.vue b/frontend/src/components/LanguageSwitch.vue index f0528a935..14894e46e 100644 --- a/frontend/src/components/LanguageSwitch.vue +++ b/frontend/src/components/LanguageSwitch.vue @@ -14,7 +14,7 @@ From a0b35dad239cc7b83965401e64b7f1f6339d597d Mon Sep 17 00:00:00 2001 From: elweyn Date: Wed, 22 Sep 2021 11:36:30 +0200 Subject: [PATCH 62/93] Changed the method name to something a bit more meaningfull. --- frontend/src/views/Pages/UserProfile/UserCard_Language.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/src/views/Pages/UserProfile/UserCard_Language.vue b/frontend/src/views/Pages/UserProfile/UserCard_Language.vue index e0b5c3a72..055441aec 100644 --- a/frontend/src/views/Pages/UserProfile/UserCard_Language.vue +++ b/frontend/src/views/Pages/UserProfile/UserCard_Language.vue @@ -23,7 +23,7 @@ {{ $t('language') }} - {{ $t(buildLanguage()) }} + {{ $t(buildTagFromLanguageString()) }} @@ -106,7 +106,7 @@ export default { }) }, - buildLanguage() { + buildTagFromLanguageString() { return 'languages.' + this.$store.state.language }, }, From 3ca200bb96b9cc3dcc3a8e6c656e5d0b2df9c11f Mon Sep 17 00:00:00 2001 From: elweyn Date: Wed, 22 Sep 2021 12:12:28 +0200 Subject: [PATCH 63/93] Added a success message in case where language has been switched. --- frontend/src/locales/de.json | 3 ++- frontend/src/locales/en.json | 3 ++- frontend/src/views/Pages/UserProfile/UserCard_Language.vue | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/frontend/src/locales/de.json b/frontend/src/locales/de.json index 851f2a376..5db1c0a82 100644 --- a/frontend/src/locales/de.json +++ b/frontend/src/locales/de.json @@ -105,7 +105,8 @@ "language": "Sprache", "languages": { "de": "Deutsch", - "en": "English" + "en": "English", + "success": "Deine Sprache wurde erfolgreich geändert." }, "login": "Anmeldung", "logout": "Abmelden", diff --git a/frontend/src/locales/en.json b/frontend/src/locales/en.json index 4edf8e72d..9ca544440 100644 --- a/frontend/src/locales/en.json +++ b/frontend/src/locales/en.json @@ -105,7 +105,8 @@ "language": "Language", "languages": { "de": "Deutsch", - "en": "English" + "en": "English", + "success": "Your language has been successfully updated." }, "login": "Login", "logout": "Logout", diff --git a/frontend/src/views/Pages/UserProfile/UserCard_Language.vue b/frontend/src/views/Pages/UserProfile/UserCard_Language.vue index 055441aec..1bf9a8415 100644 --- a/frontend/src/views/Pages/UserProfile/UserCard_Language.vue +++ b/frontend/src/views/Pages/UserProfile/UserCard_Language.vue @@ -100,6 +100,7 @@ export default { .then(() => { this.$store.commit('language', this.language) this.cancelEdit() + this.$toasted.success(this.$t('languages.success')) }) .catch((error) => { this.$toasted.error(error.message) From 0acb58c2311d4bff8f77cdc4a68f2a6e4d454ef3 Mon Sep 17 00:00:00 2001 From: Einhornimmond Date: Wed, 22 Sep 2021 12:28:36 +0200 Subject: [PATCH 64/93] use database for migration test db, remove debug code --- .github/workflows/test.yml | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e31fa6b7d..046d63681 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -413,22 +413,31 @@ jobs: needs: [build_test_community_server] services: mariadb: - image: gradido/mariadb:test + image: mariadb/server:10.5 env: MARIADB_ALLOW_EMPTY_PASSWORD: 1 MARIADB_USER: root - # ports: - # - 3306:3306 + MARIADB_DATABASE: gradido_community_test options: --health-cmd="mysqladmin ping" --health-interval=5s --health-timeout=5s --health-retries=3 + database: + image: gradido/database:production_up + build: + context: ./database + target: production_up + depends_on: + - mariadb + networks: + - internal-net + environment: + - NODE_ENV="production" + - DB_HOST=mariadb steps: - name: get mariadb container id run: echo "::set-output name=id::$(docker container ls | grep mariadb | awk '{ print $1 }')" id: mariadb_container - - name: show networks - run: echo "$(docker network ls)" - name: get automatic created network run: echo "::set-output name=id::$(docker network ls | grep github_network | awk '{ print $1 }')" id: network @@ -452,12 +461,6 @@ jobs: path: /tmp - name: Load Docker Image run: docker load < /tmp/community_server.tar - - # for debugging login-server - - name: check login-server - run: docker logs ${{ steps.login_server_container.outputs.id }} - - name: check mariadb - run: docker logs ${{ steps.mariadb_container.outputs.id }} ########################################################################## # UNIT TESTS BACKEND COMMUNITY-SERVER ####################################### ########################################################################## From 09e87526def054991b354132ee1a2314c7b2b5f1 Mon Sep 17 00:00:00 2001 From: elweyn Date: Wed, 22 Sep 2021 12:29:21 +0200 Subject: [PATCH 65/93] Added a success message for language switch in profile. --- frontend/src/views/Pages/UserProfile/UserCard_Language.vue | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/frontend/src/views/Pages/UserProfile/UserCard_Language.vue b/frontend/src/views/Pages/UserProfile/UserCard_Language.vue index 1bf9a8415..d7a059715 100644 --- a/frontend/src/views/Pages/UserProfile/UserCard_Language.vue +++ b/frontend/src/views/Pages/UserProfile/UserCard_Language.vue @@ -62,6 +62,7 @@ - + From 3bf0c2ad9c1caf1f17452a28af5093f3dacd0d27 Mon Sep 17 00:00:00 2001 From: Einhornimmond Date: Fri, 24 Sep 2021 11:17:58 +0200 Subject: [PATCH 89/93] minimal change to trigger rebuild --- .github/workflows/test.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e31fa6b7d..aea0cc1b1 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,6 +1,5 @@ name: gradido test CI - on: [push] jobs: From 092d3f6f5ddafba3d0ff6c61fe44a791f43a1487 Mon Sep 17 00:00:00 2001 From: ogerly Date: Fri, 24 Sep 2021 12:13:48 +0200 Subject: [PATCH 90/93] Better explanation and presentation of the calculation of the total sum with the inclusion of decay --- frontend/src/components/DecayInformation.vue | 95 ++++++++++++-------- 1 file changed, 57 insertions(+), 38 deletions(-) diff --git a/frontend/src/components/DecayInformation.vue b/frontend/src/components/DecayInformation.vue index c9ffa9115..9abc6cfbe 100644 --- a/frontend/src/components/DecayInformation.vue +++ b/frontend/src/components/DecayInformation.vue @@ -19,12 +19,12 @@ -
-
-
{{ $t('decay.last_transaction') }}
-
-
-
+ + +
{{ $t('decay.last_transaction') }}
+
+ +
{{ $t('decay.Starting_block_decay') }}
{{ $t('decay.decay_introduced') }} : @@ -37,15 +37,15 @@ {{ $i18n.locale === 'de' ? 'Uhr' : '' }}
-
-
+ + -
-
+ +
{{ $t('decay.past_time') }}
-
-
-
{{ $t('decay.since_introduction') }}
+ + +
{{ $t('decay.since_introduction') }}
{{ duration.years }} {{ $t('decay.year') }}, @@ -60,42 +60,61 @@ {{ duration.seconds }} {{ $t('decay.seconds') }} -
-
+ + +
-
-
+ + + +
{{ $t('decay.decay') }}
+
+ +
- {{ decay.balance }}
+
+
+
+ + + Berechnung der Gesamtsumme + + + + +
{{ $t('decay.sent') }}
{{ $t('decay.received') }}
-
-
+ +
- {{ balance }}
+ {{ balance }}
-
-
-
-
-
{{ $t('decay.decay') }}
-
-
-
- {{ decay.balance }}
-
-
-
-
-
-
{{ $t('decay.total') }}
-
-
+ + + + + + +
{{ $t('decay.total') }}
+
+
- {{ parseInt(balance) + decay.balance }}
{{ parseInt(balance) - decay.balance }}
-
-
-
+ + + + + + (Vergänglichkeit plus Gesendet) + (Vergänglichkeit minus Empfangen) + + + + +
From 4c574c1081a5be382d80580cde1383e0a03d1362 Mon Sep 17 00:00:00 2001 From: ogerly Date: Fri, 24 Sep 2021 12:27:39 +0200 Subject: [PATCH 91/93] add lacales, fix locales, fix lint --- frontend/src/components/DecayInformation.vue | 34 ++++++++++++-------- frontend/src/locales/de.json | 3 ++ frontend/src/locales/en.json | 3 ++ 3 files changed, 26 insertions(+), 14 deletions(-) diff --git a/frontend/src/components/DecayInformation.vue b/frontend/src/components/DecayInformation.vue index 9abc6cfbe..6b88e5cac 100644 --- a/frontend/src/components/DecayInformation.vue +++ b/frontend/src/components/DecayInformation.vue @@ -21,10 +21,10 @@ -
{{ $t('decay.last_transaction') }}
+
{{ $t('decay.last_transaction') }}
-
+
{{ $t('decay.Starting_block_decay') }}
{{ $t('decay.decay_introduced') }} : @@ -45,7 +45,7 @@
{{ $t('decay.past_time') }}
-
{{ $t('decay.since_introduction') }}
+
{{ $t('decay.since_introduction') }}
{{ duration.years }} {{ $t('decay.year') }}, @@ -62,7 +62,7 @@
- +
@@ -73,10 +73,10 @@
- {{ decay.balance }}
-
+
- Berechnung der Gesamtsumme + {{ $t('decay.calculation_total') }} @@ -90,11 +90,19 @@
+ {{ balance }}
- + + + +
{{ $t('decay.decay') }}
+
+ +
- {{ decay.balance }}
+
+
-
{{ $t('decay.total') }}
+
{{ $t('decay.total') }}
@@ -105,16 +113,14 @@
- + - (Vergänglichkeit plus Gesendet) - (Vergänglichkeit minus Empfangen) + {{ $t('decay.formula_total_sent') }} + {{ $t('decay.formula_total_received') }} - - -
+
diff --git a/frontend/src/locales/de.json b/frontend/src/locales/de.json index af7e19fc5..27fa0e906 100644 --- a/frontend/src/locales/de.json +++ b/frontend/src/locales/de.json @@ -12,12 +12,15 @@ }, "decay": { "calculation_decay": "Berechnung der Vergänglichkeit", + "calculation_total": "Berechnung der Gesamtsumme", "created": "Geschöpft", "days": "Tage", "decay": "Vergänglichkeit", "decayStart": " - Startblock für Vergänglichkeit am: ", "decay_introduced": "Die Vergänglichkeit wurde Eingeführt am ", "decay_since_last_transaction": "Vergänglichkeit seit der letzten Transaktion", + "formula_total_received": "(Empfangen minus Vergänglichkeit)", + "formula_total_sent": "(Gesendet plus Vergänglichkeit)", "fromCommunity": "Aus der Gemeinschaft", "hours": "Stunden", "last_transaction": "Letzte Transaktion", diff --git a/frontend/src/locales/en.json b/frontend/src/locales/en.json index 8bd6aea99..90de4b9eb 100644 --- a/frontend/src/locales/en.json +++ b/frontend/src/locales/en.json @@ -12,12 +12,15 @@ }, "decay": { "calculation_decay": "Calculation of Decay", + "calculation_total": "Calculation of the total", "created": "Created", "days": "Days", "decay": "Decay", "decayStart": " - Starting block for decay at: ", "decay_introduced": "Decay was Introduced on", "decay_since_last_transaction": "Decay since the last transaction", + "formula_total_received": "(Received minus decay)", + "formula_total_sent": "(Sent plus decay)", "fromCommunity": "From the community", "hours": "Hours", "last_transaction": "Last transaction:", From 05bab6e7575ca6e67cca52ca769814473d81d1d8 Mon Sep 17 00:00:00 2001 From: ogerly Date: Fri, 24 Sep 2021 13:10:04 +0200 Subject: [PATCH 92/93] remove formal totale sum --- frontend/src/components/DecayInformation.vue | 7 ------- frontend/src/locales/de.json | 2 -- frontend/src/locales/en.json | 2 -- 3 files changed, 11 deletions(-) diff --git a/frontend/src/components/DecayInformation.vue b/frontend/src/components/DecayInformation.vue index 6b88e5cac..1fb0df3a4 100644 --- a/frontend/src/components/DecayInformation.vue +++ b/frontend/src/components/DecayInformation.vue @@ -113,13 +113,6 @@
- - - - {{ $t('decay.formula_total_sent') }} - {{ $t('decay.formula_total_received') }} - - diff --git a/frontend/src/locales/de.json b/frontend/src/locales/de.json index 27fa0e906..280c9cf67 100644 --- a/frontend/src/locales/de.json +++ b/frontend/src/locales/de.json @@ -19,8 +19,6 @@ "decayStart": " - Startblock für Vergänglichkeit am: ", "decay_introduced": "Die Vergänglichkeit wurde Eingeführt am ", "decay_since_last_transaction": "Vergänglichkeit seit der letzten Transaktion", - "formula_total_received": "(Empfangen minus Vergänglichkeit)", - "formula_total_sent": "(Gesendet plus Vergänglichkeit)", "fromCommunity": "Aus der Gemeinschaft", "hours": "Stunden", "last_transaction": "Letzte Transaktion", diff --git a/frontend/src/locales/en.json b/frontend/src/locales/en.json index 90de4b9eb..67aa135c4 100644 --- a/frontend/src/locales/en.json +++ b/frontend/src/locales/en.json @@ -19,8 +19,6 @@ "decayStart": " - Starting block for decay at: ", "decay_introduced": "Decay was Introduced on", "decay_since_last_transaction": "Decay since the last transaction", - "formula_total_received": "(Received minus decay)", - "formula_total_sent": "(Sent plus decay)", "fromCommunity": "From the community", "hours": "Hours", "last_transaction": "Last transaction:", From c1f5a425b4a56b6ae64912ed3e235dc115f0cd81 Mon Sep 17 00:00:00 2001 From: Alexander Friedland Date: Fri, 24 Sep 2021 13:14:51 +0200 Subject: [PATCH 93/93] Update en.json --- frontend/src/locales/en.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/locales/en.json b/frontend/src/locales/en.json index 67aa135c4..48a0659d1 100644 --- a/frontend/src/locales/en.json +++ b/frontend/src/locales/en.json @@ -12,7 +12,7 @@ }, "decay": { "calculation_decay": "Calculation of Decay", - "calculation_total": "Calculation of the total", + "calculation_total": "Calculation of the grand total", "created": "Created", "days": "Days", "decay": "Decay",