diff --git a/.github/workflows/cd-beta.yaml b/.github/workflows/cd-beta.yaml new file mode 100644 index 0000000000..c7a80376b7 --- /dev/null +++ b/.github/workflows/cd-beta.yaml @@ -0,0 +1,106 @@ +name: cd-beta + +on: + push: + branches: + - beta + +jobs: + # deploy_beta: + # runs-on: ubuntu-latest + # env: + # ENV: "prod" + + # steps: + # # This Clean step simply checks if there's already a workflow running from the last + # # commit and cancels it if there is. This helps us save on cloud cost in the long run. + # # See https://github.com/rokroskar/workflow-run-cleanup-action for more information. + # - name: Clean + # uses: rokroskar/workflow-run-cleanup-action@v0.2.2 + # env: + # GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + # if: "github.ref != 'refs/heads/master'" + # - name: Checkout Repo + # uses: actions/checkout@v2 + # - name: Auth with Gcloud + # uses: google-github-actions/auth@v0 + # with: + # credentials_json: ${{ secrets.GCP_DEV_SA_KEY }} + # - name: Set up Gcloud SDK + # uses: google-github-actions/setup-gcloud@v0 + # with: + # project_id: zesty-prod + # - name: Set up Node + # uses: actions/setup-node@v2 + # with: + # node-version: "16.5.0" + # cache: "npm" + # cache-dependency-path: package-lock.json + # - name: Install Dependencies + # run: npm install + # - name: Build + # run: npm run build:prod + # env: + # SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} + # - name: Deploy to Beta + # run: gcloud app deploy app.yaml --quiet --no-promote --version beta --project zesty-prod + + # failed_deploy_notification_to_slack: + # runs-on: ubuntu-latest + # if: ${{ failure() }} + # needs: deploy_beta + # steps: + # - name: Failed Deploy Notification To Slack + # uses: rtCamp/action-slack-notify@v2 + # env: + # SLACK_CHANNEL: code-deploy + # SLACK_COLOR: "#FF0000" + # SLACK_ICON: https://clipart.world/wp-content/uploads/2021/06/Rocket-Ship-clipart-png.png + # SLACK_MESSAGE: "PR merge by ${{ github.actor }} failed to deploy." + # SLACK_TITLE: FAILED Beta Deployment for manager-ui + # SLACK_USERNAME: Deploy Bot + # SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} + + # success_deploy_notification_to_slack: + # runs-on: ubuntu-latest + # if: ${{ success() }} + # needs: [deploy_beta] + # steps: + # - name: Success Deploy Notification To Slack + # uses: rtCamp/action-slack-notify@v2 + # env: + # SLACK_CHANNEL: code-deploy + # SLACK_COLOR: "#FF0000" + # SLACK_ICON: https://clipart.world/wp-content/uploads/2021/06/Rocket-Ship-clipart-png.png + # SLACK_MESSAGE: "PR merge by ${{ github.actor }} has been deployed to stage." + # SLACK_TITLE: Beta Deployment for manager-ui + # SLACK_USERNAME: Deploy Bot + # SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} + + create_stable_pr: + runs-on: ubuntu-latest + # needs: [deploy_beta] + steps: + - name: Checkout Repo + uses: actions/checkout@v2 + + - name: Check if PR exists + id: check + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + prs=$(gh pr list \ + --repo "$GITHUB_REPOSITORY" \ + --head 'beta' \ + --base 'stable' \ + --json title \ + --jq 'length') + if ((prs > 0)); then + echo "skip=true" >> "$GITHUB_OUTPUT" + fi + + - name: Create Stable Release + if: "!steps.check.outputs.skip" + run: gh pr create -B stable -H dev --title 'Stable Release' --body 'Created by Github action' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/cd-dev.yaml b/.github/workflows/cd-dev.yaml new file mode 100644 index 0000000000..799bd4f669 --- /dev/null +++ b/.github/workflows/cd-dev.yaml @@ -0,0 +1,108 @@ +name: cd-dev + +on: + # Uncomment to work on CD in development mode. + # pull_request: + # branches: [ master ] + push: + branches: + - dev +jobs: + deploy_dev: + runs-on: ubuntu-latest + env: + ENV: "dev" + + steps: + # This Clean step simply checks if there's already a workflow running from the last + # commit and cancels it if there is. This helps us save on cloud cost in the long run. + # See https://github.com/rokroskar/workflow-run-cleanup-action for more information. + - name: Clean + uses: rokroskar/workflow-run-cleanup-action@v0.2.2 + env: + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + if: "github.ref != 'refs/heads/master'" + - name: Checkout Repo + uses: actions/checkout@v2 + - name: Auth with Gcloud + uses: google-github-actions/auth@v2 + with: + credentials_json: ${{ secrets.GCP_DEV_SA_KEY }} + - name: Set up Gcloud SDK + uses: google-github-actions/setup-gcloud@v2 + with: + project_id: zesty-dev + - name: Set up Node + uses: actions/setup-node@v2 + with: + node-version: "16.5.0" + cache: "npm" + cache-dependency-path: package-lock.json + - name: Install Dependencies + run: npm install + - name: Build + run: npm run build:dev + env: + SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} + - name: Deploy to Dev + run: gcloud app deploy app.yaml --quiet --project zesty-dev + + failed_deploy_notification_to_slack: + runs-on: ubuntu-latest + if: ${{ failure() }} + needs: [deploy_dev] + steps: + - name: Failed Deploy Notification To Slack + uses: rtCamp/action-slack-notify@v2 + env: + SLACK_CHANNEL: code-deploy + SLACK_COLOR: "#FF2A08" + SLACK_ICON: https://brand.zesty.io/zesty-io-logo.svg + SLACK_MESSAGE: "PR merge by ${{ github.actor }} failed to deploy." + SLACK_TITLE: "FAILED: Dev Deployment for manager-ui" + SLACK_USERNAME: Deploy Bot + SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} + + success_deploy_notification_to_slack: + runs-on: ubuntu-latest + if: ${{ success() }} + needs: [deploy_dev] + steps: + - name: Success Deploy Notification To Slack + uses: rtCamp/action-slack-notify@v2 + env: + SLACK_CHANNEL: code-deploy + SLACK_COLOR: "#75BF43" + SLACK_ICON: https://brand.zesty.io/zesty-io-logo.svg + # SLACK_MESSAGE: "PR merge by ${{ github.actor }} has been deployed to stage." + SLACK_TITLE: "SUCCESS: Dev Deployment of manager-ui" + SLACK_USERNAME: Deploy Bot + SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} + + create_stage_pr: + runs-on: ubuntu-latest + needs: [deploy_dev] + steps: + - name: Checkout Repo + uses: actions/checkout@v2 + + - name: Check if PR exists + id: check + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + prs=$(gh pr list \ + --repo "$GITHUB_REPOSITORY" \ + --head 'dev' \ + --base 'stage' \ + --json title \ + --jq 'length') + if ((prs > 0)); then + echo "skip=true" >> "$GITHUB_OUTPUT" + fi + + - name: Create Stage Release + if: "!steps.check.outputs.skip" + run: gh pr create -B stage -H dev --title 'Stage Release' --body 'Created by Github action' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/cd-stable.yaml b/.github/workflows/cd-stable.yaml new file mode 100644 index 0000000000..b4abe2e85f --- /dev/null +++ b/.github/workflows/cd-stable.yaml @@ -0,0 +1,78 @@ +name: cd-stable + +on: + push: + branches: + - stable + +jobs: +# deploy_stable: +# runs-on: ubuntu-latest +# env: +# ENV: "prod" + +# steps: +# # This Clean step simply checks if there's already a workflow running from the last +# # commit and cancels it if there is. This helps us save on cloud cost in the long run. +# # See https://github.com/rokroskar/workflow-run-cleanup-action for more information. +# - name: Clean +# uses: rokroskar/workflow-run-cleanup-action@v0.2.2 +# env: +# GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" +# if: "github.ref != 'refs/heads/master'" +# - name: Checkout Repo +# uses: actions/checkout@v2 +# - name: Auth with Gcloud +# uses: google-github-actions/auth@v0 +# with: +# credentials_json: ${{ secrets.GCP_DEV_SA_KEY }} +# - name: Set up Gcloud SDK +# uses: google-github-actions/setup-gcloud@v0 +# with: +# project_id: zesty-prod +# - name: Set up Node +# uses: actions/setup-node@v2 +# with: +# node-version: "16.5.0" +# cache: "npm" +# cache-dependency-path: package-lock.json +# - name: Install Dependencies +# run: npm install +# - name: Build +# run: npm run build:prod +# env: +# SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} +# - name: Deploy Stable +# run: gcloud app deploy app.yaml --quiet --project zesty-prod + +# failed_deploy_notification_to_slack: +# runs-on: ubuntu-latest +# if: ${{ failure() }} +# needs: deploy_stable +# steps: +# - name: Failed Deploy Notification To Slack +# uses: rtCamp/action-slack-notify@v2 +# env: +# SLACK_CHANNEL: code-deploy +# SLACK_COLOR: "#FF0000" +# SLACK_ICON: https://clipart.world/wp-content/uploads/2021/06/Rocket-Ship-clipart-png.png +# SLACK_MESSAGE: "PR merge by ${{ github.actor }} failed to deploy." +# SLACK_TITLE: FAILED Stable Deployment for manager-ui +# SLACK_USERNAME: Deploy Bot +# SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} + +# success_deploy_notification_to_slack: +# runs-on: ubuntu-latest +# if: ${{ success() }} +# needs: [deploy_stable] +# steps: +# - name: Success Deploy Notification To Slack +# uses: rtCamp/action-slack-notify@v2 +# env: +# SLACK_CHANNEL: code-deploy +# SLACK_COLOR: "#FF0000" +# SLACK_ICON: https://clipart.world/wp-content/uploads/2021/06/Rocket-Ship-clipart-png.png +# SLACK_MESSAGE: "PR merge by ${{ github.actor }} has been deployed to stage." +# SLACK_TITLE: Stable Deployment for manager-ui +# SLACK_USERNAME: Deploy Bot +# SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} diff --git a/.github/workflows/cd-stage.yaml b/.github/workflows/cd-stage.yaml new file mode 100644 index 0000000000..524fc7ec3c --- /dev/null +++ b/.github/workflows/cd-stage.yaml @@ -0,0 +1,105 @@ +name: cd-stage + +on: + push: + branches: + - stage +jobs: + deploy_stage: + runs-on: ubuntu-latest + env: + ENV: "stage" + + steps: + # This Clean step simply checks if there's already a workflow running from the last + # commit and cancels it if there is. This helps us save on cloud cost in the long run. + # See https://github.com/rokroskar/workflow-run-cleanup-action for more information. + - name: Clean + uses: rokroskar/workflow-run-cleanup-action@v0.2.2 + env: + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + if: "github.ref != 'refs/heads/master'" + - name: Checkout Repo + uses: actions/checkout@v2 + - name: Auth with Gcloud + uses: google-github-actions/auth@v0 + with: + credentials_json: ${{ secrets.GCP_SA_KEY }} + - name: Set up Gcloud SDK + uses: google-github-actions/setup-gcloud@v0 + with: + project_id: zesty-stage + - name: Set up Node + uses: actions/setup-node@v2 + with: + node-version: "16.5.0" + cache: "npm" + cache-dependency-path: package-lock.json + - name: Install Dependencies + run: npm install + - name: Build + run: npm run build:stage + env: + SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} + - name: Deploy to Stage + run: gcloud app deploy app.yaml --quiet --project zesty-stage + + failed_deploy_notification_to_slack: + runs-on: ubuntu-latest + if: ${{ failure() }} + needs: [deploy_stage] + steps: + - name: Failed Deploy Notification To Slack + uses: rtCamp/action-slack-notify@v2 + env: + SLACK_CHANNEL: code-deploy + SLACK_COLOR: "#FF2A08" + SLACK_ICON: https://brand.zesty.io/zesty-io-logo.svg + SLACK_MESSAGE: "PR merge by ${{ github.actor }} failed to deploy." + SLACK_TITLE: "FAILED: Stage Deployment for manager-ui" + SLACK_USERNAME: Deploy Bot + SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} + + success_deploy_notification_to_slack: + runs-on: ubuntu-latest + if: ${{ success() }} + needs: [deploy_stage] + steps: + - name: Success Deploy Notification To Slack + uses: rtCamp/action-slack-notify@v2 + env: + SLACK_CHANNEL: code-deploy + SLACK_COLOR: "#75BF43" + SLACK_ICON: https://brand.zesty.io/zesty-io-logo.svg + # SLACK_MESSAGE: "PR merge by ${{ github.actor }} has been deployed to stage." + SLACK_TITLE: "SUCCESS: Stage Deployment of manager-ui" + SLACK_USERNAME: Deploy Bot + SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} + + create_beta_pr: + runs-on: ubuntu-latest + needs: [deploy_stage] + steps: + - name: Checkout Repo + uses: actions/checkout@v2 + + - name: Check if PR exists + id: check + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + prs=$(gh pr list \ + --repo "$GITHUB_REPOSITORY" \ + --head 'stage' \ + --base 'beta' \ + --json title \ + --jq 'length') + if ((prs > 0)); then + echo "skip=true" >> "$GITHUB_OUTPUT" + fi + + - name: Create Beta Release + if: "!steps.check.outputs.skip" + run: gh pr create -B beta -H stage --title 'Beta Release' --body 'Created by Github action' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/cd.yaml b/.github/workflows/cd.yaml deleted file mode 100644 index 4def727501..0000000000 --- a/.github/workflows/cd.yaml +++ /dev/null @@ -1,168 +0,0 @@ -name: cd - -on: - # Uncomment to work on CD in development mode. - # pull_request: - # branches: [ master ] - push: - branches: - - dev - workflow_dispatch: - -jobs: - deploy_to_dev: - runs-on: ubuntu-latest - env: - ENV: "dev" - - steps: - # This Clean step simply checks if there's already a workflow running from the last - # commit and cancels it if there is. This helps us save on cloud cost in the long run. - # See https://github.com/rokroskar/workflow-run-cleanup-action for more information. - - name: Clean - uses: rokroskar/workflow-run-cleanup-action@v0.2.2 - env: - GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" - if: "github.ref != 'refs/heads/master'" - - name: Checkout Repo - uses: actions/checkout@v2 - - name: Auth with Gcloud - uses: google-github-actions/auth@v0 - with: - credentials_json: ${{ secrets.GCP_DEV_SA_KEY }} - - name: Set up Gcloud SDK - uses: google-github-actions/setup-gcloud@v0 - with: - project_id: zesty-dev - - name: Set up Node - uses: actions/setup-node@v2 - with: - node-version: "16.5.0" - cache: "npm" - cache-dependency-path: package-lock.json - - name: Install Dependencies - run: npm install - - name: Build - run: npm run build:dev - env: - SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} - - name: Deploy to Dev - run: gcloud app deploy app.yaml --quiet --project zesty-dev - - name: Post Successful Dev Deploy Notification To Slack - uses: rtCamp/action-slack-notify@v2 - env: - SLACK_CHANNEL: devops - SLACK_COLOR: ${{ job.status }} - SLACK_ICON: https://clipart.world/wp-content/uploads/2021/06/Rocket-Ship-clipart-png.png - SLACK_MESSAGE: | - Use :eyes: to signal you have seen this message. - Use :white_check_mark: to signal you have successfully manually tested the deployed changes. - Use :x: to signal manual tests on deployed changes were unsuccessful and start a thread under this alert describing your remediation steps. - SLACK_TITLE: Successfully Deployed manager-ui to Dev - SLACK_USERNAME: Deploy Bot - SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} - - name: Create Pull Request - uses: peter-evans/create-pull-request@v6 - with: - branch: dev - base: beta - title: beta - # labels: - cancel_workflow_if_dev_deploy_failed: - runs-on: ubuntu-latest - if: ${{ failure() }} - needs: - - deploy_to_dev - steps: - - name: Post Failed Dev Deploy Notification To Slack - uses: rtCamp/action-slack-notify@v2 - env: - SLACK_CHANNEL: devops - SLACK_COLOR: "#FF0000" - SLACK_ICON: https://clipart.world/wp-content/uploads/2021/06/Rocket-Ship-clipart-png.png - SLACK_MESSAGE: "PR merge by ${{ github.actor }} has failed to deploy to dev." - SLACK_TITLE: Dev Deployment Failed for manager-ui - SLACK_USERNAME: Deploy Bot - SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} - - name: Cancel current workflow run - uses: actions/github-script@v4 - with: - script: | - github.actions.cancelWorkflowRun({ - owner: context.repo.owner, - repo: context.repo.repo, - run_id: context.runId - }) - # create_beta_pr: - # runs-on: ubuntu-latest - # steps: - - # deploy_to_stage: - # runs-on: ubuntu-latest - # env: - # ENV: "stage" - # needs: - # - deploy_to_dev - - # steps: - # # This Clean step simply checks if there's already a workflow running from the last - # # commit and cancels it if there is. This helps us save on cloud cost in the long run. - # # See https://github.com/rokroskar/workflow-run-cleanup-action for more information. - # - name: Clean - # uses: rokroskar/workflow-run-cleanup-action@v0.2.2 - # env: - # GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" - # if: "github.ref != 'refs/heads/master'" - # - name: Checkout Repo - # uses: actions/checkout@v2 - # - name: Auth with Gcloud - # uses: google-github-actions/auth@v0 - # with: - # credentials_json: ${{ secrets.GCP_SA_KEY }} - # - name: Set up Gcloud SDK - # uses: google-github-actions/setup-gcloud@v0 - # with: - # project_id: zesty-stage - # - name: Set up Node - # uses: actions/setup-node@v2 - # with: - # node-version: "16.5.0" - # cache: "npm" - # cache-dependency-path: package-lock.json - # - name: Install Dependencies - # run: npm install - # - name: Build - # run: npm run build:stage - # env: - # SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} - # - name: Deploy to Staging - # run: gcloud app deploy app.yaml --quiet --project zesty-stage - # - name: Post Successful Stage Deploy Notification To Slack - # uses: rtCamp/action-slack-notify@v2 - # env: - # SLACK_CHANNEL: devops - # SLACK_COLOR: ${{ job.status }} - # SLACK_ICON: https://clipart.world/wp-content/uploads/2021/06/Rocket-Ship-clipart-png.png - # SLACK_MESSAGE: | - # Use :eyes: to signal you have seen this message. - # Use :white_check_mark: to signal you have successfully manually tested the deployed changes. - # Use :x: to signal manual tests on deployed changes were unsuccessful and start a thread under this alert describing your remediation steps. - # SLACK_TITLE: Successfully Deployed manager-ui to Stage - # SLACK_USERNAME: Deploy Bot - # SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} - # post_failed_stage_deploy_notification_to_slack: - # runs-on: ubuntu-latest - # if: ${{ failure() }} - # needs: - # - deploy_to_stage - # steps: - # - name: Post Failed Staging Deploy Notification To Slack - # uses: rtCamp/action-slack-notify@v2 - # env: - # SLACK_CHANNEL: devops - # SLACK_COLOR: "#FF0000" - # SLACK_ICON: https://clipart.world/wp-content/uploads/2021/06/Rocket-Ship-clipart-png.png - # SLACK_MESSAGE: "PR merge by ${{ github.actor }} has failed to deploy to staging." - # SLACK_TITLE: Staging Deployment Failed for manager-ui - # SLACK_USERNAME: Deploy Bot - # SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} diff --git a/README.md b/README.md index b27e26c1f2..d878e66101 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ A redux store is used to manage state across all of the potential sub-apps. The ## Requirements -- Node.js version 12 LTS +- Node.js version 16 LTS - Web browser: Chrome / Firefox / Edge / Safari (latest) - Redux DevTools Extension - https://github.com/zalmoxisus/redux-devtools-extension diff --git a/package-lock.json b/package-lock.json index a149c759a2..8f2a2fd6ed 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8,10 +8,8 @@ "version": "1.0.1", "license": "Commons Clause License Condition v1.0", "dependencies": { - "-": "^0.0.1", "@aeaton/react-prosemirror": "^0.21.1", "@aeaton/react-prosemirror-config-default": "^0.11.0", - "@babel/runtime": "^7.10.4", "@fortawesome/fontawesome-svg-core": "^1.2.35", "@fortawesome/free-brands-svg-icons": "^5.15.3", "@fortawesome/free-solid-svg-icons": "^5.14.0", @@ -84,6 +82,7 @@ "@babel/plugin-transform-runtime": "^7.10.4", "@babel/preset-env": "^7.14.7", "@babel/preset-react": "^7.14.5", + "@babel/runtime": "^7.10.4", "@foreachbe/cypress-tinymce": "^1.0.0", "@sentry/cli": "^2.2.0", "@sentry/webpack-plugin": "^1.18.9", @@ -126,11 +125,6 @@ "webpack-dev-server": "^3.11.2" } }, - "node_modules/-": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/-/-/--0.0.1.tgz", - "integrity": "sha512-3HfneK3DGAm05fpyj20sT3apkNcvPpCuccOThOPdzz8sY7GgQGe0l93XH9bt+YzibcTIgUAIMoyVJI740RtgyQ==" - }, "node_modules/@aeaton/prosemirror-footnotes": { "version": "0.1.0", "license": "MIT", @@ -204,7 +198,6 @@ }, "node_modules/@ampproject/remapping": { "version": "2.2.0", - "dev": true, "license": "Apache-2.0", "dependencies": { "@jridgewell/gen-mapping": "^0.1.0", @@ -254,7 +247,6 @@ }, "node_modules/@babel/compat-data": { "version": "7.17.10", - "dev": true, "license": "MIT", "engines": { "node": ">=6.9.0" @@ -262,7 +254,6 @@ }, "node_modules/@babel/core": { "version": "7.17.12", - "dev": true, "license": "MIT", "dependencies": { "@ampproject/remapping": "^2.1.0", @@ -291,7 +282,6 @@ }, "node_modules/@babel/generator": { "version": "7.18.7", - "dev": true, "license": "MIT", "dependencies": { "@babel/types": "^7.18.7", @@ -304,7 +294,6 @@ }, "node_modules/@babel/generator/node_modules/@jridgewell/gen-mapping": { "version": "0.3.2", - "dev": true, "license": "MIT", "dependencies": { "@jridgewell/set-array": "^1.0.1", @@ -340,7 +329,6 @@ }, "node_modules/@babel/helper-compilation-targets": { "version": "7.17.10", - "dev": true, "license": "MIT", "dependencies": { "@babel/compat-data": "^7.17.10", @@ -410,7 +398,6 @@ }, "node_modules/@babel/helper-environment-visitor": { "version": "7.18.6", - "dev": true, "license": "MIT", "engines": { "node": ">=6.9.0" @@ -429,7 +416,6 @@ }, "node_modules/@babel/helper-function-name": { "version": "7.18.6", - "dev": true, "license": "MIT", "dependencies": { "@babel/template": "^7.18.6", @@ -441,7 +427,6 @@ }, "node_modules/@babel/helper-hoist-variables": { "version": "7.18.6", - "dev": true, "license": "MIT", "dependencies": { "@babel/types": "^7.18.6" @@ -473,7 +458,6 @@ }, "node_modules/@babel/helper-module-transforms": { "version": "7.17.12", - "dev": true, "license": "MIT", "dependencies": { "@babel/helper-environment-visitor": "^7.16.7", @@ -537,7 +521,6 @@ }, "node_modules/@babel/helper-simple-access": { "version": "7.17.7", - "dev": true, "license": "MIT", "dependencies": { "@babel/types": "^7.17.0" @@ -559,7 +542,6 @@ }, "node_modules/@babel/helper-split-export-declaration": { "version": "7.18.6", - "dev": true, "license": "MIT", "dependencies": { "@babel/types": "^7.18.6" @@ -577,7 +559,6 @@ }, "node_modules/@babel/helper-validator-option": { "version": "7.18.6", - "dev": true, "license": "MIT", "engines": { "node": ">=6.9.0" @@ -599,7 +580,6 @@ }, "node_modules/@babel/helpers": { "version": "7.17.9", - "dev": true, "license": "MIT", "dependencies": { "@babel/template": "^7.16.7", @@ -624,7 +604,6 @@ }, "node_modules/@babel/parser": { "version": "7.18.8", - "dev": true, "license": "MIT", "bin": { "parser": "bin/babel-parser.js" @@ -1772,7 +1751,6 @@ }, "node_modules/@babel/template": { "version": "7.18.6", - "dev": true, "license": "MIT", "dependencies": { "@babel/code-frame": "^7.18.6", @@ -1785,7 +1763,6 @@ }, "node_modules/@babel/traverse": { "version": "7.18.8", - "dev": true, "license": "MIT", "dependencies": { "@babel/code-frame": "^7.18.6", @@ -2282,7 +2259,6 @@ }, "node_modules/@jridgewell/gen-mapping": { "version": "0.1.1", - "dev": true, "license": "MIT", "dependencies": { "@jridgewell/set-array": "^1.0.0", @@ -2294,7 +2270,6 @@ }, "node_modules/@jridgewell/resolve-uri": { "version": "3.0.7", - "dev": true, "license": "MIT", "engines": { "node": ">=6.0.0" @@ -2302,7 +2277,6 @@ }, "node_modules/@jridgewell/set-array": { "version": "1.1.1", - "dev": true, "license": "MIT", "engines": { "node": ">=6.0.0" @@ -2310,12 +2284,10 @@ }, "node_modules/@jridgewell/sourcemap-codec": { "version": "1.4.13", - "dev": true, "license": "MIT" }, "node_modules/@jridgewell/trace-mapping": { "version": "0.3.13", - "dev": true, "license": "MIT", "dependencies": { "@jridgewell/resolve-uri": "^3.0.3", @@ -3548,7 +3520,7 @@ "version": "16.18.57", "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.57.tgz", "integrity": "sha512-piPoDozdPaX1hNWFJQzzgWqE40gh986VvVx/QO9RU4qYRE55ld7iepDVgZ3ccGUw0R4wge0Oy1dd+3xOQNkkUQ==", - "dev": true + "devOptional": true }, "node_modules/@types/parse-json": { "version": "4.0.0", @@ -4824,7 +4796,6 @@ }, "node_modules/browserslist": { "version": "4.20.3", - "dev": true, "funding": [ { "type": "opencollective", @@ -4979,7 +4950,6 @@ }, "node_modules/caniuse-lite": { "version": "1.0.30001341", - "dev": true, "funding": [ { "type": "opencollective", @@ -6268,12 +6238,11 @@ }, "node_modules/dayjs": { "version": "1.11.2", - "dev": true, + "devOptional": true, "license": "MIT" }, "node_modules/debug": { "version": "4.3.4", - "dev": true, "license": "MIT", "dependencies": { "ms": "2.1.2" @@ -6803,7 +6772,6 @@ }, "node_modules/electron-to-chromium": { "version": "1.4.137", - "dev": true, "license": "ISC" }, "node_modules/elliptic": { @@ -7935,7 +7903,6 @@ }, "node_modules/gensync": { "version": "1.0.0-beta.2", - "dev": true, "license": "MIT", "engines": { "node": ">=6.9.0" @@ -8069,7 +8036,6 @@ }, "node_modules/globals": { "version": "11.12.0", - "dev": true, "license": "MIT", "engines": { "node": ">=4" @@ -9440,7 +9406,6 @@ }, "node_modules/jsesc": { "version": "2.5.2", - "dev": true, "license": "MIT", "bin": { "jsesc": "bin/jsesc" @@ -9476,7 +9441,6 @@ }, "node_modules/json5": { "version": "2.2.1", - "dev": true, "license": "MIT", "bin": { "json5": "lib/cli.js" @@ -10274,7 +10238,6 @@ }, "node_modules/ms": { "version": "2.1.2", - "dev": true, "license": "MIT" }, "node_modules/multicast-dns": { @@ -10483,7 +10446,6 @@ }, "node_modules/node-releases": { "version": "2.0.4", - "dev": true, "license": "MIT" }, "node_modules/nopt": { @@ -11046,7 +11008,6 @@ }, "node_modules/picocolors": { "version": "1.0.0", - "dev": true, "license": "ISC" }, "node_modules/picomatch": { @@ -12548,7 +12509,6 @@ }, "node_modules/semver": { "version": "6.3.0", - "dev": true, "license": "ISC", "bin": { "semver": "bin/semver.js" @@ -15730,11 +15690,6 @@ } }, "dependencies": { - "-": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/-/-/--0.0.1.tgz", - "integrity": "sha512-3HfneK3DGAm05fpyj20sT3apkNcvPpCuccOThOPdzz8sY7GgQGe0l93XH9bt+YzibcTIgUAIMoyVJI740RtgyQ==" - }, "@aeaton/prosemirror-footnotes": { "version": "0.1.0", "requires": { @@ -15792,7 +15747,6 @@ }, "@ampproject/remapping": { "version": "2.2.0", - "dev": true, "requires": { "@jridgewell/gen-mapping": "^0.1.0", "@jridgewell/trace-mapping": "^0.3.9" @@ -15820,12 +15774,10 @@ } }, "@babel/compat-data": { - "version": "7.17.10", - "dev": true + "version": "7.17.10" }, "@babel/core": { "version": "7.17.12", - "dev": true, "requires": { "@ampproject/remapping": "^2.1.0", "@babel/code-frame": "^7.16.7", @@ -15846,7 +15798,6 @@ }, "@babel/generator": { "version": "7.18.7", - "dev": true, "requires": { "@babel/types": "^7.18.7", "@jridgewell/gen-mapping": "^0.3.2", @@ -15855,7 +15806,6 @@ "dependencies": { "@jridgewell/gen-mapping": { "version": "0.3.2", - "dev": true, "requires": { "@jridgewell/set-array": "^1.0.1", "@jridgewell/sourcemap-codec": "^1.4.10", @@ -15881,7 +15831,6 @@ }, "@babel/helper-compilation-targets": { "version": "7.17.10", - "dev": true, "requires": { "@babel/compat-data": "^7.17.10", "@babel/helper-validator-option": "^7.16.7", @@ -15925,8 +15874,7 @@ } }, "@babel/helper-environment-visitor": { - "version": "7.18.6", - "dev": true + "version": "7.18.6" }, "@babel/helper-explode-assignable-expression": { "version": "7.16.7", @@ -15937,7 +15885,6 @@ }, "@babel/helper-function-name": { "version": "7.18.6", - "dev": true, "requires": { "@babel/template": "^7.18.6", "@babel/types": "^7.18.6" @@ -15945,7 +15892,6 @@ }, "@babel/helper-hoist-variables": { "version": "7.18.6", - "dev": true, "requires": { "@babel/types": "^7.18.6" } @@ -15965,7 +15911,6 @@ }, "@babel/helper-module-transforms": { "version": "7.17.12", - "dev": true, "requires": { "@babel/helper-environment-visitor": "^7.16.7", "@babel/helper-module-imports": "^7.16.7", @@ -16009,7 +15954,6 @@ }, "@babel/helper-simple-access": { "version": "7.17.7", - "dev": true, "requires": { "@babel/types": "^7.17.0" } @@ -16023,7 +15967,6 @@ }, "@babel/helper-split-export-declaration": { "version": "7.18.6", - "dev": true, "requires": { "@babel/types": "^7.18.6" } @@ -16032,8 +15975,7 @@ "version": "7.18.6" }, "@babel/helper-validator-option": { - "version": "7.18.6", - "dev": true + "version": "7.18.6" }, "@babel/helper-wrap-function": { "version": "7.16.8", @@ -16047,7 +15989,6 @@ }, "@babel/helpers": { "version": "7.17.9", - "dev": true, "requires": { "@babel/template": "^7.16.7", "@babel/traverse": "^7.17.9", @@ -16063,8 +16004,7 @@ } }, "@babel/parser": { - "version": "7.18.8", - "dev": true + "version": "7.18.8" }, "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression": { "version": "7.17.12", @@ -16730,7 +16670,6 @@ }, "@babel/template": { "version": "7.18.6", - "dev": true, "requires": { "@babel/code-frame": "^7.18.6", "@babel/parser": "^7.18.6", @@ -16739,7 +16678,6 @@ }, "@babel/traverse": { "version": "7.18.8", - "dev": true, "requires": { "@babel/code-frame": "^7.18.6", "@babel/generator": "^7.18.7", @@ -17073,27 +17011,22 @@ }, "@jridgewell/gen-mapping": { "version": "0.1.1", - "dev": true, "requires": { "@jridgewell/set-array": "^1.0.0", "@jridgewell/sourcemap-codec": "^1.4.10" } }, "@jridgewell/resolve-uri": { - "version": "3.0.7", - "dev": true + "version": "3.0.7" }, "@jridgewell/set-array": { - "version": "1.1.1", - "dev": true + "version": "1.1.1" }, "@jridgewell/sourcemap-codec": { - "version": "1.4.13", - "dev": true + "version": "1.4.13" }, "@jridgewell/trace-mapping": { "version": "0.3.13", - "dev": true, "requires": { "@jridgewell/resolve-uri": "^3.0.3", "@jridgewell/sourcemap-codec": "^1.4.10" @@ -17250,7 +17183,8 @@ "@mui/types": { "version": "7.2.9", "resolved": "https://registry.npmjs.org/@mui/types/-/types-7.2.9.tgz", - "integrity": "sha512-k1lN/PolaRZfNsRdAqXtcR71sTnv3z/VCCGPxU8HfdftDkzi335MdJ6scZxvofMAd/K/9EbzCZTFBmlNpQVdCg==" + "integrity": "sha512-k1lN/PolaRZfNsRdAqXtcR71sTnv3z/VCCGPxU8HfdftDkzi335MdJ6scZxvofMAd/K/9EbzCZTFBmlNpQVdCg==", + "requires": {} }, "@mui/utils": { "version": "5.14.18", @@ -17473,12 +17407,14 @@ }, "dependencies": { "redux-thunk": { - "version": "2.4.1" + "version": "2.4.1", + "requires": {} } } }, "@researchgate/react-intersection-observer": { - "version": "1.3.5" + "version": "1.3.5", + "requires": {} }, "@riotjs/observable": { "version": "4.1.1" @@ -17785,7 +17721,7 @@ "version": "16.18.57", "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.57.tgz", "integrity": "sha512-piPoDozdPaX1hNWFJQzzgWqE40gh986VvVx/QO9RU4qYRE55ld7iepDVgZ3ccGUw0R4wge0Oy1dd+3xOQNkkUQ==", - "dev": true + "devOptional": true }, "@types/parse-json": { "version": "4.0.0" @@ -18010,7 +17946,8 @@ }, "@webpack-cli/configtest": { "version": "1.1.1", - "dev": true + "dev": true, + "requires": {} }, "@webpack-cli/info": { "version": "1.4.1", @@ -18021,7 +17958,8 @@ }, "@webpack-cli/serve": { "version": "1.6.1", - "dev": true + "dev": true, + "requires": {} }, "@welldone-software/why-did-you-render": { "version": "6.2.3", @@ -18085,7 +18023,8 @@ }, "acorn-import-assertions": { "version": "1.8.0", - "dev": true + "dev": true, + "requires": {} }, "agent-base": { "version": "6.0.2", @@ -18114,7 +18053,8 @@ }, "ajv-errors": { "version": "1.0.1", - "dev": true + "dev": true, + "requires": {} }, "ajv-formats": { "version": "2.1.1", @@ -18141,7 +18081,8 @@ }, "ajv-keywords": { "version": "3.5.2", - "dev": true + "dev": true, + "requires": {} }, "ansi-align": { "version": "2.0.0", @@ -18677,7 +18618,6 @@ }, "browserslist": { "version": "4.20.3", - "dev": true, "requires": { "caniuse-lite": "^1.0.30001332", "electron-to-chromium": "^1.4.118", @@ -18767,8 +18707,7 @@ "dev": true }, "caniuse-lite": { - "version": "1.0.30001341", - "dev": true + "version": "1.0.30001341" }, "caseless": { "version": "0.12.0", @@ -18793,10 +18732,12 @@ "version": "3.8.0" }, "chartjs-adapter-moment": { - "version": "1.0.1" + "version": "1.0.1", + "requires": {} }, "chartjs-plugin-datalabels": { - "version": "2.0.0" + "version": "2.0.0", + "requires": {} }, "check-more-types": { "version": "2.24.0", @@ -19610,7 +19551,8 @@ }, "cypress-iframe": { "version": "1.0.1", - "dev": true + "dev": true, + "requires": {} }, "dashdash": { "version": "1.14.1", @@ -19626,11 +19568,10 @@ }, "dayjs": { "version": "1.11.2", - "dev": true + "devOptional": true }, "debug": { "version": "4.3.4", - "dev": true, "requires": { "ms": "2.1.2" } @@ -19989,8 +19930,7 @@ "dev": true }, "electron-to-chromium": { - "version": "1.4.137", - "dev": true + "version": "1.4.137" }, "elliptic": { "version": "6.5.4", @@ -20766,8 +20706,7 @@ } }, "gensync": { - "version": "1.0.0-beta.2", - "dev": true + "version": "1.0.0-beta.2" }, "get-caller-file": { "version": "2.0.5" @@ -20849,8 +20788,7 @@ } }, "globals": { - "version": "11.12.0", - "dev": true + "version": "11.12.0" }, "globby": { "version": "11.1.0", @@ -21276,7 +21214,8 @@ }, "icss-utils": { "version": "5.1.0", - "dev": true + "dev": true, + "requires": {} }, "idb-keyval": { "version": "5.1.5", @@ -21639,7 +21578,8 @@ "dev": true }, "ismounted": { - "version": "0.1.8" + "version": "0.1.8", + "requires": {} }, "isobject": { "version": "3.0.1" @@ -21705,8 +21645,7 @@ "dev": true }, "jsesc": { - "version": "2.5.2", - "dev": true + "version": "2.5.2" }, "json-parse-even-better-errors": { "version": "2.3.1" @@ -21731,8 +21670,7 @@ "version": "1.0.2" }, "json5": { - "version": "2.2.1", - "dev": true + "version": "2.2.1" }, "jsonfile": { "version": "6.1.0", @@ -22238,8 +22176,7 @@ "dev": true }, "ms": { - "version": "2.1.2", - "dev": true + "version": "2.1.2" }, "multicast-dns": { "version": "6.2.3", @@ -22386,8 +22323,7 @@ } }, "node-releases": { - "version": "2.0.4", - "dev": true + "version": "2.0.4" }, "nopt": { "version": "5.0.0", @@ -22751,8 +22687,7 @@ "dev": true }, "picocolors": { - "version": "1.0.0", - "dev": true + "version": "1.0.0" }, "picomatch": { "version": "2.3.1", @@ -22827,7 +22762,8 @@ }, "postcss-modules-extract-imports": { "version": "3.0.0", - "dev": true + "dev": true, + "requires": {} }, "postcss-modules-local-by-default": { "version": "4.0.0", @@ -23219,13 +23155,16 @@ } }, "react-chartjs-2": { - "version": "4.3.1" + "version": "4.3.1", + "requires": {} }, "react-codemirror2": { - "version": "7.2.1" + "version": "7.2.1", + "requires": {} }, "react-cool-onclickoutside": { - "version": "1.7.0" + "version": "1.7.0", + "requires": {} }, "react-dnd": { "version": "14.0.5", @@ -23360,7 +23299,8 @@ } }, "react-universal-interface": { - "version": "0.6.2" + "version": "0.6.2", + "requires": {} }, "react-use": { "version": "17.3.2", @@ -23387,10 +23327,12 @@ } }, "react-virtualized-auto-sizer": { - "version": "1.0.7" + "version": "1.0.7", + "requires": {} }, "react-virtualized-sticky-tree": { - "version": "2.1.30" + "version": "2.1.30", + "requires": {} }, "react-window": { "version": "1.8.7", @@ -23430,7 +23372,8 @@ } }, "redux-devtools-extension": { - "version": "2.13.9" + "version": "2.13.9", + "requires": {} }, "redux-sentry-middleware": { "version": "0.2.2" @@ -23632,7 +23575,8 @@ "dev": true }, "rifm": { - "version": "0.12.1" + "version": "0.12.1", + "requires": {} }, "rimraf": { "version": "3.0.2", @@ -23734,8 +23678,7 @@ } }, "semver": { - "version": "6.3.0", - "dev": true + "version": "6.3.0" }, "send": { "version": "0.18.0", @@ -24500,7 +24443,8 @@ }, "style-loader": { "version": "3.3.1", - "dev": true + "dev": true, + "requires": {} }, "stylis": { "version": "4.0.13" @@ -25018,11 +24962,13 @@ }, "use-composed-ref": { "version": "1.3.0", - "dev": true + "dev": true, + "requires": {} }, "use-isomorphic-layout-effect": { "version": "1.1.2", - "dev": true + "dev": true, + "requires": {} }, "use-latest": { "version": "1.2.1", diff --git a/package.json b/package.json index 5c85f668d0..a6697fd282 100644 --- a/package.json +++ b/package.json @@ -37,10 +37,8 @@ "test:open": "./node_modules/.bin/cypress open" }, "dependencies": { - "-": "^0.0.1", "@aeaton/react-prosemirror": "^0.21.1", "@aeaton/react-prosemirror-config-default": "^0.11.0", - "@babel/runtime": "^7.10.4", "@fortawesome/fontawesome-svg-core": "^1.2.35", "@fortawesome/free-brands-svg-icons": "^5.15.3", "@fortawesome/free-solid-svg-icons": "^5.14.0", @@ -113,6 +111,7 @@ "@babel/plugin-transform-runtime": "^7.10.4", "@babel/preset-env": "^7.14.7", "@babel/preset-react": "^7.14.5", + "@babel/runtime": "^7.10.4", "@foreachbe/cypress-tinymce": "^1.0.0", "@sentry/cli": "^2.2.0", "@sentry/webpack-plugin": "^1.18.9", diff --git a/src/apps/reports/src/app/views/ActivityLog/views/ResourceDetails.js b/src/apps/reports/src/app/views/ActivityLog/views/ResourceDetails.js index d44a7e5cb8..fc0b521d15 100644 --- a/src/apps/reports/src/app/views/ActivityLog/views/ResourceDetails.js +++ b/src/apps/reports/src/app/views/ActivityLog/views/ResourceDetails.js @@ -19,6 +19,7 @@ import { filterByParams } from "utility/filterByParams"; import { resolveUrlFromAudit } from "../../../../../../../utility/resolveResourceUrlFromAudit"; import { CustomBreadcrumbs } from "../../../../../../../shell/components/CustomBreadcrumbs"; import { ResourceHeaderTitle } from "../components/ResourceHeaderTitle"; +import { useGetInstanceSettingsQuery } from "../../../../../../../shell/services/instance"; const Crumbs = [ { @@ -37,6 +38,7 @@ export const ResourceDetails = () => { const history = useHistory(); const [params, setParams] = useParams(); const [initialized, setInitialized] = useState(false); + const { data: rawInstanceSettings } = useGetInstanceSettingsQuery(); const zuid = useMemo( () => location.pathname.split("/").pop(), @@ -168,7 +170,11 @@ export const ResourceDetails = () => { size="small" disabled={!actionsByZuid[0] || !actionsByZuid[0]?.meta} onClick={() => { - history.push(resolveUrlFromAudit(actionsByZuid[0])); + const category = rawInstanceSettings.find( + (setting) => setting.ZUID === actionsByZuid[0]?.affectedZUID + )?.category; + + history.push(resolveUrlFromAudit(actionsByZuid[0], category)); }} > Open diff --git a/src/shell/services/types.ts b/src/shell/services/types.ts index 171f28ba6a..fa711126b9 100644 --- a/src/shell/services/types.ts +++ b/src/shell/services/types.ts @@ -244,7 +244,7 @@ export interface AuditMeta { export interface Audit { ZUID: string; - resourceType: "content" | "schema" | "code"; + resourceType: "content" | "schema" | "code" | "settings"; affectedZUID: string; actionByUserZUID: string; entityZUID: string; diff --git a/src/utility/resolveResourceUrlFromAudit.ts b/src/utility/resolveResourceUrlFromAudit.ts index 66fb0017fc..38201095ad 100644 --- a/src/utility/resolveResourceUrlFromAudit.ts +++ b/src/utility/resolveResourceUrlFromAudit.ts @@ -1,10 +1,9 @@ import { Audit } from "../shell/services/types"; -export const resolveUrlFromAudit = ({ - resourceType, - meta, - affectedZUID, -}: Audit): string => { +export const resolveUrlFromAudit = ( + { resourceType, meta, affectedZUID }: Audit, + category?: string +): string => { switch (resourceType) { case "content": const primaryZUID = meta.uri.split("/")[4]; @@ -14,6 +13,8 @@ export const resolveUrlFromAudit = ({ case "code": const codeType = meta.uri.split("/")[3]; return `/code/file/${codeType}/${affectedZUID}`; + case "settings": + return category ? `/settings/instance/${category}` : "/settings"; default: return "/"; }