From 275279e7b9292035310ed9ea8f10baabf0f95f70 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sun, 12 Mar 2023 03:37:18 +0100 Subject: [PATCH 01/67] use eslint-plugin-promise --- backend/.eslintrc.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/backend/.eslintrc.js b/backend/.eslintrc.js index b33a3e480..e10be9228 100644 --- a/backend/.eslintrc.js +++ b/backend/.eslintrc.js @@ -5,7 +5,7 @@ module.exports = { node: true, }, parser: '@typescript-eslint/parser', - plugins: ['prettier', '@typescript-eslint', 'type-graphql', 'jest', 'import', 'n'], + plugins: ['prettier', '@typescript-eslint', 'type-graphql', 'jest', 'import', 'n', 'promise'], extends: [ 'standard', 'eslint:recommended', @@ -117,6 +117,21 @@ module.exports = { 'n/prefer-global/url-search-params': 'error', 'n/prefer-promises/dns': 'error', 'n/prefer-promises/fs': 'error', + // promise + 'promise/catch-or-return': 'error', + 'promise/no-return-wrap': 'error', + 'promise/param-names': 'error', + 'promise/always-return': 'error', + 'promise/no-native': 'off', + 'promise/no-nesting': 'warn', + 'promise/no-promise-in-callback': 'warn', + 'promise/no-callback-in-promise': 'warn', + 'promise/avoid-new': 'warn', + 'promise/no-new-statics': 'error', + 'promise/no-return-in-finally': 'warn', + 'promise/valid-params': 'warn', + 'promise/prefer-await-to-callbacks': 'error', + 'promise/no-multiple-resolved': 'error', }, overrides: [ // only for ts files From 6eaccacf00eff35bd989ca8b5596ae2c8587fe1d Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sun, 12 Mar 2023 03:59:39 +0100 Subject: [PATCH 02/67] refine prettier config --- backend/.prettierrc.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/backend/.prettierrc.js b/backend/.prettierrc.js index bc1d767d7..8d38f2aac 100644 --- a/backend/.prettierrc.js +++ b/backend/.prettierrc.js @@ -1,9 +1,14 @@ module.exports = { - semi: false, printWidth: 100, - singleQuote: true, - trailingComma: "all", tabWidth: 2, + useTabs: false, + semi: false, + singleQuote: true, + quoteProps: "as-needed", + jsxSingleQuote: true, + trailingComma: "all", bracketSpacing: true, + bracketSameLine: false, + arrowParens: "always", endOfLine: "auto", }; From 5aaf9acd987c31b0abe5273fb46208552db0096b Mon Sep 17 00:00:00 2001 From: mahula Date: Mon, 27 Mar 2023 20:18:13 +0200 Subject: [PATCH 03/67] align workflow file naming --- .../{test-admin-interface.yml => test_admin_interface.yml} | 0 .github/workflows/{e2e-test.yml => test_e2e.yml} | 0 .github/workflows/{test-nginx.yml => test_nginx.yml} | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{test-admin-interface.yml => test_admin_interface.yml} (100%) rename .github/workflows/{e2e-test.yml => test_e2e.yml} (100%) rename .github/workflows/{test-nginx.yml => test_nginx.yml} (100%) diff --git a/.github/workflows/test-admin-interface.yml b/.github/workflows/test_admin_interface.yml similarity index 100% rename from .github/workflows/test-admin-interface.yml rename to .github/workflows/test_admin_interface.yml diff --git a/.github/workflows/e2e-test.yml b/.github/workflows/test_e2e.yml similarity index 100% rename from .github/workflows/e2e-test.yml rename to .github/workflows/test_e2e.yml diff --git a/.github/workflows/test-nginx.yml b/.github/workflows/test_nginx.yml similarity index 100% rename from .github/workflows/test-nginx.yml rename to .github/workflows/test_nginx.yml From 2cacecdf9730656eac60ff8d5bec5857b5ff5dc4 Mon Sep 17 00:00:00 2001 From: mahula Date: Mon, 27 Mar 2023 20:18:13 +0200 Subject: [PATCH 04/67] align workflow file naming --- .github/workflows/{test_dht-node.yml => test_dht_node.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{test_dht-node.yml => test_dht_node.yml} (100%) diff --git a/.github/workflows/test_dht-node.yml b/.github/workflows/test_dht_node.yml similarity index 100% rename from .github/workflows/test_dht-node.yml rename to .github/workflows/test_dht_node.yml From d84b9872bd57c82fe6d843886fb6c9ad214f4bfd Mon Sep 17 00:00:00 2001 From: mahula Date: Mon, 27 Mar 2023 21:04:58 +0200 Subject: [PATCH 05/67] use docker-compose file filter unambiguous and only where necessary - change docker-compose file filter name - use new file filter name in workflow files - remove unnecessary docker-compose filtering from build test jobs --- .github/file-filters.yml | 2 +- .github/workflows/test_dht_node.yml | 6 +++--- .github/workflows/test_federation.yml | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/file-filters.yml b/.github/file-filters.yml index 80b7482d9..6690cdb9d 100644 --- a/.github/file-filters.yml +++ b/.github/file-filters.yml @@ -33,7 +33,7 @@ admin: &admin dht_node: &dht_node - 'dht-node/**/*' -docker: &docker +docker-compose: &docker-compose - 'docker-compose.*' federation: &federation diff --git a/.github/workflows/test_dht_node.yml b/.github/workflows/test_dht_node.yml index a57f09399..9ee528da2 100644 --- a/.github/workflows/test_dht_node.yml +++ b/.github/workflows/test_dht_node.yml @@ -10,7 +10,7 @@ jobs: runs-on: ubuntu-latest outputs: dht_node: ${{ steps.changes.outputs.dht_node }} - docker: ${{ steps.changes.outputs.docker }} + docker-compose: ${{ steps.changes.outputs.docker-compose }} steps: - uses: actions/checkout@v3.3.0 @@ -27,7 +27,7 @@ jobs: ############################################################################## build: name: Docker Build Test - DHT Node - if: needs.files-changed.outputs.dht_node == 'true' || needs.files-changed.outputs.docker == 'true' + if: needs.files-changed.outputs.dht_node == 'true' needs: files-changed runs-on: ubuntu-latest steps: @@ -65,7 +65,7 @@ jobs: ############################################################################## unit_test: name: Unit Tests - DHT Node - if: needs.files-changed.outputs.dht_node == 'true' || needs.files-changed.outputs.docker == 'true' + if: needs.files-changed.outputs.dht_node == 'true' || needs.files-changed.outputs.docker-compose == 'true' needs: [files-changed, build] runs-on: ubuntu-latest steps: diff --git a/.github/workflows/test_federation.yml b/.github/workflows/test_federation.yml index fc29a1bf8..fb8a3f48b 100644 --- a/.github/workflows/test_federation.yml +++ b/.github/workflows/test_federation.yml @@ -9,7 +9,7 @@ jobs: name: Detect File Changes - Federation runs-on: ubuntu-latest outputs: - docker: ${{ steps.changes.outputs.docker }} + docker-compose: ${{ steps.changes.outputs.docker-compose }} federation: ${{ steps.changes.outputs.federation }} steps: - uses: actions/checkout@v3.3.0 @@ -27,7 +27,7 @@ jobs: ############################################################################## build: name: Docker Build Test - Federation - if: needs.files-changed.outputs.docker == 'true' || needs.files-changed.outputs.federation == 'true' + if: needs.files-changed.outputs.federation == 'true' needs: files-changed runs-on: ubuntu-latest steps: @@ -65,7 +65,7 @@ jobs: ############################################################################## unit_test: name: Unit Tests - Federation - if: needs.files-changed.outputs.docker == 'true' || needs.files-changed.outputs.federation == 'true' + if: needs.files-changed.outputs.docker-compose == 'true' || needs.files-changed.outputs.federation == 'true' needs: [files-changed, build] runs-on: ubuntu-latest steps: From ccf5156f986d6ab6a3b5125df657e86034767e2b Mon Sep 17 00:00:00 2001 From: mahula Date: Mon, 27 Mar 2023 21:18:52 +0200 Subject: [PATCH 06/67] remove block comments fron dht node and federation workflow files --- .github/workflows/test_dht_node.yml | 13 +------------ .github/workflows/test_federation.yml | 11 ----------- 2 files changed, 1 insertion(+), 23 deletions(-) diff --git a/.github/workflows/test_dht_node.yml b/.github/workflows/test_dht_node.yml index 9ee528da2..04c08e3bc 100644 --- a/.github/workflows/test_dht_node.yml +++ b/.github/workflows/test_dht_node.yml @@ -3,8 +3,6 @@ name: Gradido DHT Node Test CI on: push jobs: - # only (but most important) job from this workflow required for pull requests - # check results serve as run conditions for all other jobs here files-changed: name: Detect File Changes - DHT Node runs-on: ubuntu-latest @@ -22,9 +20,6 @@ jobs: filters: .github/file-filters.yml list-files: shell - ############################################################################## - # JOB: DOCKER BUILD TEST ##################################################### - ############################################################################## build: name: Docker Build Test - DHT Node if: needs.files-changed.outputs.dht_node == 'true' @@ -45,9 +40,6 @@ jobs: name: docker-dht-node-test path: /tmp/dht-node.tar - ############################################################################## - # JOB: LINT ################################################################## - ############################################################################## lint: name: Lint - DHT Node if: needs.files-changed.outputs.dht_node == 'true' @@ -60,10 +52,7 @@ jobs: - name: Lint run: cd dht-node && yarn && yarn run lint - ############################################################################## - # JOB: UNIT TEST ############################################################# - ############################################################################## - unit_test: + unit_test: name: Unit Tests - DHT Node if: needs.files-changed.outputs.dht_node == 'true' || needs.files-changed.outputs.docker-compose == 'true' needs: [files-changed, build] diff --git a/.github/workflows/test_federation.yml b/.github/workflows/test_federation.yml index fb8a3f48b..5fd714b00 100644 --- a/.github/workflows/test_federation.yml +++ b/.github/workflows/test_federation.yml @@ -3,8 +3,6 @@ name: Gradido Federation Test CI on: push jobs: - # only (but most important) job from this workflow required for pull requests - # check results serve as run conditions for all other jobs here files-changed: name: Detect File Changes - Federation runs-on: ubuntu-latest @@ -22,9 +20,6 @@ jobs: filters: .github/file-filters.yml list-files: shell - ############################################################################## - # JOB: DOCKER BUILD TEST ##################################################### - ############################################################################## build: name: Docker Build Test - Federation if: needs.files-changed.outputs.federation == 'true' @@ -45,9 +40,6 @@ jobs: name: docker-federation-test path: /tmp/federation.tar - ############################################################################## - # JOB: LINT ################################################################## - ############################################################################## lint: name: Lint - Federation if: needs.files-changed.outputs.federation == 'true' @@ -60,9 +52,6 @@ jobs: - name: Lint run: cd federation && yarn && yarn run lint - ############################################################################## - # JOB: UNIT TEST ############################################################# - ############################################################################## unit_test: name: Unit Tests - Federation if: needs.files-changed.outputs.docker-compose == 'true' || needs.files-changed.outputs.federation == 'true' From 47fe739c7772a157d02ecb06d38951c1fdef3b27 Mon Sep 17 00:00:00 2001 From: ogerly Date: Tue, 28 Mar 2023 08:07:34 +0200 Subject: [PATCH 07/67] yarn installAll --- e2e-tests/yarn.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/e2e-tests/yarn.lock b/e2e-tests/yarn.lock index c0f623e47..1fffb6870 100644 --- a/e2e-tests/yarn.lock +++ b/e2e-tests/yarn.lock @@ -2193,10 +2193,10 @@ crypto-browserify@^3.0.0: randombytes "^2.0.0" randomfill "^1.0.3" -cypress@^10.4.0: - version "10.8.0" - resolved "https://registry.yarnpkg.com/cypress/-/cypress-10.8.0.tgz#12a681f2642b6f13d636bab65d5b71abdb1497a5" - integrity sha512-QVse0dnLm018hgti2enKMVZR9qbIO488YGX06nH5j3Dg1isL38DwrBtyrax02CANU6y8F4EJUuyW6HJKw1jsFA== +cypress@^12.7.0: + version "12.8.1" + resolved "https://registry.yarnpkg.com/cypress/-/cypress-12.8.1.tgz#0c6e67f34554d553138697aaf349b637d80004eb" + integrity sha512-lIFbKdaSYAOarNLHNFa2aPZu6YSF+8UY4VRXMxJrFUnk6RvfG0AWsZ7/qle/aIz30TNUD4aOihz2ZgS4vuQVSA== dependencies: "@cypress/request" "^2.88.10" "@cypress/xvfb" "^1.2.4" @@ -2215,7 +2215,7 @@ cypress@^10.4.0: commander "^5.1.0" common-tags "^1.8.0" dayjs "^1.10.4" - debug "^4.3.2" + debug "^4.3.4" enquirer "^2.3.6" eventemitter2 "6.4.7" execa "4.1.0" From a1b8be4329ffc13645d39d2501732dc2fbaf81bf Mon Sep 17 00:00:00 2001 From: ogerly Date: Wed, 29 Mar 2023 10:57:31 +0200 Subject: [PATCH 08/67] add visualize federation --- admin/package.json | 1 + .../Fedaration/FederationVisualizeItem.vue | 76 +++++++++++++++++++ .../FederationVisualizeitem.spec.js | 44 +++++++++++ admin/src/components/NavBar.spec.js | 10 ++- admin/src/components/NavBar.vue | 5 +- admin/src/graphql/getCommunities.js | 17 +++++ admin/src/locales/de.json | 8 ++ admin/src/locales/en.json | 8 ++ admin/src/pages/FederationVisualize.spec.js | 30 ++++++++ admin/src/pages/FederationVisualize.vue | 68 +++++++++++++++++ admin/src/router/router.test.js | 9 ++- admin/src/router/routes.js | 4 + admin/yarn.lock | 5 ++ 13 files changed, 280 insertions(+), 5 deletions(-) create mode 100644 admin/src/components/Fedaration/FederationVisualizeItem.vue create mode 100644 admin/src/components/Fedaration/FederationVisualizeitem.spec.js create mode 100644 admin/src/graphql/getCommunities.js create mode 100644 admin/src/pages/FederationVisualize.spec.js create mode 100644 admin/src/pages/FederationVisualize.vue diff --git a/admin/package.json b/admin/package.json index 3406c326a..521f34bfc 100644 --- a/admin/package.json +++ b/admin/package.json @@ -33,6 +33,7 @@ "bootstrap": "4.3.1", "bootstrap-vue": "^2.21.2", "core-js": "^3.6.5", + "date-fns": "^2.29.3", "dotenv-webpack": "^7.0.3", "express": "^4.17.1", "graphql": "^15.6.1", diff --git a/admin/src/components/Fedaration/FederationVisualizeItem.vue b/admin/src/components/Fedaration/FederationVisualizeItem.vue new file mode 100644 index 000000000..ba23c0433 --- /dev/null +++ b/admin/src/components/Fedaration/FederationVisualizeItem.vue @@ -0,0 +1,76 @@ + + diff --git a/admin/src/components/Fedaration/FederationVisualizeitem.spec.js b/admin/src/components/Fedaration/FederationVisualizeitem.spec.js new file mode 100644 index 000000000..d82a12f33 --- /dev/null +++ b/admin/src/components/Fedaration/FederationVisualizeitem.spec.js @@ -0,0 +1,44 @@ +import { mount } from '@vue/test-utils' +import FederationVisualizeItem from './FederationVisualizeItem.vue' + +const localVue = global.localVue + +const mocks = { + $t: (key) => key, + $i18n: { + locale: 'de', + t: (key) => key, + }, +} + +describe('FederationVisualizeItem', () => { + let wrapper + + const propsData = { + item: { + id: 7590, + foreign: false, + publicKey: 'eaf6a426b24fd54f8fbae11c17700fc595080ca25159579c63d38dbc64284ba7', + url: 'http://localhost/api/api/2_0', + lastAnnouncedAt: null, + verifiedAt: null, + lastErrorAt: null, + createdAt: '2023-03-29T04:46:38.823Z', + updatedAt: null, + }, + } + + const Wrapper = () => { + return mount(FederationVisualizeItem, { localVue, mocks, propsData }) + } + + describe('mount', () => { + beforeEach(() => { + wrapper = Wrapper() + }) + + it('renders the component', () => { + expect(wrapper.find('div.federation-visualize-item').exists()).toBe(true) + }) + }) +}) diff --git a/admin/src/components/NavBar.spec.js b/admin/src/components/NavBar.spec.js index 1927f258c..6a4a69959 100644 --- a/admin/src/components/NavBar.spec.js +++ b/admin/src/components/NavBar.spec.js @@ -62,8 +62,12 @@ describe('NavBar', () => { ) }) + it('has a link to /federation', () => { + expect(wrapper.findAll('.nav-item').at(3).find('a').attributes('href')).toBe('/federation') + }) + it('has a link to /statistic', () => { - expect(wrapper.findAll('.nav-item').at(3).find('a').attributes('href')).toBe('/statistic') + expect(wrapper.findAll('.nav-item').at(4).find('a').attributes('href')).toBe('/statistic') }) }) @@ -72,7 +76,7 @@ describe('NavBar', () => { beforeEach(async () => { delete window.location window.location = '' - await wrapper.findAll('.nav-item').at(4).find('a').trigger('click') + await wrapper.findAll('.nav-item').at(5).find('a').trigger('click') }) afterEach(() => { @@ -97,7 +101,7 @@ describe('NavBar', () => { window.location = { assign: windowLocationMock, } - await wrapper.findAll('.nav-item').at(5).find('a').trigger('click') + await wrapper.findAll('.nav-item').at(6).find('a').trigger('click') }) afterEach(() => { diff --git a/admin/src/components/NavBar.vue b/admin/src/components/NavBar.vue index dae4bba91..2efeda048 100644 --- a/admin/src/components/NavBar.vue +++ b/admin/src/components/NavBar.vue @@ -1,6 +1,6 @@