diff --git a/.github/workflows/ga-publication.yml b/.github/workflows/ga-publication.yml index 3c6078612..314a31c25 100644 --- a/.github/workflows/ga-publication.yml +++ b/.github/workflows/ga-publication.yml @@ -6,15 +6,15 @@ on: - created env: - ENTANDO_OPT_USE_PPL_TAG: "v1.2.0" + ENTANDO_OPT_USE_PPL_TAG: "v1.4.2" + ENTANDO_OPT_DATA_REPO: "${{ secrets.ENTANDO_OPT_DATA_REPO }}" + ENTANDO_OPT_DATA_REPO_TOKEN: "${{ secrets.ENTANDO_OPT_DATA_REPO_TOKEN }}" + ENTANDO_OPT_ENVIRONMENT_NAMES: "${{ secrets.ENTANDO_OPT_ENVIRONMENT_NAMES }}" ENTANDO_OPT_FEATURES: "${{ secrets.ENTANDO_OPT_FEATURES }}" ENTANDO_OPT_GLOBAL_FEATURES: "${{ secrets.ENTANDO_OPT_GLOBAL_FEATURES }}" ENTANDO_OPT_LOG_LEVEL: "${{ secrets.ENTANDO_OPT_LOG_LEVEL }}" - ENTANDO_OPT_REPO_BOM_URL: "${{ secrets.ENTANDO_OPT_REPO_BOM_URL }}" ENTANDO_OPT_CUSTOM_ENV: "${{ secrets.ENTANDO_OPT_CUSTOM_ENV }}" PPL_CONTEXT: ${{ toJson(github) }} - GIT_USER_NAME: "${{ secrets.GIT_USER_NAME }}" - GIT_USER_EMAIL: "${{ secrets.GIT_USER_EMAIL }}" LOCAL_CLONE_DIR: "local-checkout" jobs: @@ -23,7 +23,6 @@ jobs: # GA PUBLICATION ga-publish: env: - ENTANDO_OPT_MAVEN_REPO_GA: ${{ secrets.ENTANDO_OPT_MAVEN_REPO_GA }} ENTANDO_BOT_TOKEN: ${{ secrets.ENTANDO_BOT_TOKEN }} runs-on: ubuntu-latest steps: @@ -53,10 +52,10 @@ jobs: gpg-passphrase: MAVEN_GPG_PASSPHRASE - name: "Publish package to GA" run: | - ~/ppl-run mvn GA-PUBLICATION \ + ~/ppl-run npm GA-PUBLICATION \ --id "GA-PUBLICATION" \ --lcd "$LOCAL_CLONE_DIR" env: MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }} - MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} + MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} \ No newline at end of file diff --git a/.github/workflows/post-merge.yml b/.github/workflows/post-merge.yml index c2386cee4..f778ac812 100644 --- a/.github/workflows/post-merge.yml +++ b/.github/workflows/post-merge.yml @@ -8,14 +8,15 @@ on: - release/* env: - ENTANDO_OPT_USE_PPL_TAG: "v1.2.0" + ENTANDO_OPT_USE_PPL_TAG: "v1.4.2" + ENTANDO_OPT_DATA_REPO: "${{ secrets.ENTANDO_OPT_DATA_REPO }}" + ENTANDO_OPT_DATA_REPO_TOKEN: "${{ secrets.ENTANDO_OPT_DATA_REPO_TOKEN }}" + ENTANDO_OPT_ENVIRONMENT_NAMES: "${{ secrets.ENTANDO_OPT_ENVIRONMENT_NAMES }}" ENTANDO_OPT_FEATURES: "${{ secrets.ENTANDO_OPT_FEATURES }}" ENTANDO_OPT_GLOBAL_FEATURES: "${{ secrets.ENTANDO_OPT_GLOBAL_FEATURES }}" ENTANDO_OPT_LOG_LEVEL: "${{ secrets.ENTANDO_OPT_LOG_LEVEL }}" - ENTANDO_OPT_REPO_BOM_URL: "${{ secrets.ENTANDO_OPT_REPO_BOM_URL }}" + ENTANDO_OPT_CUSTOM_ENV: "${{ secrets.ENTANDO_OPT_CUSTOM_ENV }}" PPL_CONTEXT: ${{ toJson(github) }} - GIT_USER_NAME: "${{ secrets.GIT_USER_NAME }}" - GIT_USER_EMAIL: "${{ secrets.GIT_USER_EMAIL }}" LOCAL_CLONE_DIR: "local-checkout" @@ -38,4 +39,4 @@ jobs: --token "${{ secrets.ENTANDO_BOT_TOKEN }}" \ .. publication tag-git-version \ --id "TAG-VERSION" \ - --lcd "$LOCAL_CLONE_DIR" + --lcd "$LOCAL_CLONE_DIR" \ No newline at end of file diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 850dac55f..33b71b22e 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -12,28 +12,22 @@ on: - release/* env: - ENTANDO_OPT_USE_PPL_TAG: "v1.2.0" + ENTANDO_OPT_USE_PPL_TAG: "v1.4.2" + ENTANDO_OPT_DATA_REPO: "${{ secrets.ENTANDO_OPT_DATA_REPO }}" + ENTANDO_OPT_DATA_REPO_TOKEN: "${{ secrets.ENTANDO_OPT_DATA_REPO_TOKEN }}" + ENTANDO_OPT_ENVIRONMENT_NAMES: "${{ secrets.ENTANDO_OPT_ENVIRONMENT_NAMES }}" ENTANDO_OPT_FEATURES: "${{ secrets.ENTANDO_OPT_FEATURES }}" ENTANDO_OPT_GLOBAL_FEATURES: "${{ secrets.ENTANDO_OPT_GLOBAL_FEATURES }}" ENTANDO_OPT_LOG_LEVEL: "${{ secrets.ENTANDO_OPT_LOG_LEVEL }}" - ENTANDO_OPT_REPO_BOM_URL: "${{ secrets.ENTANDO_OPT_REPO_BOM_URL }}" ENTANDO_OPT_CUSTOM_ENV: "${{ secrets.ENTANDO_OPT_CUSTOM_ENV }}" - ENTANDO_OPT_OKD_LOGIN: "${{ secrets.ENTANDO_OPT_OKD_LOGIN }}" - ENTANDO_OPT_IMAGE_REGISTRY_OVERRIDE: "${{ secrets.ENTANDO_OPT_IMAGE_REGISTRY_OVERRIDE }}" - ENTANDO_OPT_DOCKER_ORG: "${{ secrets.ENTANDO_OPT_DOCKER_ORG }}" - ENTANDO_OPT_TEST_NAMESPACE: "${{ secrets.ENTANDO_OPT_TEST_NAMESPACE }}" - ENTANDO_OPT_HELM_CLI_URL: "${{ secrets.ENTANDO_OPT_HELM_CLI_URL }}" PPL_CONTEXT: ${{ toJson(github) }} - GIT_USER_NAME: "${{ secrets.GIT_USER_NAME }}" - GIT_USER_EMAIL: "${{ secrets.GIT_USER_EMAIL }}" LOCAL_CLONE_DIR: "local-checkout" - SNYK_ORG: "entando-ixc" jobs: # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # PREPARE - + prepare: runs-on: ubuntu-latest outputs: @@ -45,8 +39,8 @@ jobs: run: | ${{ secrets.ENTANDO_OPT_PPL_INSTALL_CMD }} ~/ppl-run \ + .. @checkout-branch --lcd "$LOCAL_CLONE_DIR" \ .. status-report \ - .. @checkout-branch pr --lcd "$LOCAL_CLONE_DIR" \ .. @setup-feature-flags "PR_PREFLIGHT_CHECKS" "BOM_CHECK" "BOM" \ .. @setup-features-list "SCAN_MATRIX" --prefix "MTX-NPM-,MTX-SCAN-" \ ; @@ -59,23 +53,20 @@ jobs: # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # FULL-BUILD - + full-build: needs: [ 'prepare' ] runs-on: ubuntu-latest env: - ENTANDO_BOT_TOKEN: ${{ secrets.ENTANDO_BOT_TOKEN }} - ENTANDO_OPT_OKD_LOGIN_URL: "${{ secrets.ENTANDO_OPT_OKD_LOGIN_URL }}" + ENTANDO_BOT_TOKEN: "${{ secrets.ENTANDO_BOT_TOKEN }}" ENTANDO_OPT_OKD_LOGIN_TOKEN: "${{ secrets.ENTANDO_OPT_OKD_LOGIN_TOKEN }}" - ENTANDO_OPT_OKD_LOGIN_NAMESPACE: "${{ secrets.ENTANDO_OPT_OKD_LOGIN_NAMESPACE }}" - ENTANDO_OPT_OKD_LOGIN_INSECURE: "${{ secrets.ENTANDO_OPT_OKD_LOGIN_INSECURE }}" - ENTANDO_OPT_OKD_CLI_URL: "${{ secrets.ENTANDO_OPT_OKD_CLI_URL }}" steps: #~ CHECKOUT - name: "CHECKOUT" + id: CHECKOUT run: | ${{ secrets.ENTANDO_OPT_PPL_INSTALL_CMD }} - ~/ppl-run checkout-branch pr \ + ~/ppl-run checkout-branch \ --lcd "$LOCAL_CLONE_DIR" \ --token "$ENTANDO_BOT_TOKEN" \ ; @@ -91,13 +82,6 @@ jobs: path: ~/.npm key: ${{ runner.os }}-npm restore-keys: ${{ runner.os }}-npm - #~ BUILD CACHE - - name: "Cache Build Dir" - id: build-cache - uses: actions/cache@v2 - with: - path: "${{ env.LOCAL_CLONE_DIR }}/build/" - key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} #~ BUILD - name: "FULL BUILD" env: @@ -119,7 +103,7 @@ jobs: fail-fast: false matrix: scan-type: ${{fromJson(needs.prepare.outputs.SCAN_MATRIX)}} - + steps: #~ CHECKOUT - name: "CHECKOUT" @@ -142,20 +126,26 @@ jobs: ${{ runner.os }}-npm-matrix-${{ matrix.scan-type }} ${{ runner.os }}-npm-matrix- ${{ runner.os }}-npm- - #~ BUILD CACHE - - name: "Cache Build Dir" - id: build-cache - uses: actions/cache@v2 - with: - path: "${{ env.LOCAL_CLONE_DIR }}/build/" - key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} #~ SCAN - name: "Run the matrix step ${{ matrix.scan-type }}" run: | SCAN_TYPE="${{ matrix.scan-type }}" case "$SCAN_TYPE" in + MTX-MVN-SCAN-SONAR) + export GITHUB_TOKEN="${{ secrets.GITHUB_TOKEN }}" + export SONAR_TOKEN="${{ secrets.SONAR_TOKEN }}" + export ENTANDO_OPT_SONAR_PROJECT_KEY="${{ secrets.ENTANDO_OPT_SONAR_PROJECT_KEY }}" + ;; MTX-SCAN-SNYK) export SNYK_TOKEN="${{ secrets.SNYK_TOKEN }}" ;; + MTX-MVN-POST-DEPLOYMENT-TESTS) + export ENTANDO_OPT_OKD_LOGIN_TOKEN="${{ secrets.ENTANDO_OPT_OKD_LOGIN_TOKEN }}" + export ENTANDO_OPT_IMAGE_REGISTRY_CREDENTIALS="${{ secrets.ENTANDO_OPT_IMAGE_REGISTRY_CREDENTIALS }}" + export ENTANDO_OPT_DOCKER_USERNAME="${{ secrets.ENTANDO_OPT_DOCKER_USERNAME }}" + export ENTANDO_OPT_DOCKER_PASSWORD="${{ secrets.ENTANDO_OPT_DOCKER_PASSWORD }}" + export ENTANDO_OPT_TEST_TLS_CRT="${{ secrets.ENTANDO_OPT_TEST_TLS_CRT }}" + export ENTANDO_OPT_TEST_TLS_KEY="${{ secrets.ENTANDO_OPT_TEST_TLS_KEY }}" + ;; esac - ~/ppl-run generic "$SCAN_TYPE" mvn --id "$SCAN_TYPE" --lcd "$LOCAL_CLONE_DIR" + ~/ppl-run generic "$SCAN_TYPE" npm --id "$SCAN_TYPE" --lcd "$LOCAL_CLONE_DIR" \ No newline at end of file diff --git a/.github/workflows/publication.yml b/.github/workflows/publication.yml index 987323713..939e59ada 100644 --- a/.github/workflows/publication.yml +++ b/.github/workflows/publication.yml @@ -1,4 +1,4 @@ -name: Internal Snapshot Publication +name: PUB on: push: @@ -6,23 +6,27 @@ on: - 'v*' env: - ENTANDO_OPT_USE_PPL_TAG: "v1.2.0" + ENTANDO_OPT_USE_PPL_TAG: "v1.4.2" + ENTANDO_OPT_DATA_REPO: "${{ secrets.ENTANDO_OPT_DATA_REPO }}" + ENTANDO_OPT_DATA_REPO_TOKEN: "${{ secrets.ENTANDO_OPT_DATA_REPO_TOKEN }}" + ENTANDO_OPT_ENVIRONMENT_NAMES: "${{ secrets.ENTANDO_OPT_ENVIRONMENT_NAMES }}" ENTANDO_OPT_FEATURES: "${{ secrets.ENTANDO_OPT_FEATURES }}" ENTANDO_OPT_GLOBAL_FEATURES: "${{ secrets.ENTANDO_OPT_GLOBAL_FEATURES }}" ENTANDO_OPT_LOG_LEVEL: "${{ secrets.ENTANDO_OPT_LOG_LEVEL }}" - ENTANDO_OPT_REPO_BOM_URL: "${{ secrets.ENTANDO_OPT_REPO_BOM_URL }}" ENTANDO_OPT_CUSTOM_ENV: "${{ secrets.ENTANDO_OPT_CUSTOM_ENV }}" PPL_CONTEXT: ${{ toJson(github) }} - GIT_USER_NAME: "${{ secrets.GIT_USER_NAME }}" - GIT_USER_EMAIL: "${{ secrets.GIT_USER_EMAIL }}" LOCAL_CLONE_DIR: "local-checkout" jobs: # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - # INTERNAL PUBLICATION - internal-publication: + # PUBLICATION + + publication: + outputs: + POST_PUB_DOCKER_SCAN: ${{ steps.START.outputs.POST_PUB_DOCKER_SCAN }} + POST_DEP_TESTS: ${{ steps.START.outputs.POST_DEP_TESTS }} env: ENTANDO_BOT_TOKEN: ${{ secrets.ENTANDO_BOT_TOKEN }} runs-on: ubuntu-latest @@ -33,15 +37,15 @@ jobs: ${{ secrets.ENTANDO_OPT_PPL_INSTALL_CMD }} ~/ppl-run \ .. status-report \ - .. @setup-feature-flags "PR_FORMAT_CHECK" "BOM_CHECK" "BOM" \ + .. @setup-feature-flags "PR_FORMAT_CHECK" "BOM_CHECK" "BOM" "POST_PUB_DOCKER_SCAN" "POST_DEP_TESTS" \ ; #~ CHECKOUT - name: "CHECKOUT" id: CHECKOUT run: | ~/ppl-run \ - .. checkout-branch --id "CHECKOUT FOR NEXUS PUBLICATION" \ - --lcd "$LOCAL_CLONE_DIR" \ + .. checkout-branch --id "CHECKOUT FOR PUBLICATION" \ + --lcd "$LOCAL_CLONE_DIR" \ --token "$ENTANDO_BOT_TOKEN" \ .. pr-preflight-checks --only flags --lcd "$LOCAL_CLONE_DIR" \ ; @@ -57,18 +61,13 @@ jobs: with: path: ~/.npm key: ${{ runner.os }}-npm - #~ BUILD CACHE - - name: "Cache Build Dir" - id: build-cache - uses: actions/cache@v2 - with: - path: "${{ env.LOCAL_CLONE_DIR }}/build/" - key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} - #~ PUBLISH PACKAGE + #~ PUBLISH THE ARTIFACT - name: "Publish package" run: | - ~/ppl-run generic PUBLISH \ - --id "PUBLICATION" \ + export ENTANDO_OPT_AWS_ACCESS_KEY_ID="${{ secrets.ENTANDO_OPT_AWS_ACCESS_KEY_ID }}" + export ENTANDO_OPT_AWS_SECRET_ACCESS_KEY="${{ secrets.ENTANDO_OPT_AWS_SECRET_ACCESS_KEY }}" + + ~/ppl-run generic PUBLISH --id "PUBLICATION" \ --lcd "$LOCAL_CLONE_DIR" env: NEXUS_USERNAME: ${{ secrets.NEXUS_USERNAME }} @@ -82,14 +81,96 @@ jobs: --lcd "$LOCAL_CLONE_DIR" \ --token "$ENTANDO_BOT_TOKEN" \ ; - #~ PUBLISH TO DOCKER IMAGE + #~ PUBLISH TO DOCKER - name: "Publish docker" + run: | + export ENTANDO_OPT_DOCKER_PASSWORD="${{ secrets.ENTANDO_OPT_DOCKER_PASSWORD }}" + export ENTANDO_OPT_DOCKER_ALT_LOGIN_URL="${{ secrets.ENTANDO_OPT_DOCKER_ALT_LOGIN }}" + export ENTANDO_OPT_DOCKER_ALT_USERNAME="${{ secrets.ENTANDO_OPT_DOCKER_ALT_USERNAME }}" + export ENTANDO_OPT_DOCKER_ALT_PASSWORD="${{ secrets.ENTANDO_OPT_DOCKER_ALT_PASSWORD }}" + + ~/ppl-run docker publish --id "PUBLISH-DOCKER" --lcd "$LOCAL_CLONE_DIR" + + # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + # POST PUB JOBS + + post-pub-docker-scan: + needs: [ 'publication' ] + if: needs.publication.outputs.POST_PUB_DOCKER_SCAN == 'true' + runs-on: ubuntu-latest + steps: + #~ CHECKOUT + - name: "CHECKOUT" + id: CHECKOUT + run: | + ${{ secrets.ENTANDO_OPT_PPL_INSTALL_CMD }} + ~/ppl-run \ + .. checkout-branch --id "CHECKOUT FOR PUBLICATION" \ + --lcd "$LOCAL_CLONE_DIR" \ + --token "$ENTANDO_BOT_TOKEN" \ + .. pr-preflight-checks --only flags --lcd "$LOCAL_CLONE_DIR" \ + ; + #~ NODE + - name: "Set up Node 14" + uses: actions/setup-node@v2 + with: + node-version: 14.x + #~ NPM CACHE + - name: "Cache NPM Packages" + id: package-cache + uses: actions/cache@v2 + with: + path: ~/.npm + key: ${{ runner.os }}-npm + #~ SCAN + - name: "Scan docker" env: + ENTANDO_OPT_SNYK_ORG: "${{ secrets.ENTANDO_OPT_SNYK_ORG }}" + SNYK_TOKEN: "${{ secrets.SNYK_TOKEN }}" ENTANDO_OPT_DOCKER_BUILDS: "${{ secrets.ENTANDO_OPT_DOCKER_BUILDS }}" ENTANDO_OPT_DOCKER_ORG: "${{ secrets.ENTANDO_OPT_DOCKER_ORG }}" - ENTANDO_OPT_DOCKER_USERNAME: "${{ secrets.ENTANDO_OPT_DOCKER_USERNAME }}" - ENTANDO_OPT_DOCKER_PASSWORD: "${{ secrets.ENTANDO_OPT_DOCKER_PASSWORD }}" run: | - ~/ppl-run docker publish "$ENTANDO_OPT_DOCKER_BUILDS"\ - --id "PUBLISH-DOCKER" \ - --lcd "$LOCAL_CLONE_DIR" + ~/ppl-run docker scan --id "SCAN-DOCKER" --lcd "$LOCAL_CLONE_DIR" + + post-dep-tests: + needs: [ 'publication' ] + if: needs.publication.outputs.POST_DEP_TESTS == 'true' + runs-on: ubuntu-latest + steps: + #~ CHECKOUT + - name: "CHECKOUT" + id: CHECKOUT + run: | + ${{ secrets.ENTANDO_OPT_PPL_INSTALL_CMD }} + ~/ppl-run \ + .. checkout-branch --id "CHECKOUT FOR PUBLICATION" \ + --lcd "$LOCAL_CLONE_DIR" \ + --token "$ENTANDO_BOT_TOKEN" \ + .. pr-preflight-checks --only flags --lcd "$LOCAL_CLONE_DIR" \ + ; + #~ NODE + - name: "Set up Node 14" + uses: actions/setup-node@v2 + with: + node-version: 14.x + #~ NPM CACHE + - name: "Cache NPM Packages" + id: package-cache + uses: actions/cache@v2 + with: + path: ~/.npm + key: ${{ runner.os }}-npm + #~ PUBLISH THE ARTIFACT + - name: "Post deployment tests" + run: | + ${{ secrets.ENTANDO_OPT_PPL_INSTALL_CMD }} + + export ENTANDO_OPT_OKD_LOGIN_TOKEN="${{ secrets.ENTANDO_OPT_OKD_LOGIN_TOKEN }}" + export ENTANDO_OPT_IMAGE_REGISTRY_CREDENTIALS="${{ secrets.ENTANDO_OPT_IMAGE_REGISTRY_CREDENTIALS }}" + export ENTANDO_OPT_DOCKER_USERNAME="${{ secrets.ENTANDO_OPT_DOCKER_USERNAME }}" + export ENTANDO_OPT_DOCKER_PASSWORD="${{ secrets.ENTANDO_OPT_DOCKER_PASSWORD }}" + export ENTANDO_OPT_TEST_TLS_CRT="${{ secrets.ENTANDO_OPT_TEST_TLS_CRT }}" + export ENTANDO_OPT_TEST_TLS_KEY="${{ secrets.ENTANDO_OPT_TEST_TLS_KEY }}" + + ~/ppl-run generic "POST-DEP-TESTS" --id "POST_DEP_TESTS" --lcd "$LOCAL_CLONE_DIR" \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 4d786dc4f..6554d47fb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,7 +5,7 @@ LABEL name="Entando App Builder" \ maintainer="dev@entando.com" \ vendor="Entando Inc." \ version="v${VERSION}" \ - release="7.2.0" \ + release="7.2.1" \ summary="Entando App Builder" \ description="The Entando App Builder is the front end environment to interact with the micro frontends, the WCMS, and other Entando components" diff --git a/README.md b/README.md index 9ec74555c..c2519833e 100644 --- a/README.md +++ b/README.md @@ -92,7 +92,7 @@ DOMAIN=//my.entando.com ### Clone and set up: - Make sure to have `git`, `npm` + `node` installed and up to date. -- `npm install`: installs npm dependencies +- `npm install`: installs npm dependencies. ### Deploy: @@ -153,7 +153,6 @@ src ## API Requests Api requests are being done using `@entando/apimanager`. For more information checkout the [documentation on NPM](https://www.npmjs.com/package/@entando/apimanager). - --- ## Apps diff --git a/package-lock.json b/package-lock.json index 7f02cb151..448767a4a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "app-builder", - "version": "7.2.0-SNAPSHOT", + "version": "7.2.1-SNAPSHOT", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -1043,9 +1043,9 @@ } }, "@rooks/use-mutation-observer": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/@rooks/use-mutation-observer/-/use-mutation-observer-3.4.0.tgz", - "integrity": "sha512-q10+v3WbvSt5fj55VMikTPaUZ9Yl+IYDsymodWr2+cKx0PD97VBeWYjk3xHJPqJgejBHwnrwiNkJKGFY5iW+WQ==" + "version": "4.11.2", + "resolved": "https://registry.npmjs.org/@rooks/use-mutation-observer/-/use-mutation-observer-4.11.2.tgz", + "integrity": "sha512-vpsdrZdr6TkB1zZJcHx+fR1YC/pHs2BaqcuYiEGjBVbwY5xcC49+h0hAUtQKHth3oJqXfIX/Ng8S7s5HFHdM/A==" }, "@sinonjs/commons": { "version": "1.8.3", @@ -6479,9 +6479,9 @@ "integrity": "sha512-ZIzRpLJrOj7jjP2miAtgqIfmzbxa4ZOr5jJc601zklsfEx9oTzmmj2nVpIPRpNlRTIh8lc1kyViIY7BWSGNmKw==" }, "detect-node-es": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/detect-node-es/-/detect-node-es-1.0.0.tgz", - "integrity": "sha512-S4AHriUkTX9FoFvL4G8hXDcx6t3gp2HpfCza3Q0v6S78gul2hKWifLQbeW+ZF89+hSm2ZIc/uF3J97ZgytgTRg==" + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/detect-node-es/-/detect-node-es-1.1.0.tgz", + "integrity": "sha512-ypdmJU/TbBby2Dxibuv7ZLW3Bs1QEmM7nHjEANfohJLvE0XVujisn1qPJcZxg+qDucsr+bP6fLD1rPS3AhJ7EQ==" }, "detect-port-alt": { "version": "1.1.6", @@ -9127,14 +9127,17 @@ } }, "focus-lock": { - "version": "0.6.8", - "resolved": "https://registry.npmjs.org/focus-lock/-/focus-lock-0.6.8.tgz", - "integrity": "sha512-vkHTluRCoq9FcsrldC0ulQHiyBYgVJB2CX53I8r0nTC6KnEij7Of0jpBspjt3/CuNb6fyoj3aOh9J2HgQUM0og==" + "version": "0.9.2", + "resolved": "https://registry.npmjs.org/focus-lock/-/focus-lock-0.9.2.tgz", + "integrity": "sha512-YtHxjX7a0IC0ZACL5wsX8QdncXofWpGPNoVMuI/nZUrPGp6LmNI6+D5j0pPj+v8Kw5EpweA+T5yImK0rnWf7oQ==", + "requires": { + "tslib": "^2.0.3" + } }, "focus-outline-manager": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/focus-outline-manager/-/focus-outline-manager-1.0.2.tgz", - "integrity": "sha1-e/NliGU0H7awjQQqA3udKGixGbU=" + "integrity": "sha512-bHWEmjLsTjGP9gVs7P3Hyl+oY5NlMW8aTSPdTJ+X2GKt6glDctt9fUCLbRV+d/l8NDC40+FxMjp9WlTQXaQALw==" }, "follow-redirects": { "version": "1.9.0", @@ -16457,11 +16460,26 @@ } }, "react-clientside-effect": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/react-clientside-effect/-/react-clientside-effect-1.2.2.tgz", - "integrity": "sha512-nRmoyxeok5PBO6ytPvSjKp9xwXg9xagoTK1mMjwnQxqM9Hd7MNPl+LS1bOSOe+CV2+4fnEquc7H/S8QD3q697A==", + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/react-clientside-effect/-/react-clientside-effect-1.2.6.tgz", + "integrity": "sha512-XGGGRQAKY+q25Lz9a/4EPqom7WRjz3z9R2k4jhVKA/puQFH/5Nt27vFZYql4m4NVNdUvX8PS3O7r/Zzm7cjUlg==", "requires": { - "@babel/runtime": "^7.0.0" + "@babel/runtime": "^7.12.13" + }, + "dependencies": { + "@babel/runtime": { + "version": "7.21.5", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.21.5.tgz", + "integrity": "sha512-8jI69toZqqcsnqGGqwGS4Qb1VwLOEp4hz+CXPywcvjs60u3B4Pom/U/7rm4W8tMOYEB+E9wgD0mW1l3r8qlI9Q==", + "requires": { + "regenerator-runtime": "^0.13.11" + } + }, + "regenerator-runtime": { + "version": "0.13.11", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz", + "integrity": "sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg==" + } } }, "react-codemirror2": { @@ -16811,36 +16829,16 @@ "integrity": "sha512-suNP+J1VU1MWFKcyt7RtjiSWUjvidmQSlqu+eHslq+342xCbGTYmC0mEhPCOHxlW0CywylOC1u2DFAT+bv4dBw==" }, "react-focus-lock": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/react-focus-lock/-/react-focus-lock-2.2.1.tgz", - "integrity": "sha512-47g0xYcCTZccdzKRGufepY8oZ3W1Qg+2hn6u9SHZ0zUB6uz/4K4xJe7yYFNZ1qT6m+2JDm82F6QgKeBTbjW4PQ==", + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/react-focus-lock/-/react-focus-lock-2.5.2.tgz", + "integrity": "sha512-WzpdOnEqjf+/A3EH9opMZWauag7gV0BxFl+EY4ElA4qFqYsUsBLnmo2sELbN5OC30S16GAWMy16B9DLPpdJKAQ==", "requires": { "@babel/runtime": "^7.0.0", - "focus-lock": "^0.6.6", + "focus-lock": "^0.9.1", "prop-types": "^15.6.2", - "react-clientside-effect": "^1.2.2", - "use-callback-ref": "^1.2.1", - "use-sidecar": "^1.0.1" - }, - "dependencies": { - "loose-envify": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", - "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", - "requires": { - "js-tokens": "^3.0.0 || ^4.0.0" - } - }, - "prop-types": { - "version": "15.7.2", - "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.7.2.tgz", - "integrity": "sha512-8QQikdH7//R2vurIJSutZ1smHYTcLpRWEOlHnzcWHmBYrOGUysKwSsrC89BCiFj3CbrfJ/nXFdJepOVrY1GCHQ==", - "requires": { - "loose-envify": "^1.4.0", - "object-assign": "^4.1.1", - "react-is": "^16.8.1" - } - } + "react-clientside-effect": "^1.2.5", + "use-callback-ref": "^1.2.5", + "use-sidecar": "^1.0.5" } }, "react-fontawesome": { @@ -17166,43 +17164,25 @@ } }, "reactour": { - "version": "1.18.0", - "resolved": "https://registry.npmjs.org/reactour/-/reactour-1.18.0.tgz", - "integrity": "sha512-de0Pa5NkDU6I8IyGl+7+rWdDcx3AskmJYK/yIKU11D9EPIN79qzn852gjJgvH/jXZqeEfa+rmMWg72vA0UkmgA==", + "version": "1.19.0", + "resolved": "https://registry.npmjs.org/reactour/-/reactour-1.19.0.tgz", + "integrity": "sha512-KHWX46yRXgQX1iD+cS/qI33VYH5jFgZeRxXIk4yJyIAGsTrDTwPeFFa6m7Pv+WX/CoEfggGfdSi2LPAkkuOkOg==", "requires": { - "@rooks/use-mutation-observer": "3.4.0", - "classnames": "2.2.6", + "@rooks/use-mutation-observer": "4.11.2", + "classnames": "2.3.1", "focus-outline-manager": "^1.0.2", "lodash.debounce": "4.0.8", "lodash.pick": "4.4.0", "prop-types": "15.7.2", - "react-focus-lock": "2.2.1", - "scroll-smooth": "1.1.0", + "react-focus-lock": "2.5.2", + "scroll-smooth": "1.1.1", "scrollparent": "2.0.1" }, "dependencies": { "classnames": { - "version": "2.2.6", - "resolved": "https://registry.npmjs.org/classnames/-/classnames-2.2.6.tgz", - "integrity": "sha512-JR/iSQOSt+LQIWwrwEzJ9uk0xfN3mTVYMwt1Ir5mUcSN6pU+V4zQFFaJsclJbPuAUQH+yfWef6tm7l1quW3C8Q==" - }, - "loose-envify": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", - "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", - "requires": { - "js-tokens": "^3.0.0 || ^4.0.0" - } - }, - "prop-types": { - "version": "15.7.2", - "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.7.2.tgz", - "integrity": "sha512-8QQikdH7//R2vurIJSutZ1smHYTcLpRWEOlHnzcWHmBYrOGUysKwSsrC89BCiFj3CbrfJ/nXFdJepOVrY1GCHQ==", - "requires": { - "loose-envify": "^1.4.0", - "object-assign": "^4.1.1", - "react-is": "^16.8.1" - } + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/classnames/-/classnames-2.3.1.tgz", + "integrity": "sha512-OlQdbZ7gLfGarSqxesMesDa5uz7KFbID8Kpq/SxIoNGDqY8lSYs0D+hhtBXhcdB3rcbXArFr7vlHheLk1voeNA==" } } }, @@ -18900,14 +18880,14 @@ } }, "scroll-smooth": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/scroll-smooth/-/scroll-smooth-1.1.0.tgz", - "integrity": "sha512-68OUOXKN/ykM/Dbp4Lhza3O9QQUuW/c01WTsZzDOUyVgb1I5QjT/awOHCCbuYTSV1QnExUQ9w+KcxmVxlXIiAg==" + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/scroll-smooth/-/scroll-smooth-1.1.1.tgz", + "integrity": "sha512-i9e/hJf0ODPEsy+AubE0zES6xdOuIvtebe5MvdSI1lB4t91k+O+8kV15CYfPN0yPH4j4hZUoKM3rVaPVcmiOoQ==" }, "scrollparent": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/scrollparent/-/scrollparent-2.0.1.tgz", - "integrity": "sha1-cV1bnMV3YPsivczDvvtb/gaxoxc=" + "integrity": "sha512-HSdN78VMvFCSGCkh0oYX/tY4R3P1DW61f8+TeZZ4j2VLgfwvw0bpRSOv4PCVKisktIwbzHCfZsx+rLbbDBqIBA==" }, "select-hose": { "version": "2.0.0", @@ -20962,24 +20942,20 @@ } }, "use-callback-ref": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/use-callback-ref/-/use-callback-ref-1.2.4.tgz", - "integrity": "sha512-rXpsyvOnqdScyied4Uglsp14qzag1JIemLeTWGKbwpotWht57hbP78aNT+Q4wdFKQfQibbUX4fb6Qb4y11aVOQ==" + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/use-callback-ref/-/use-callback-ref-1.3.0.tgz", + "integrity": "sha512-3FT9PRuRdbB9HfXhEq35u4oZkvpJ5kuYbpqhCfmiZyReuRgpnhDlbr2ZEnnuS0RrJAPn6l23xjFg9kpDM+Ms7w==", + "requires": { + "tslib": "^2.0.0" + } }, "use-sidecar": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/use-sidecar/-/use-sidecar-1.0.3.tgz", - "integrity": "sha512-ygJwGUBeQfWgDls7uTrlEDzJUUR67L8Rm14v/KfFtYCdHhtjHZx1Krb3DIQl3/Q5dJGfXLEQ02RY8BdNBv87SQ==", + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/use-sidecar/-/use-sidecar-1.1.2.tgz", + "integrity": "sha512-epTbsLuzZ7lPClpz2TyryBfztm7m+28DlEv2ZCQ3MDr5ssiwyOwGH/e5F9CkfWjJ1t4clvI58yF822/GUkjjhw==", "requires": { - "detect-node-es": "^1.0.0", - "tslib": "^1.9.3" - }, - "dependencies": { - "tslib": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", - "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" - } + "detect-node-es": "^1.1.0", + "tslib": "^2.0.0" } }, "user-home": { diff --git a/package.json b/package.json index ef5f2ed2e..8d2232c28 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "app-builder", - "version": "7.2.0-SNAPSHOT", + "version": "7.2.1-SNAPSHOT", "repository": "https://github.com/entando/app-builder", "private": true, "dependencies": { @@ -90,7 +90,7 @@ "react-router-dom": "^5.2.0", "react-roving-tabindex": "^1.0.0", "react-test-renderer": "^16.14.0", - "reactour": "^1.18.0", + "reactour": "^1.19.0", "redux": "^4.0.1", "redux-form": "^8.3.7", "redux-localstorage": "^0.4.1", diff --git a/src/helpers/entities.js b/src/helpers/entities.js index 42d690bc9..4b15ea793 100644 --- a/src/helpers/entities.js +++ b/src/helpers/entities.js @@ -56,7 +56,7 @@ export const getPayloadForForm = ( userProfile.attributes.forEach((attr) => { const { - code, value, values, listElements, elements, + code, value, values, listElements, elements, compositeelements, } = attr; const attrType = @@ -117,9 +117,9 @@ export const getPayloadForForm = ( } case TYPE_COMPOSITE: { const childProfileType = selectedProfileType.find(item => item.code === code); - if (elements && childProfileType) { + if (compositeelements && childProfileType) { formAttr[code] = getPayloadForForm( - username, { attributes: elements }, + username, { attributes: compositeelements }, childProfileType.compositeAttributes, defaultLanguage, ); @@ -205,12 +205,12 @@ export const getPayloadForApi = ( } case TYPE_COMPOSITE: { const childProfileType = selectedProfileType.find(item => item.code === key); - const elements = getPayloadForApi( + const compositeelements = getPayloadForApi( profile[key], childProfileType.compositeAttributes, defaultLanguage, ).attributes; - attr.push({ code: key, elements }); + attr.push({ code: key, compositeelements }); break; } default: diff --git a/src/locales/en.js b/src/locales/en.js index 88e8d6427..e3ad73e0a 100644 --- a/src/locales/en.js +++ b/src/locales/en.js @@ -910,6 +910,7 @@ export default { 'widget.page.clone.pageTitle': 'Clone widget', 'app.saveAndReplace': 'Save and Replace', 'user.myProfile.appSettingsSection': 'Preferences', + 'user.myProfile.disableContentMenu': 'Disable Content Menu', 'user.myProfile.wizardToggle': 'Welcome Wizard', 'user.myProfile.wizardToggleHelp': 'Enable or disable Welcome Wizard that guides you through the "Create first application" process', 'user.myProfile.translationWarning': 'Missing Translation Warning', @@ -1090,6 +1091,8 @@ export default { 'cms.label.modal.confirmCancel': 'Do you want to save all changes?', 'cms.label.dontSave': 'Don\'t save', 'cms.label.metadata': 'Metadata', + 'cms.contents.versioning.author': 'Author', + 'cms.versioning.list.lastModify': 'Last Modified', 'cms.label.modal.confirmpublish': 'Do you really want to publish {code}?', 'cms.label.modal.confirmunpublish': 'Do you really want to unpublish {code}?', 'cms.label.yes': 'Yes', diff --git a/src/locales/it.js b/src/locales/it.js index 3affaadbe..478741adf 100644 --- a/src/locales/it.js +++ b/src/locales/it.js @@ -910,6 +910,7 @@ export default { 'widget.page.clone.pageTitle': 'Clona widget', 'app.saveAndReplace': 'Salva e sostituisci', 'user.myProfile.appSettingsSection': 'Preferenze', + 'user.myProfile.disableContentMenu': 'Disabilita il menu dei contenuti', 'user.myProfile.wizardToggle': 'Welcome Wizard', 'user.myProfile.wizardToggleHelp': 'Abilita o disabilita la procedura guidata di benvenuto che guida l\'utente attraverso il processo "Crea prima applicazione"', 'user.myProfile.translationWarning': 'Avviso di traduzione mancante', @@ -1090,6 +1091,8 @@ export default { 'cms.label.modal.confirmCancel': 'Vuoi salvare le modifiche apportate? Le modifiche andranno perse se non le salvi', 'cms.label.dontSave': 'Non salvare', 'cms.label.metadata': 'Metadati', + 'cms.contents.versioning.author': 'Autore', + 'cms.versioning.list.lastModify': 'Ultima modifica', 'cms.label.modal.confirmpublish': 'Vuoi davvero pubblicare {code}?', 'cms.label.modal.confirmunpublish': 'Vuoi davvero annullare la pubblicazione di {code}?', 'cms.label.yes': 'sì', diff --git a/src/locales/pt.js b/src/locales/pt.js index f7a415c6e..a0ab67715 100644 --- a/src/locales/pt.js +++ b/src/locales/pt.js @@ -828,6 +828,8 @@ export default { 'app.seo.addMetatagHelp': 'Nesta seção, você pode adicionar um novo metatag (personalizado ou sugerido por um catálogo interno)', 'app.seo.inheritLangLabel': 'Herdar do idioma padrão', 'dashboard.pageList': 'Lista de páginas', + 'cms.contents.versioning.author': 'Autor', + 'cms.versioning.list.lastModify': 'última edição', 'widget.navigationBar.config.title': 'Navegação - Barra Horizontal', 'widget.navigationBar.config.expressionList': 'Lista de expressões', 'widget.navigationBar.config.page': 'Página', @@ -857,6 +859,7 @@ export default { 'widget.page.clone.pageTitle': 'Clone widget', 'app.saveAndReplace': 'Salvar e substituir', 'user.myProfile.appSettingsSection': 'Preferências', + 'user.myProfile.disableContentMenu': 'Desativar menu de conteúdo', 'user.myProfile.wizardToggle': 'Welcome Wizard', 'user.myProfile.wizardToggleHelp': 'Ative ou desative o Assistente de boas-vindas que o orienta no processo de "Criar o primeiro aplicativo"', 'user.myProfile.translationWarning': 'Aviso de tradução ausente', diff --git a/src/state/groups/reducer.js b/src/state/groups/reducer.js index 77ddbde59..6f3197900 100644 --- a/src/state/groups/reducer.js +++ b/src/state/groups/reducer.js @@ -68,6 +68,7 @@ export const selected = (state = {}, action = {}) => { switch (action.type) { case SET_SELECTED_GROUP: { return { + ...state, ...action.payload.group, referenceKeyList: getRefKeyList(action.payload.group), }; diff --git a/src/state/multi-tenancy/actions.js b/src/state/multi-tenancy/actions.js index 898042876..572e550dd 100644 --- a/src/state/multi-tenancy/actions.js +++ b/src/state/multi-tenancy/actions.js @@ -14,6 +14,9 @@ export const fetchCurrentTenant = () => async (dispatch) => { const json = await response.json(); if (response.ok && json.payload) { dispatch(setCurrentTenant(json.payload)); + // check on response and set tenant to unauthorized into state + } else if (response.status === 403) { + dispatch(setCurrentTenant({ unauthorized: true })); } else { dispatch(setCurrentTenant(null)); } diff --git a/src/state/user-preferences/actions.js b/src/state/user-preferences/actions.js index 1f6e0adac..19ab09454 100644 --- a/src/state/user-preferences/actions.js +++ b/src/state/user-preferences/actions.js @@ -32,6 +32,8 @@ export const updateUserPreferences = (user, preferences) => response.json().then((json) => { if (response.ok) { dispatch(setUserPreferences(json.payload)); + // send an event to micro frontends + window.dispatchEvent(new CustomEvent('user-preferences-updated', { detail: preferences })); if (preferences.showToast !== false) { dispatch(addToast( { id: 'userpreferences.edit.success' }, diff --git a/src/ui/app-tour/AppTour.js b/src/ui/app-tour/AppTour.js index bf855e117..6c53f390b 100644 --- a/src/ui/app-tour/AppTour.js +++ b/src/ui/app-tour/AppTour.js @@ -7,6 +7,23 @@ import { disableBodyScroll, enableBodyScroll } from 'body-scroll-lock'; import { FormattedMessage } from 'react-intl'; import { APP_TOUR_CANCELLED, APP_TOUR_STARTED } from 'state/app-tour/const'; +// This mutes warnings and errors of the library +// eslint-disable-next-line no-console +const originalWarn = console.warn; + +// eslint-disable-next-line no-console +console.warn = (message, ...args) => { + if ( + typeof message === 'string' && + message.includes("Please check the 'steps' Tour prop Array at position") + ) { + return; // Ignore the warning + } + + // Log the warning + originalWarn.apply(console, [message, ...args]); +}; + const mouseClickEvents = ['mouseover', 'hover', 'mousedown', 'click', 'mouseup']; export const simulateMouseClick = (element) => { mouseClickEvents.forEach(mouseEventType => @@ -118,8 +135,9 @@ class AppTour extends React.Component { onAppTourFinish, } = this.props; - const getStep3Element = () => document.getElementsByTagName('app-builder-menu')[0].shadowRoot.querySelector('.app-tour-step-3 > a'); - const getStep4Element = () => document.getElementsByTagName('app-builder-menu')[0].shadowRoot.querySelector('.app-tour-step-4 > a'); + const mfeAppBuilderMenu = document.getElementsByTagName('app-builder-menu') ? document.getElementsByTagName('app-builder-menu')[0] : null; + const getStep3Element = () => (mfeAppBuilderMenu ? mfeAppBuilderMenu.shadowRoot.querySelector('.app-tour-step-3 > a') : document.querySelector('.app-tour-step-3 > a')); + const getStep4Element = () => (mfeAppBuilderMenu ? mfeAppBuilderMenu.shadowRoot.querySelector('.app-tour-step-4 > a') : document.querySelector('.app-tour-step-4 > a')); const step5Element = document.querySelector('.app-tour-step-5'); const step8Element = document.querySelector('.PageTreeSelector__select-area'); diff --git a/src/ui/app/MfeContainer.js b/src/ui/app/MfeContainer.js index bcc2a283d..ce43f9bf9 100644 --- a/src/ui/app/MfeContainer.js +++ b/src/ui/app/MfeContainer.js @@ -10,6 +10,7 @@ import { getDomain } from 'helpers/resourcePath'; import { getSystemReport } from 'state/system/selectors'; import { useDynamicResourceUrl } from 'hooks/useDynamicResourceUrl'; import { selectCurrSystemConfigAdvancedSearch } from 'state/current-system-configuration/selectors'; +import { getUserPreferences } from 'state/user-preferences/selectors'; const MfeContainer = ({ id, history }) => { const { assetLoading, mfe } = useMfe({ mfeId: id }); @@ -18,6 +19,7 @@ const MfeContainer = ({ id, history }) => { const systemReport = useSelector(getSystemReport); const currentSystemConfigurationAdvancedSearchOn = useSelector(selectCurrSystemConfigAdvancedSearch); + const userPreferences = useSelector(getUserPreferences) || {}; const mfeResourceBasePath = useDynamicResourceUrl(mfe.assetsBasePath); @@ -32,6 +34,7 @@ const MfeContainer = ({ id, history }) => { adminConsoleUrl: getDomain(), systemReport, advancedSearchOn: currentSystemConfigurationAdvancedSearchOn, + disableContentMenu: userPreferences.disableContentMenu, }; if (JSON.stringify(entandoWindow.globals || {}) !== JSON.stringify(globals)) { @@ -44,7 +47,8 @@ const MfeContainer = ({ id, history }) => { window.entando = entandoWindow; }, [history, locale, mfe.assetsBasePath, mfe.widgetName, permissions, systemReport, - mfeResourceBasePath, currentSystemConfigurationAdvancedSearchOn]); + mfeResourceBasePath, currentSystemConfigurationAdvancedSearchOn, + userPreferences.disableContentMenu]); const params = { config: { diff --git a/src/ui/users/my-profile/AppSettingsForm.js b/src/ui/users/my-profile/AppSettingsForm.js index 91bb314a8..fb7a61d3e 100644 --- a/src/ui/users/my-profile/AppSettingsForm.js +++ b/src/ui/users/my-profile/AppSettingsForm.js @@ -44,6 +44,11 @@ export class AppSettingsFormBody extends Component { component={SwitchRenderer} name="wizard" /> + } + component={SwitchRenderer} + name="disableContentMenu" + /> } component={SwitchRenderer} diff --git a/test/helpers/entities.test.js b/test/helpers/entities.test.js index fc9f23901..4d9927889 100644 --- a/test/helpers/entities.test.js +++ b/test/helpers/entities.test.js @@ -302,7 +302,7 @@ describe('getPayloadForForm', () => { attributes: [ { code: 'someComposite', - elements: [ + compositeelements: [ { code: 'textChild', values: { [DEFAULT_LANGUAGE]: 'random text' } }, { code: 'booleanChild', value: false }, ], @@ -604,7 +604,7 @@ describe('getPayloadForApi', () => { }], testAssertions: (formAttr) => { const attribute = formAttr.attributes.find(attr => attr.code === 'myAttribute'); - expect(attribute).toHaveProperty('elements', [ + expect(attribute).toHaveProperty('compositeelements', [ { code: 'textChild', values: { [DEFAULT_LANGUAGE]: 'random text' } }, { code: 'booleanChild', value: false }, ]);