diff --git a/.all-contributorsrc b/.all-contributorsrc index d5b9902d10..d4b7c470a6 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -702,6 +702,15 @@ "contributions": [ "code" ] + }, + { + "login": "RobinFrcd", + "name": "Robin Fourcade", + "avatar_url": "https://avatars.githubusercontent.com/u/29704178?v=4", + "profile": "https://github.com/RobinFrcd", + "contributions": [ + "code" + ] } ], "contributorsPerLine": 7, diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index 702d421e61..ce8c3e689d 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -4,15 +4,14 @@ name: "CI/CD" on: push: - branches-ignore: - - master + branches: [master, develop, cypress] paths: - "packages/nc-gui/**" - "scripts/cypress/**" - "packages/nocodb/**" - ".github/workflows/ci-cd.yml" pull_request: - branches: [develop] + branches: [master, develop] paths: - "packages/nc-gui/**" - "scripts/cypress/**" @@ -20,7 +19,7 @@ on: - ".github/workflows/ci-cd.yml" jobs: - cypress-pg-restTableOps-run: + cypress-pg-restTableOps-run-cache: runs-on: ubuntu-20.04 steps: - name: Setup Node @@ -50,7 +49,8 @@ jobs: uses: cypress-io/github-action@v2 with: start: | - npm run start:api + npm run build:common + npm run start:api:cache npm run start:web docker-compose -f ./scripts/cypress/docker-compose-pg.yml up -d spec: "./scripts/cypress/integration/test/pg-restTableOps.js" @@ -58,12 +58,13 @@ jobs: wait-on-timeout: 1200 config-file: scripts/cypress/cypress.json - name: Upload screenshots + if: always() uses: actions/upload-artifact@v2 with: name: restTableOps-snapshots path: scripts/cypress/screenshots retention-days: 2 - cypress-pg-restViews-run: + cypress-pg-restViews-run-cache: runs-on: ubuntu-20.04 steps: - name: Setup Node @@ -93,7 +94,8 @@ jobs: uses: cypress-io/github-action@v2 with: start: | - npm run start:api + npm run build:common + npm run start:api:cache npm run start:web docker-compose -f ./scripts/cypress/docker-compose-pg.yml up -d spec: "./scripts/cypress/integration/test/pg-restViews.js" @@ -101,12 +103,13 @@ jobs: wait-on-timeout: 1200 config-file: scripts/cypress/cypress.json - name: Upload screenshots + if: always() uses: actions/upload-artifact@v2 with: name: restTableOps-snapshots path: scripts/cypress/screenshots retention-days: 2 - cypress-pg-restRoles-run: + cypress-pg-restRoles-run-cache: runs-on: ubuntu-20.04 steps: - name: Setup Node @@ -136,7 +139,8 @@ jobs: uses: cypress-io/github-action@v2 with: start: | - npm run start:api + npm run build:common + npm run start:api:cache npm run start:web docker-compose -f ./scripts/cypress/docker-compose-pg.yml up -d spec: "./scripts/cypress/integration/test/pg-restRoles.js" @@ -144,12 +148,13 @@ jobs: wait-on-timeout: 1200 config-file: scripts/cypress/cypress.json - name: Upload screenshots + if: always() uses: actions/upload-artifact@v2 with: name: restTableOps-snapshots path: scripts/cypress/screenshots retention-days: 2 - cypress-pg-restMisc-run: + cypress-pg-restMisc-run-cache: runs-on: ubuntu-20.04 steps: - name: Setup Node @@ -179,7 +184,8 @@ jobs: uses: cypress-io/github-action@v2 with: start: | - npm run start:api + npm run build:common + npm run start:api:cache npm run start:web docker-compose -f ./scripts/cypress/docker-compose-pg.yml up -d spec: "./scripts/cypress/integration/test/pg-restMisc.js" @@ -187,12 +193,13 @@ jobs: wait-on-timeout: 1200 config-file: scripts/cypress/cypress.json - name: Upload screenshots + if: always() uses: actions/upload-artifact@v2 with: name: restTableOps-snapshots path: scripts/cypress/screenshots retention-days: 2 - cypress-restTableOps-run: + cypress-restTableOps-run-cache: runs-on: ubuntu-20.04 steps: - name: Setup Node @@ -222,7 +229,8 @@ jobs: uses: cypress-io/github-action@v2 with: start: | - npm run start:api + npm run build:common + npm run start:api:cache npm run start:web docker-compose -f ./scripts/docker-compose-cypress.yml up -d spec: "./scripts/cypress/integration/test/restTableOps.js" @@ -230,12 +238,13 @@ jobs: wait-on-timeout: 1200 config-file: scripts/cypress/cypress.json - name: Upload screenshots + if: always() uses: actions/upload-artifact@v2 with: name: restTableOps-snapshots path: scripts/cypress/screenshots retention-days: 2 - cypress-restViews-run: + cypress-restViews-run-cache: runs-on: ubuntu-20.04 steps: - name: Setup Node @@ -259,14 +268,14 @@ jobs: ${{ runner.os }}-build-${{ env.cache-name }}- ${{ runner.os }}-build- ${{ runner.os }}- - - name: Set env run: echo "NODE_ENV=test" >> $GITHUB_ENV - name: Cypress run uses: cypress-io/github-action@v2 with: start: | - npm run start:api + npm run build:common + npm run start:api:cache npm run start:web docker-compose -f ./scripts/docker-compose-cypress.yml up -d spec: "./scripts/cypress/integration/test/restViews.js" @@ -274,12 +283,13 @@ jobs: wait-on-timeout: 1200 config-file: scripts/cypress/cypress.json - name: Upload screenshots + if: always() uses: actions/upload-artifact@v2 with: - name: restViews-snapshots + name: restTableOps-snapshots path: scripts/cypress/screenshots retention-days: 2 - cypress-restRoles-run: + cypress-restRoles-run-cache: runs-on: ubuntu-20.04 steps: - name: Setup Node @@ -303,14 +313,14 @@ jobs: ${{ runner.os }}-build-${{ env.cache-name }}- ${{ runner.os }}-build- ${{ runner.os }}- - - name: Set env run: echo "NODE_ENV=test" >> $GITHUB_ENV - name: Cypress run uses: cypress-io/github-action@v2 with: start: | - npm run start:api + npm run build:common + npm run start:api:cache npm run start:web docker-compose -f ./scripts/docker-compose-cypress.yml up -d spec: "./scripts/cypress/integration/test/restRoles.js" @@ -318,12 +328,13 @@ jobs: wait-on-timeout: 1200 config-file: scripts/cypress/cypress.json - name: Upload screenshots + if: always() uses: actions/upload-artifact@v2 with: - name: restRoles-snapshots + name: restTableOps-snapshots path: scripts/cypress/screenshots retention-days: 2 - cypress-restMisc-run: + cypress-restMisc-run-cache: runs-on: ubuntu-20.04 steps: - name: Setup Node @@ -347,14 +358,14 @@ jobs: ${{ runner.os }}-build-${{ env.cache-name }}- ${{ runner.os }}-build- ${{ runner.os }}- - - name: Set env run: echo "NODE_ENV=test" >> $GITHUB_ENV - name: Cypress run uses: cypress-io/github-action@v2 with: start: | - npm run start:api + npm run build:common + npm run start:api:cache npm run start:web docker-compose -f ./scripts/docker-compose-cypress.yml up -d spec: "./scripts/cypress/integration/test/restMisc.js" @@ -362,183 +373,13 @@ jobs: wait-on-timeout: 1200 config-file: scripts/cypress/cypress.json - name: Upload screenshots + if: always() uses: actions/upload-artifact@v2 with: - name: restMisc-snapshots - path: scripts/cypress/screenshots - retention-days: 2 - cypress-xcdb-restTableOps-run: - runs-on: ubuntu-20.04 - steps: - - name: Setup Node - uses: actions/setup-node@v1 - with: - node-version: 14 - - name: Checkout - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - name: Cache node modules - uses: actions/cache@v2 - env: - cache-name: cache-node-modules - - with: - # npm cache files are stored in `~/.npm` on Linux/macOS - path: ~/.npm - key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.os }}-build-${{ env.cache-name }}- - ${{ runner.os }}-build- - ${{ runner.os }}- - - name: Set env - run: echo "NODE_ENV=test" >> $GITHUB_ENV - - name: Cypress run - uses: cypress-io/github-action@v2 - with: - start: | - npm run start:xcdb-api - npm run start:web - spec: "./scripts/cypress/integration/test/xcdb-restTableOps.js" - wait-on: "http://localhost:8080, http://localhost:3000/_nuxt/runtime.js" - wait-on-timeout: 1200 - config-file: scripts/cypress/cypress.json - - name: Upload screenshots - uses: actions/upload-artifact@v2 - with: - name: xcdb-restTableOps-snapshots - path: scripts/cypress/screenshots - retention-days: 2 - cypress-xcdb-restViews-run: - runs-on: ubuntu-20.04 - steps: - - name: Setup Node - uses: actions/setup-node@v1 - with: - node-version: 14 - - name: Checkout - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - name: Cache node modules - uses: actions/cache@v2 - env: - cache-name: cache-node-modules - - with: - # npm cache files are stored in `~/.npm` on Linux/macOS - path: ~/.npm - key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.os }}-build-${{ env.cache-name }}- - ${{ runner.os }}-build- - ${{ runner.os }}- - - - name: Set env - run: echo "NODE_ENV=test" >> $GITHUB_ENV - - name: Cypress run - uses: cypress-io/github-action@v2 - with: - start: | - npm run start:xcdb-api - npm run start:web - spec: "./scripts/cypress/integration/test/xcdb-restViews.js" - wait-on: "http://localhost:8080, http://localhost:3000/_nuxt/runtime.js" - wait-on-timeout: 1200 - config-file: scripts/cypress/cypress.json - - name: Upload screenshots - uses: actions/upload-artifact@v2 - with: - name: xcdb-restViews-snapshots - path: scripts/cypress/screenshots - retention-days: 2 - cypress-xcdb-restRoles-run: - runs-on: ubuntu-20.04 - steps: - - name: Setup Node - uses: actions/setup-node@v1 - with: - node-version: 14 - - name: Checkout - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - name: Cache node modules - uses: actions/cache@v2 - env: - cache-name: cache-node-modules - - with: - # npm cache files are stored in `~/.npm` on Linux/macOS - path: ~/.npm - key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.os }}-build-${{ env.cache-name }}- - ${{ runner.os }}-build- - ${{ runner.os }}- - - - name: Set env - run: echo "NODE_ENV=test" >> $GITHUB_ENV - - name: Cypress run - uses: cypress-io/github-action@v2 - with: - start: | - npm run start:xcdb-api - npm run start:web - spec: "./scripts/cypress/integration/test/xcdb-restRoles.js" - wait-on: "http://localhost:8080, http://localhost:3000/_nuxt/runtime.js" - wait-on-timeout: 1200 - config-file: scripts/cypress/cypress.json - - name: Upload screenshots - uses: actions/upload-artifact@v2 - with: - name: xcdb-restRoles-snapshots - path: scripts/cypress/screenshots - retention-days: 2 - cypress-xcdb-restMisc-run: - runs-on: ubuntu-20.04 - steps: - - name: Setup Node - uses: actions/setup-node@v1 - with: - node-version: 14 - - name: Checkout - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - name: Cache node modules - uses: actions/cache@v2 - env: - cache-name: cache-node-modules - - with: - # npm cache files are stored in `~/.npm` on Linux/macOS - path: ~/.npm - key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.os }}-build-${{ env.cache-name }}- - ${{ runner.os }}-build- - ${{ runner.os }}- - - - name: Set env - run: echo "NODE_ENV=test" >> $GITHUB_ENV - - name: Cypress run - uses: cypress-io/github-action@v2 - with: - start: | - npm run start:xcdb-api - npm run start:web - spec: "./scripts/cypress/integration/test/xcdb-restMisc.js" - wait-on: "http://localhost:8080, http://localhost:3000/_nuxt/runtime.js" - wait-on-timeout: 1200 - config-file: scripts/cypress/cypress.json - - name: Upload screenshots - uses: actions/upload-artifact@v2 - with: - name: xcdb-restMisc-snapshots + name: restTableOps-snapshots path: scripts/cypress/screenshots retention-days: 2 - cypress-gqlTableOps-run: + cypress-xcdb-restTableOps-run-cache: runs-on: ubuntu-20.04 steps: - name: Setup Node @@ -562,27 +403,28 @@ jobs: ${{ runner.os }}-build-${{ env.cache-name }}- ${{ runner.os }}-build- ${{ runner.os }}- - - name: Set env run: echo "NODE_ENV=test" >> $GITHUB_ENV - name: Cypress run uses: cypress-io/github-action@v2 with: start: | - npm run start:api + npm run build:common + npm run start:xcdb-api:cache npm run start:web docker-compose -f ./scripts/docker-compose-cypress.yml up -d - spec: "./scripts/cypress/integration/test/gqlTableOps.js" + spec: "./scripts/cypress/integration/test/xcdb-restTableOps.js" wait-on: "http://localhost:8080, http://localhost:3000/_nuxt/runtime.js" wait-on-timeout: 1200 config-file: scripts/cypress/cypress.json - name: Upload screenshots + if: always() uses: actions/upload-artifact@v2 with: - name: gqlTableOps-snapshots + name: restTableOps-snapshots path: scripts/cypress/screenshots retention-days: 2 - cypress-gqlViews-run: + cypress-xcdb-restViews-run-cache: runs-on: ubuntu-20.04 steps: - name: Setup Node @@ -606,27 +448,28 @@ jobs: ${{ runner.os }}-build-${{ env.cache-name }}- ${{ runner.os }}-build- ${{ runner.os }}- - - name: Set env run: echo "NODE_ENV=test" >> $GITHUB_ENV - name: Cypress run uses: cypress-io/github-action@v2 with: start: | - npm run start:api + npm run build:common + npm run start:xcdb-api:cache npm run start:web docker-compose -f ./scripts/docker-compose-cypress.yml up -d - spec: "./scripts/cypress/integration/test/gqlViews.js" + spec: "./scripts/cypress/integration/test/xcdb-restViews.js" wait-on: "http://localhost:8080, http://localhost:3000/_nuxt/runtime.js" wait-on-timeout: 1200 config-file: scripts/cypress/cypress.json - name: Upload screenshots + if: always() uses: actions/upload-artifact@v2 with: - name: gqlViews-snapshots + name: restTableOps-snapshots path: scripts/cypress/screenshots retention-days: 2 - cypress-gqlRoles-run: + cypress-xcdb-restRoles-run-cache: runs-on: ubuntu-20.04 steps: - name: Setup Node @@ -650,27 +493,28 @@ jobs: ${{ runner.os }}-build-${{ env.cache-name }}- ${{ runner.os }}-build- ${{ runner.os }}- - - name: Set env run: echo "NODE_ENV=test" >> $GITHUB_ENV - name: Cypress run uses: cypress-io/github-action@v2 with: start: | - npm run start:api + npm run build:common + npm run start:xcdb-api:cache npm run start:web docker-compose -f ./scripts/docker-compose-cypress.yml up -d - spec: "./scripts/cypress/integration/test/gqlRoles.js" + spec: "./scripts/cypress/integration/test/xcdb-restRoles.js" wait-on: "http://localhost:8080, http://localhost:3000/_nuxt/runtime.js" wait-on-timeout: 1200 config-file: scripts/cypress/cypress.json - name: Upload screenshots + if: always() uses: actions/upload-artifact@v2 with: - name: gqlRoles-snapshots + name: restTableOps-snapshots path: scripts/cypress/screenshots retention-days: 2 - cypress-gqlMisc-run: + cypress-xcdb-restMisc-run-cache: runs-on: ubuntu-20.04 steps: - name: Setup Node @@ -694,226 +538,54 @@ jobs: ${{ runner.os }}-build-${{ env.cache-name }}- ${{ runner.os }}-build- ${{ runner.os }}- - - name: Set env run: echo "NODE_ENV=test" >> $GITHUB_ENV - name: Cypress run uses: cypress-io/github-action@v2 with: start: | - npm run start:api + npm run build:common + npm run start:xcdb-api:cache npm run start:web docker-compose -f ./scripts/docker-compose-cypress.yml up -d - spec: "./scripts/cypress/integration/test/gqlMisc.js" - wait-on: "http://localhost:8080, http://localhost:3000/_nuxt/runtime.js" - wait-on-timeout: 1200 - config-file: scripts/cypress/cypress.json - - name: Upload screenshots - uses: actions/upload-artifact@v2 - with: - name: gqlMisc-snapshots - path: scripts/cypress/screenshots - retention-days: 2 - cypress-xcdb-gqlTableOps-run: - runs-on: ubuntu-20.04 - steps: - - name: Setup Node - uses: actions/setup-node@v1 - with: - node-version: 14 - - name: Checkout - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - name: Cache node modules - uses: actions/cache@v2 - env: - cache-name: cache-node-modules - - with: - # npm cache files are stored in `~/.npm` on Linux/macOS - path: ~/.npm - key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.os }}-build-${{ env.cache-name }}- - ${{ runner.os }}-build- - ${{ runner.os }}- - - - name: Set env - run: echo "NODE_ENV=test" >> $GITHUB_ENV - - name: Cypress run - uses: cypress-io/github-action@v2 - with: - start: | - npm run start:xcdb-api - npm run start:web - spec: "./scripts/cypress/integration/test/xcdb-gqlTableOps.js" - wait-on: "http://localhost:8080, http://localhost:3000/_nuxt/runtime.js" - wait-on-timeout: 1200 - config-file: scripts/cypress/cypress.json - - name: Upload screenshots - uses: actions/upload-artifact@v2 - with: - name: xcdb-gqlTableOps-snapshots - path: scripts/cypress/screenshots - retention-days: 2 - cypress-xcdb-gqlViews-run: - runs-on: ubuntu-20.04 - steps: - - name: Setup Node - uses: actions/setup-node@v1 - with: - node-version: 14 - - name: Checkout - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - name: Cache node modules - uses: actions/cache@v2 - env: - cache-name: cache-node-modules - - with: - # npm cache files are stored in `~/.npm` on Linux/macOS - path: ~/.npm - key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.os }}-build-${{ env.cache-name }}- - ${{ runner.os }}-build- - ${{ runner.os }}- - - - name: Set env - run: echo "NODE_ENV=test" >> $GITHUB_ENV - - name: Cypress run - uses: cypress-io/github-action@v2 - with: - start: | - npm run start:xcdb-api - npm run start:web - spec: "./scripts/cypress/integration/test/xcdb-gqlViews.js" - wait-on: "http://localhost:8080, http://localhost:3000/_nuxt/runtime.js" - wait-on-timeout: 1200 - config-file: scripts/cypress/cypress.json - - name: Upload screenshots - uses: actions/upload-artifact@v2 - with: - name: xcdb-gqlViews-snapshots - path: scripts/cypress/screenshots - retention-days: 2 - cypress-xcdb-gqlRoles-run: - runs-on: ubuntu-20.04 - steps: - - name: Setup Node - uses: actions/setup-node@v1 - with: - node-version: 14 - - name: Checkout - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - name: Cache node modules - uses: actions/cache@v2 - env: - cache-name: cache-node-modules - - with: - # npm cache files are stored in `~/.npm` on Linux/macOS - path: ~/.npm - key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.os }}-build-${{ env.cache-name }}- - ${{ runner.os }}-build- - ${{ runner.os }}- - - - name: Set env - run: echo "NODE_ENV=test" >> $GITHUB_ENV - - name: Cypress run - uses: cypress-io/github-action@v2 - with: - start: | - npm run start:xcdb-api - npm run start:web - spec: "./scripts/cypress/integration/test/xcdb-gqlRoles.js" - wait-on: "http://localhost:8080, http://localhost:3000/_nuxt/runtime.js" - wait-on-timeout: 1200 - config-file: scripts/cypress/cypress.json - - name: Upload screenshots - uses: actions/upload-artifact@v2 - with: - name: xcdb-gqlRoles-snapshots - path: scripts/cypress/screenshots - retention-days: 2 - cypress-xcdb-gqlMisc-run: - runs-on: ubuntu-20.04 - steps: - - name: Setup Node - uses: actions/setup-node@v1 - with: - node-version: 14 - - name: Checkout - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - name: Cache node modules - uses: actions/cache@v2 - env: - cache-name: cache-node-modules - - with: - # npm cache files are stored in `~/.npm` on Linux/macOS - path: ~/.npm - key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.os }}-build-${{ env.cache-name }}- - ${{ runner.os }}-build- - ${{ runner.os }}- - - - name: Set env - run: echo "NODE_ENV=test" >> $GITHUB_ENV - - name: Cypress run - uses: cypress-io/github-action@v2 - with: - start: | - npm run start:xcdb-api - npm run start:web - spec: "./scripts/cypress/integration/test/xcdb-gqlMisc.js" + spec: "./scripts/cypress/integration/test/xcdb-restMisc.js" wait-on: "http://localhost:8080, http://localhost:3000/_nuxt/runtime.js" wait-on-timeout: 1200 config-file: scripts/cypress/cypress.json - name: Upload screenshots + if: always() uses: actions/upload-artifact@v2 with: - name: xcdb-gqlMisc-snapshots + name: restTableOps-snapshots path: scripts/cypress/screenshots retention-days: 2 - docker: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - name: Check for update - run: | - echo "CHANGED=$([[ $(lerna ls --since ${{github.event.before}} | grep nocodb) = nocodb ]] && echo 'OK')" >> $GITHUB_ENV - - - name: Test Mysql REST APIs - if: ${{ env.CHANGED == 'OK' }} - run: cd ./packages/nocodb/ && docker-compose run xc-test-mysql - - name: Test Mysql GraphQL APIs - if: ${{ env.CHANGED == 'OK' }} - run: cd ./packages/nocodb/ && docker-compose run xc-test-gql-mysql - - # - name: Test MSSQL REST APIs - # run: cd ./packages/nocodb/ && docker-compose run xc-test-mssql - # - name: Test MSSQL GraphQL APIs - # run: cd ./packages/nocodb/ && docker-compose run xc-test-gql-mssql - # - - name: Test PostgreSQL REST APIs - if: ${{ env.CHANGED == 'OK' }} - run: cd ./packages/nocodb/ && docker-compose run xc-test-pg - - name: Test PostgreSQL GraphQL APIs - if: ${{ env.CHANGED == 'OK' }} - run: cd ./packages/nocodb/ && docker-compose run xc-test-gql-pg +# docker: +# runs-on: ubuntu-latest +# steps: +# - uses: actions/checkout@v2 +# with: +# fetch-depth: 0 +# - name: Check for update +# run: | +# echo "CHANGED=$([[ $(lerna ls --since ${{github.event.before}} | grep nocodb) = nocodb ]] && echo 'OK')" >> $GITHUB_ENV +# - name: Test Mysql REST APIs +# if: ${{ env.CHANGED == 'OK' }} +# run: cd ./packages/nocodb/ && docker-compose run xc-test-mysql +# - name: Test Mysql GraphQL APIs +# if: ${{ env.CHANGED == 'OK' }} +# run: cd ./packages/nocodb/ && docker-compose run xc-test-gql-mysql +# +# # - name: Test MSSQL REST APIs +# # run: cd ./packages/nocodb/ && docker-compose run xc-test-mssql +# # - name: Test MSSQL GraphQL APIs +# # run: cd ./packages/nocodb/ && docker-compose run xc-test-gql-mssql +# # +# - name: Test PostgreSQL REST APIs +# if: ${{ env.CHANGED == 'OK' }} +# run: cd ./packages/nocodb/ && docker-compose run xc-test-pg +# - name: Test PostgreSQL GraphQL APIs +# if: ${{ env.CHANGED == 'OK' }} +# run: cd ./packages/nocodb/ && docker-compose run xc-test-gql-pg # # - name: Test SQLite3 REST APIs # run: cd ./packages/nocodb/ && docker-compose run xc-test-sqlite diff --git a/.github/workflows/dco-check.yml b/.github/workflows/dco-check.yml index 0c2c8afc8e..4e96b5c420 100644 --- a/.github/workflows/dco-check.yml +++ b/.github/workflows/dco-check.yml @@ -5,11 +5,11 @@ name: Check DCO on: pull_request: paths: - - "packages/nc-common/**" + - "packages/nocodb-sdk/**" - "packages/nc-gui/**" - - "packages/nc-lib-gui/**" - - "packages/nc-plugin/**" - - "packages/nocodb/**" + - "packages/nc-lib-gui/**" + - "packages/nc-plugin/**" + - "packages/nocodb/**" - "scripts/cypress/**" jobs: diff --git a/.github/workflows/publish-api-docs.yml b/.github/workflows/publish-api-docs.yml new file mode 100644 index 0000000000..294d390ac3 --- /dev/null +++ b/.github/workflows/publish-api-docs.yml @@ -0,0 +1,26 @@ +name: "Publish : Api Docs" + +on: + push: + branches: [ master ] + paths: + - "scripts/sdk/swagger.json" + +jobs: + copy-file: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Pushes generated output + uses: dmnemec/copy_file_to_another_repo_action@1b29cbd9a323185f20b175dc6d5f8f31be5c0658 + env: + API_TOKEN_GITHUB: ${{ secrets.GH_TOKEN }} + with: + source_file: 'scripts/sdk/swagger.json' + destination_repo: 'nocodb/noco-apis-doc' + destination_folder: 'src' + user_email: 'oof1lab@gmail.com' + user_name: 'o1lab' + commit_message: 'Autorelease from github.com/nocodb/nc' diff --git a/.github/workflows/release-docker.yml b/.github/workflows/release-docker.yml index 0fb8da4fbf..093f064809 100644 --- a/.github/workflows/release-docker.yml +++ b/.github/workflows/release-docker.yml @@ -42,7 +42,7 @@ jobs: working-directory: ./packages/nocodb strategy: matrix: - node-version: [12] + node-version: [14] steps: - name: Get Docker Repository id: get-docker-repository @@ -73,6 +73,20 @@ jobs: with: node-version: ${{ matrix.node-version }} + - name: upgrade packages for nightly build + if: ${{ github.event.inputs.targetEnv == 'DEV' || inputs.targetEnv == 'DEV' }} + run: | + targetEnv=${{ github.event.inputs.targetEnv || inputs.targetEnv }} targetVersion=${{ github.event.inputs.tag || inputs.tag }} node scripts/bumpNocodbSdkVersion.js + cd packages/nocodb-sdk + npm install && npm run build + cd ../.. + targetEnv=${{ github.event.inputs.targetEnv || inputs.targetEnv }} node scripts/upgradeNocodbSdk.js + cd packages/nc-gui + npm install + targetEnv=${{ github.event.inputs.targetEnv || inputs.targetEnv }} targetVersion=${{ github.event.inputs.tag || inputs.tag }} npm run build:copy + cd ../.. + targetEnv=${{ github.event.inputs.targetEnv || inputs.targetEnv }} node scripts/upgradeNcGui.js + - uses: bahmutov/npm-install@v1 with: working-directory: ${{ env.working-directory }} diff --git a/.github/workflows/release-nightly-dev.yml b/.github/workflows/release-nightly-dev.yml index 8485655feb..6cbbe5ab08 100644 --- a/.github/workflows/release-nightly-dev.yml +++ b/.github/workflows/release-nightly-dev.yml @@ -12,8 +12,8 @@ on: - DEV # - PROD schedule: - # at the end of every day - - cron: '0 0 * * *' + # every 6 hours + - cron: '0 */6 * * *' jobs: # enrich tag for nightly auto release @@ -26,11 +26,11 @@ jobs: # Get current date CURRENT_DATE=$(date +"%Y%m%d") CURRENT_TIME=$(date +"%H%M") - TAG_NAME=${CURRENT_DATE} + TAG_NAME=${CURRENT_DATE}-${CURRENT_TIME} IS_DAILY='Y' # Set the tag if [[ ${{ github.event_name }} == 'workflow_dispatch' ]]; then - TAG_NAME=${TAG_NAME}-${CURRENT_TIME} + TAG_NAME=${TAG_NAME} IS_DAILY='N' fi echo "::set-output name=NIGHTLY_BUILD_TAG::${TAG_NAME}" diff --git a/.github/workflows/release-npm.yml b/.github/workflows/release-npm.yml index f50b70831c..024e23f59a 100644 --- a/.github/workflows/release-npm.yml +++ b/.github/workflows/release-npm.yml @@ -37,21 +37,27 @@ jobs: working-directory: ./packages/nocodb strategy: matrix: - node-version: [12] + node-version: [14] steps: - - uses: actions/checkout@v2 - # Setup .npmrc file to publish to npm - - uses: actions/setup-node@v2 + - name: Checkout + uses: actions/checkout@v2 + - name: NPM Setup and Publish with ${{ matrix.node-version }} + # Setup .npmrc file to publish to npm + uses: actions/setup-node@v2 with: - node-version: '16.x' + node-version: ${{ matrix.node-version }} registry-url: 'https://registry.npmjs.org' - run: | + targetEnv=${{ github.event.inputs.targetEnv || inputs.targetEnv }} targetVersion=${{ github.event.inputs.tag || inputs.tag }} node scripts/bumpNocodbSdkVersion.js + cd packages/nocodb-sdk + npm install && npm run build && npm publish + cd ../.. + targetEnv=${{ github.event.inputs.targetEnv || inputs.targetEnv }} node scripts/upgradeNocodbSdk.js cd packages/nc-gui npm install targetEnv=${{ github.event.inputs.targetEnv || inputs.targetEnv }} targetVersion=${{ github.event.inputs.tag || inputs.tag }} npm run build:copy:jsdeliver cd ../.. - npm install - targetEnv=${{ github.event.inputs.targetEnv || inputs.targetEnv }} targetVersion=${{ github.event.inputs.tag || inputs.tag }} node scripts/upgradeNcGui.js && cd packages/nocodb && npm install && npm run obfuscate:build:publish + targetEnv=${{ github.event.inputs.targetEnv || inputs.targetEnv }} node scripts/upgradeNcGui.js && cd packages/nocodb && npm install && npm run obfuscate:build:publish env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - name: Create Pull Request diff --git a/.gitignore b/.gitignore index 0989a020e5..d9f4f08264 100644 --- a/.gitignore +++ b/.gitignore @@ -83,4 +83,5 @@ mongod # Cypress #========= shared.json -/scripts/Cypress/screenshots \ No newline at end of file +/scripts/Cypress/screenshots +/scripts/exp/ diff --git a/.run/Clear metadb.run.xml b/.run/Clear metadb.run.xml new file mode 100644 index 0000000000..2fc4fdd987 --- /dev/null +++ b/.run/Clear metadb.run.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/.run/build.run.xml b/.run/build.run.xml new file mode 100644 index 0000000000..81aa853d99 --- /dev/null +++ b/.run/build.run.xml @@ -0,0 +1,14 @@ + + + + + + diff --git a/packages/nc-gui/components/ProjectTreeViewOld.vue b/packages/nc-gui/components/ProjectTreeViewOld.vue deleted file mode 100644 index 065f39c56d..0000000000 --- a/packages/nc-gui/components/ProjectTreeViewOld.vue +++ /dev/null @@ -1,1170 +0,0 @@ - - - - - - - diff --git a/packages/nc-gui/components/apiOverlay.vue b/packages/nc-gui/components/apiOverlay.vue index 14f622aee8..94918e399f 100644 --- a/packages/nc-gui/components/apiOverlay.vue +++ b/packages/nc-gui/components/apiOverlay.vue @@ -8,8 +8,6 @@
- -

APIs Generated @@ -19,8 +17,6 @@ within {{ timeTaken }} seconds

- - diff --git a/packages/nc-gui/components/auth/apiTokens.vue b/packages/nc-gui/components/auth/apiTokens.vue index acd04123da..9a39e04c99 100644 --- a/packages/nc-gui/components/auth/apiTokens.vue +++ b/packages/nc-gui/components/auth/apiTokens.vue @@ -1,6 +1,6 @@ + + diff --git a/packages/nc-gui/components/auth/userManagement.vue b/packages/nc-gui/components/auth/userManagement.vue index 5c23139124..efa8fbd42c 100644 --- a/packages/nc-gui/components/auth/userManagement.vue +++ b/packages/nc-gui/components/auth/userManagement.vue @@ -1,19 +1,19 @@ -
+ + <!– New User –> {{ $t('activity.newUser') }} -
+

--> @@ -324,21 +279,9 @@ - + {{ $t('activity.share') }} : {{ $store.getters['project/GtrProjectName'] }} -
@@ -394,7 +337,7 @@ small outlined btn.class="grey--text" - @click="invite_token = null, selectedUser = {}" + @click="clickInviteMore" > mdi-account-multiple-plus-outline @@ -418,7 +361,7 @@ dense validate-on-blur outlined - :rules="validate && emailRules" + :rules="emailRules" class="caption" :hint="$t('msg.info.addMultipleUsers')" label="Email" @@ -437,6 +380,7 @@ - - -
!!v || 'User Role is required', + v => ['creator', 'editor', 'commenter', 'viewer'].includes(v) || 'invalid user role' + ], userList: [], roleDescriptions: {}, deleteUserType: '' // [DELETE_FROM_PROJECT, DELETE_FROM_NOCODB] @@ -599,6 +543,22 @@ export default { this.$eventBus.$off('show-add-user', this.addUser) }, methods: { + clickReload() { + this.loadUsers() + this.$tele.emit('user-mgmt:reload') + }, + clickDeleteUser(id) { + this.$tele.emit('user-mgmt:delete:trigger') + this.deleteId = id + this.deleteItem = id + this.showConfirmDlg = true + this.deleteUserType = 'DELETE_FROM_PROJECT' + }, + clickInviteMore() { + this.$tele.emit('user-mgmt:invite-more') + this.invite_token = null + this.selectedUser = { roles: 'editor' } + }, getRole(roles) { return (roles ? roles.split(',') : []).sort((a, b) => this.roleNames.indexOf(a) - this.roleNames.indexOf(a))[0] }, @@ -650,8 +610,10 @@ export default { el.select() document.execCommand('copy') document.body.removeChild(el) + + this.$tele.emit('user-mgmt:copy-url') }, - async rensendInvite(id) { + async resendInvite(id) { try { await this.$axios.post('/admin/resendInvite/' + id, { projectName: this.$store.getters['project/GtrProjectName'] @@ -668,23 +630,34 @@ export default { } catch (e) { this.$toast.error(e.response.data.msg).goAway(3000) } + + this.$tele.emit('user-mgmt:resend-invite') }, async loadUsers() { try { const { page = 1, itemsPerPage = 20 } = this.options - const data = (await this.$axios.get('/admin', { - headers: { - 'xc-auth': this.$store.state.users.token - }, - params: { + // const data = (await this.$axios.get('/admin', { + // headers: { + // 'xc-auth': this.$store.state.users.token + // }, + // params: { + // limit: itemsPerPage, + // offset: (page - 1) * itemsPerPage, + // query: this.query, + // project_id: this.$route.params.project_id + // } + // })).data + + const userData = (await this.$api.auth.projectUserList(this.$store.state.project.projectId, { + query: { limit: itemsPerPage, offset: (page - 1) * itemsPerPage, - query: this.query, - project_id: this.$route.params.project_id + query: this.query } - })).data - this.count = data.count - this.users = data.list + })) + + this.count = userData.users.pageInfo.totalRows + this.users = userData.users.list if (!this.selectedUser && this.users && this.users[0]) { this.selectedUserIndex = 0 } @@ -694,33 +667,27 @@ export default { }, async loadRoles() { try { - this.roles = (await this.$axios.get('/admin/roles', { - headers: { - 'xc-auth': this.$store.state.users.token - }, - params: { - project_id: this.$route.params.project_id - } - })).data.map((role) => { - this.roleDescriptions[role.title] = role.description - return role.title - }).filter(role => role !== 'guest') + this.roles = ['creator', 'editor', 'commenter', 'viewer'] + + // todo: + // (await this.$axios.get('/admin/roles', { + // headers: { + // 'xc-auth': this.$store.state.users.token + // }, + // params: { + // project_id: this.$route.params.project_id + // } + // })).data.map((role) => { + // this.roleDescriptions[role.title] = role.description + // return role.title + // }).filter(role => role !== 'guest') } catch (e) { console.log(e) } }, async deleteUser(id, type) { try { - await this.$axios.delete('/admin/' + id, { - params: { - project_id: this.$route.params.project_id, - email: this.deleteItem.email, - type - }, - headers: { - 'xc-auth': this.$store.state.users.token - } - }) + await this.$api.auth.projectUserRemove(this.$route.params.project_id, id) this.$toast.success(`Successfully removed the user from ${type === 'DELETE_FROM_PROJECT' ? 'project' : 'NocoDB'}`).goAway(3000) await this.loadUsers() } catch (e) { @@ -734,6 +701,8 @@ export default { } await this.deleteUser(this.deleteId, this.deleteUserType) this.showConfirmDlg = false + + this.$tele.emit('user-mgmt:delete:submit') }, addUser() { this.invite_token = null @@ -741,23 +710,19 @@ export default { roles: 'editor' } this.userEditDialog = true + + this.$tele.emit('user-mgmt:add-user:trigger') }, - async inviteUser(email) { + async inviteUser(item) { try { - await this.$axios.post('/admin', { - email, - project_id: this.$route.params.project_id, - projectName: this.$store.getters['project/GtrProjectName'] - }, { - headers: { - 'xc-auth': this.$store.state.users.token - } - }) + await this.$api.auth.projectUserAdd(this.$route.params.project_id, item) this.$toast.success('Successfully added user to project').goAway(3000) await this.loadUsers() } catch (e) { this.$toast.error(e.response.data.msg).goAway(3000) } + + this.$tele.emit('user-mgmt:invite-user') }, async saveUser() { this.validate = true @@ -765,6 +730,7 @@ export default { if (this.loading || !this.$refs.form.validate() || !this.selectedUser) { return } + this.$tele.emit(`user-mgmt:add:${this.selectedUser.roles}`) if (!this.edited) { this.userEditDialog = false @@ -773,31 +739,23 @@ export default { try { let data if (this.selectedUser.id) { - await this.$axios.put('/admin/' + this.selectedUser.id, { + await this.$api.auth.projectUserUpdate(this.$route.params.project_id, this.selectedUser.id, { roles: this.selectedUser.roles, email: this.selectedUser.email, project_id: this.$route.params.project_id, projectName: this.$store.getters['project/GtrProjectName'] - }, { - headers: { - 'xc-auth': this.$store.state.users.token - } }) } else { - data = await this.$axios.post('/admin', { + data = (await this.$api.auth.projectUserAdd(this.$route.params.project_id, { ...this.selectedUser, project_id: this.$route.params.project_id, projectName: this.$store.getters['project/GtrProjectName'] - }, { - headers: { - 'xc-auth': this.$store.state.users.token - } - }) + })) } this.$toast.success('Successfully updated the user details').goAway(3000) await this.loadUsers() - if (data && data.data && data.data.invite_token) { - this.invite_token = data.data + if (data && data.invite_token) { + this.invite_token = data this.simpleAnim() return } @@ -805,7 +763,6 @@ export default { this.$toast.error(e.response.data.msg).goAway(3000) } - this.userEditDialog = false await this.loadUsers() } } diff --git a/packages/nc-gui/components/authTab.vue b/packages/nc-gui/components/authTab.vue index ea140f02ff..de92f93ac7 100644 --- a/packages/nc-gui/components/authTab.vue +++ b/packages/nc-gui/components/authTab.vue @@ -1,7 +1,7 @@ - - - - {{ $t('title.rolesMgmt') }} - - - - - -
diff --git a/packages/nc-gui/components/base/shareBase.vue b/packages/nc-gui/components/base/shareBase.vue index 19466797cc..9727dca609 100644 --- a/packages/nc-gui/components/base/shareBase.vue +++ b/packages/nc-gui/components/base/shareBase.vue @@ -8,14 +8,14 @@ {{ $t('activity.shareBase.link') }}
- +
{{ url }} - @@ -23,7 +23,7 @@ - @@ -31,7 +31,7 @@ - @@ -39,7 +39,7 @@ - @@ -54,7 +54,7 @@ - + mdi-link-variant @@ -80,14 +80,14 @@ - + mdi-link-variant-off - {{ $t('activity.shareBase.link') }} + {{ $t('activity.shareBase.disable') }} @@ -112,9 +112,12 @@
- + - Add new environment to {{ project.title }} project - - - - --> - -
@@ -941,8 +643,8 @@ :type="dialog.type" /> - - + + value === this.project.projectType) } else { - return { icon: 'mdi-server', iconColor: 'primary' } + return { + icon: 'mdi-server', + iconColor: 'primary' + } } }, databaseNamesReverse() { @@ -1415,19 +1147,6 @@ export default { }, selectFile(db, obj, key, index) { this.$refs[key][index].click() - - // console.log(obj, key); - // const file = dialog.showOpenDialog({ - // properties: ["openFile"] - // }); - // console.log(typeof file, file, typeof file[0]); - // if (file && file[0]) { - // let fileName = path.basename(file[0]); - // db.ui[obj][key] = fileName; - // Vue.set(db.ui[obj], key, fileName) - // //db.connection[obj][key] = file[0].toString(); - // Vue.set(db.connection[obj], key, file[0].toString()) - // } }, onPanelToggle(panelIndex, envKey) { this.$nextTick(() => { @@ -1455,20 +1174,15 @@ export default { Vue.set(this.databases, panelIndex, tabIndex) }, getProjectJson() { - console.log('Project json before creating', this.project) - /** * remove UI keys within project */ const xcConfig = JSON.parse(JSON.stringify(this.project)) - console.log(JSON.stringify(this.project)) - console.log('Project json after parsing', xcConfig) delete xcConfig.ui for (const env in xcConfig.envs) { for (let i = 0; i < xcConfig.envs[env].db.length; ++i) { xcConfig.envs[env].db[i].meta.api.type = this.project.projectType - console.log('getProjectJson:', env, i, xcConfig.envs[env].db[i]) if ( xcConfig.envs[env].db[i].client === 'mysql' || xcConfig.envs[env].db[i].client === 'mysql2' @@ -1495,15 +1209,15 @@ export default { const inflectionObj = xcConfig.envs[env].db[i].meta.inflection if (inflectionObj) { - if (Array.isArray(inflectionObj.tn)) { - inflectionObj.tn = inflectionObj.tn.join(',') + if (Array.isArray(inflectionObj.table_name)) { + inflectionObj.table_name = inflectionObj.table_name.join(',') } - if (Array.isArray(inflectionObj.cn)) { - inflectionObj.cn = inflectionObj.cn.join(',') + if (Array.isArray(inflectionObj.column_name)) { + inflectionObj.column_name = inflectionObj.column_name.join(',') } - inflectionObj.tn = inflectionObj.tn || 'none' - inflectionObj.cn = inflectionObj.cn || 'none' + inflectionObj.table_name = inflectionObj.table_name || 'none' + inflectionObj.column_name = inflectionObj.column_name || 'none' } if (this.allSchemas) { @@ -1563,14 +1277,10 @@ export default { } } - console.log('Project json : after', xcConfig) return xcConfig }, constructProjectJsonFromProject(project) { - // const {projectJson: envs, ...rest} = project; - - // let p = {...rest, ...envs}; const p = project // JSON.parse(JSON.stringify(project.projectJson)); p.ui = { @@ -1651,50 +1361,49 @@ export default { this.projectReloading = true - const result = await this.$store.dispatch('sqlMgr/ActSqlOp', [ - { - query: { - skipProjectHasDb: 1 - } - }, - this.edit ? 'projectUpdateByWeb' : 'projectCreateByWeb', - { - project: { - title: projectJson.title, - folder: 'config.xc.json', - type: 'pg' - }, - projectJson + const con = projectJson.envs._noco.db[0] + const inflection = (con.meta && con.meta.inflection) || {} + try { + const result = (await this.$api.project.create({ + title: projectJson.title, + bases: [{ + type: con.client, + config: con, + inflection_column: inflection.column_name, + inflection_table: inflection.table_name + }], + external: true + })) + + clearInterval(interv) + toast.goAway(100) + + await this.$store.dispatch('project/ActLoadProjectInfo') + + this.projectReloading = false + + if (!this.edit && !this.allSchemas) { + this.$router.push({ + path: `/nc/${result.id}`, + query: { + new: 1 + } + }) } - ]) - - clearInterval(interv) - toast.goAway(100) - console.log('project created redirect to project page', projectJson, result) - await this.$store.dispatch('project/ActLoadProjectInfo') - - this.projectReloading = false - - if (!this.edit && !this.allSchemas) { - this.$router.push({ - path: `/nc/${result.id}`, - query: { - new: 1 - } - }) + this.projectCreated = true + } catch (e) { + this.$toast.error(await this._extractSdkResponseErrorMsg(e)).goAway(3000) + toast.goAway(0) } - this.projectCreated = true - this.projectReloading = false + this.$tele.emit('project:create:extdb:submit') }, mtdDialogGetEnvNameSubmit(envName, cookie) { - console.log(envName) this.dialogGetEnvName.dialogShow = false if (envName in this.project.envs) { - console.log('Environment exists') } else { Vue.set(this.project.envs, envName, { db: [ @@ -1711,8 +1420,8 @@ export default { tn: 'nc_evolutions', dbAlias: 'db', inflection: { - tn: 'camelize', - cn: 'camelize' + table_name: 'camelize', + column_name: 'camelize' }, api: { type: '' @@ -1734,7 +1443,6 @@ export default { } }, mtdDialogGetEnvNameCancel() { - console.log('mtdDialogGetTableNameCancel cancelled') this.dialogGetEnvName.dialogShow = false }, @@ -1761,8 +1469,8 @@ export default { tn: 'nc_evolutions', dbAlias, inflection: { - tn: 'camelize', - cn: 'camelize' + table_name: 'camelize', + column_name: 'camelize' }, api: { type: '' @@ -1786,24 +1494,8 @@ export default { this.dialog.show = false }, selectDir(ev) { - // console.log(ev) - // const file = dialog.showOpenDialog({ - // properties: ['openDirectory'] - // }) - // if (file && file[0]) { - // this.baseFolder = file[0] - // this.project.folder = file[0] - // this.userSelectedDir = true - // } }, selectSqliteFile(db) { - // console.log(ev) - // const file = dialog.showOpenDialog({ - // properties: ["openFile"] - // }); - // if (file && file[0]) { - // db.connection.connection.filename = file[0]; - // } }, getDbStatusColor(db) { @@ -1838,7 +1530,6 @@ export default { } }, async newTestConnection(db, env, panelIndex) { - console.log(this.project.envs[env][0]) if ( db.connection.host === 'localhost' && !this.edit && @@ -1869,7 +1560,6 @@ export default { 'testConnection', c1 ]) - console.log('test connection result', result) if (result.code === 0) { db.ui.setup = 1 @@ -1884,10 +1574,11 @@ export default { if (e === env) { // ignore } else { - console.log(this.project.envs[e]) - const c2 = { - connection: { ...this.project.envs[e].db[0].connection, database: undefined }, + connection: { + ...this.project.envs[e].db[0].connection, + database: undefined + }, client: this.project.envs[e].db[0].client } @@ -1934,46 +1625,31 @@ export default { } let sendAdvancedConfig = false const sslOptions = Object.values(connection.ssl).filter(el => !!el) - console.log('sslOptions:', sslOptions) if (sslOptions[0]) { sendAdvancedConfig = true } else { - console.log('no ssl options') } return sendAdvancedConfig }, handleSSL(db, creating = true) { - console.log('handleSSL', db) const sendAdvancedConfig = this.sendAdvancedConfig(db.connection) if (!sendAdvancedConfig) { - // args.ssl = undefined; db.connection.ssl = undefined } if (db.connection.ssl) { - // db.connection.ssl.caFilePath = db.connection.ssl.ca; - // db.connection.ssl.keyFilePath = db.connection.ssl.key; - // db.connection.ssl.certFilePath = db.connection.ssl.cert; - // if(creating) { - // delete db.connection.ssl.ca; - // delete db.connection.ssl.key; - // delete db.connection.ssl.cert; - // } } }, getDatabaseForTestConnection(dbType) { }, async testConnection(db, env, panelIndex) { + this.$tele.emit('project:create:extdb:test-connection') this.$store.commit('notification/MutToggleProgressBar', true) try { if (!(await this.newTestConnection(db, env, panelIndex))) { - // this.activeDbNode.testConnectionStatus = false; - // - this.handleSSL(db) - console.log('testconnection params', db) if (db.client === 'sqlite3') { db.ui.setup = 1 } else { @@ -1985,18 +1661,8 @@ export default { client: db.client } - // const result = await this.sqlMgr.testConnection(c1); - const result = await this.$store.dispatch('sqlMgr/ActSqlOp', [ - { - query: { - skipProjectHasDb: 1 - } - }, - 'testConnection', - c1 - ]) + const result = (await this.$api.utils.testConnection(c1)) - console.log('test connection result', result) if (result.code === 0) { db.ui.setup = 1 // this.dialog.heading = "Connection was successful" @@ -2010,8 +1676,6 @@ export default { this.dialog.type = 'error' this.dialog.show = true } - - console.log('testconnection params : after', db) } } } catch (e) { @@ -2038,7 +1702,10 @@ export default { const db = this.project.envs[env].db[index] Vue.set(db, 'client', this.databaseNames[client]) if (client !== 'Sqlite') { - const { ssl, ...connectionDet } = this.sampleConnectionData[client] + const { + ssl, + ...connectionDet + } = this.sampleConnectionData[client] Vue.set(db, 'connection', { ...connectionDet, @@ -2064,11 +1731,8 @@ export default { database: [this.project.folder, `${this.project.title}_${env}_${index + 1}`].join( '/' ), - // database: path.join(this.project.folder, `${this.project.title}_${env}_${index + 1}`), useNullAsDefault: true }) - // Vue.set(db.connection, 'connection', {filename: `${this.project.folder}/${this.project.title}_${env}_${index + 1}`}) - // Vue.set(db.connection, 'database', `${this.project.folder}/${this.project.title}_${env}_${index + 1}`) } } } @@ -2082,8 +1746,6 @@ export default { db.ui.setup = status }, removeDBFromEnv(db, env, panelIndex, dbIndex) { - console.log(db, env, panelIndex, dbIndex) - for (const env in this.project.envs) { if (this.project.envs[env].db.length > dbIndex) { this.project.envs[env].db.splice(dbIndex, 1) @@ -2095,7 +1757,10 @@ export default { Vue.set(this.project, 'envs', { ...this.project.envs }) } }, - fetch({ store, params }) { + fetch({ + store, + params + }) { }, beforeCreated() { }, @@ -2115,12 +1780,6 @@ export default { if (db.client !== 'sqlite3') { Vue.set(db.connection, 'database', `${this.project.title}_${env}_${index + 1}`) } else { - // Vue.set(db.connection, 'connection', { - // filename: path.join( - // this.project.folder, - // `${this.project.title}_${env}_${index + 1}` - // ) - // }) Vue.set(db.connection, 'database', `${this.project.title}_${env}_${index + 1}`) } } @@ -2168,12 +1827,9 @@ export default { this.compErrorMessages[Math.floor(Math.random() * this.compErrorMessages.length)] if (this.edit) { - // this.edit = true; - // await this.$store.dispatch('sqlMgr/instantiateSqlMgr'); try { let data = await this.$store.dispatch('sqlMgr/ActSqlOp', [null, 'xcProjectGetConfig']) data = JSON.parse(data.config) - console.log('created:', data) this.constructProjectJsonFromProject(data) this.$set(this.project, 'folder', data.folder) } catch (e) { @@ -2215,17 +1871,9 @@ export default { ...this.sampleConnectionData[dbsAvailable[0]], ssl: { ...this.sampleConnectionData[dbsAvailable[0]].ssl } } - // db.ui.setup = await PortScanner.isAlive(db.connection.host, parseInt(db.connection.port)) ? 0 : -1; } } } - - // for (let env in this.project.envs) { - // for (let db of this.project.envs[env]) { - // db.ui.setup = await PortScanner.isAlive(db.connection.host, parseInt(db.connection.port)) ? 0 : -1; - // console.log('testing port', env, db.connection.database, db.ui.setup); - // } - // } } }, beforeMount() { diff --git a/packages/nc-gui/components/createProjectComingSoon.vue b/packages/nc-gui/components/createProjectComingSoon.vue index a11511a082..f903f66d17 100644 --- a/packages/nc-gui/components/createProjectComingSoon.vue +++ b/packages/nc-gui/components/createProjectComingSoon.vue @@ -31,21 +31,6 @@ - - - - - - - - - - - - - - - diff --git a/packages/nc-gui/components/environment.vue b/packages/nc-gui/components/environment.vue index 84163a8197..217e2ecc52 100644 --- a/packages/nc-gui/components/environment.vue +++ b/packages/nc-gui/components/environment.vue @@ -168,10 +168,6 @@ /* eslint-disable */ import draggable from 'vuedraggable' -// -// const {promisify, fs, path, config, Handlebars} = require("electron").remote.require( -// "./libs" -// ); export default { name: 'Environment', directives: {}, @@ -293,7 +289,6 @@ export default { 'utf-8') }, async saveEnvironment (env) { - console.log(env, this.envValues[env]) try { let projectJsonPath, freshProjectObj diff --git a/packages/nc-gui/components/githubStarBtn.vue b/packages/nc-gui/components/githubStarBtn.vue new file mode 100644 index 0000000000..0755c905e3 --- /dev/null +++ b/packages/nc-gui/components/githubStarBtn.vue @@ -0,0 +1,46 @@ + + + + + diff --git a/packages/nc-gui/components/globalAcl.vue b/packages/nc-gui/components/globalAcl.vue index 4786fbdd0d..56c69549b8 100644 --- a/packages/nc-gui/components/globalAcl.vue +++ b/packages/nc-gui/components/globalAcl.vue @@ -225,64 +225,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -334,8 +276,8 @@ export default { const groupedData = {} for (const item of data) { - groupedData[item.tn] = groupedData[item.tn] || [] - groupedData[item.tn].push(item) + groupedData[item.table_name] = groupedData[item.table_name] || [] + groupedData[item.table_name].push(item) } this.groupedData = groupedData diff --git a/packages/nc-gui/components/import/dropOrSelectFile.vue b/packages/nc-gui/components/import/dropOrSelectFile.vue index d9ec39d271..7b29a97027 100644 --- a/packages/nc-gui/components/import/dropOrSelectFile.vue +++ b/packages/nc-gui/components/import/dropOrSelectFile.vue @@ -85,8 +85,6 @@ export default { } }, dragOverHandler(ev) { - console.log('File(s) in drop zone') - // Prevent default behavior (Prevent file from being opened) ev.preventDefault() } diff --git a/packages/nc-gui/components/import/dropOrSelectFileModal.vue b/packages/nc-gui/components/import/dropOrSelectFileModal.vue index 7f24221cdc..a6519e677d 100644 --- a/packages/nc-gui/components/import/dropOrSelectFileModal.vue +++ b/packages/nc-gui/components/import/dropOrSelectFileModal.vue @@ -98,7 +98,6 @@ export default { } }, dragOverHandler(ev) { - console.log('File(s) in drop zone') // Prevent default behavior (Prevent file from being opened) ev.preventDefault() diff --git a/packages/nc-gui/components/import/excelImport.vue b/packages/nc-gui/components/import/excelImport.vue index 1506cc3376..9a4921b311 100644 --- a/packages/nc-gui/components/import/excelImport.vue +++ b/packages/nc-gui/components/import/excelImport.vue @@ -282,7 +282,6 @@ export default { dropHandler(ev) { this.dragOver = false - console.log('File(s) dropped') let file if (ev.dataTransfer.items) { // Use DataTransferItemList interface to access the file(s) @@ -303,8 +302,6 @@ export default { this._file(file) }, dragOverHandler(ev) { - console.log('File(s) in drop zone') - // Prevent default behavior (Prevent file from being opened) ev.preventDefault() }, diff --git a/packages/nc-gui/components/import/templateParsers/ExcelTemplateAdapter.js b/packages/nc-gui/components/import/templateParsers/ExcelTemplateAdapter.js index bbb6aa84d8..37dfd37bae 100644 --- a/packages/nc-gui/components/import/templateParsers/ExcelTemplateAdapter.js +++ b/packages/nc-gui/components/import/templateParsers/ExcelTemplateAdapter.js @@ -49,23 +49,23 @@ export default class ExcelTemplateAdapter extends TemplateGenerator { const originalRows = XLSX.utils.sheet_to_json(ws, { header: 1, blankrows: false, cellDates: true, defval: null }) // fix precision bug & timezone offset issues introduced by xlsx - const basedate = new Date(1899, 11, 30, 0, 0, 0); + const basedate = new Date(1899, 11, 30, 0, 0, 0) // number of milliseconds since base date - const dnthresh = basedate.getTime() + (new Date().getTimezoneOffset() - basedate.getTimezoneOffset()) * 60000; + const dnthresh = basedate.getTime() + (new Date().getTimezoneOffset() - basedate.getTimezoneOffset()) * 60000 // number of milliseconds in a day - const day_ms = 24 * 60 * 60 * 1000; + const day_ms = 24 * 60 * 60 * 1000 // handle date1904 property const fixImportedDate = (date) => { - const parsed = XLSX.SSF.parse_date_code((date.getTime() - dnthresh) / day_ms, { - date1904: this.wb.Workbook.WBProps.date1904 + const parsed = XLSX.SSF.parse_date_code((date.getTime() - dnthresh) / day_ms, { + date1904: this.wb.Workbook.WBProps.date1904 }) return new Date(parsed.y, parsed.m, parsed.d, parsed.H, parsed.M, parsed.S) } // fix imported date - const rows = originalRows.map((r) => r.map((v) => { - return v instanceof Date ? fixImportedDate(v): v + const rows = originalRows.map(r => r.map((v) => { + return v instanceof Date ? fixImportedDate(v) : v })) - + const columnNameRowExist = +rows[0].every(v => v === null || typeof v === 'string') // const colLen = Math.max() @@ -166,7 +166,7 @@ export default class ExcelTemplateAdapter extends TemplateGenerator { const rowData = {} for (let i = 0; i < table.columns.length; i++) { if (table.columns[i].uidt === UITypes.Checkbox) { - rowData[table.columns[i].cn] = getCheckboxValue(row[i]) + rowData[table.columns[i].column_name] = getCheckboxValue(row[i]) } else if (table.columns[i].uidt === UITypes.Currency) { const cellId = XLSX.utils.encode_cell({ c: range.s.c + i, @@ -174,12 +174,12 @@ export default class ExcelTemplateAdapter extends TemplateGenerator { }) const cellObj = ws[cellId] - rowData[table.columns[i].cn] = (cellObj && cellObj.w && cellObj.w.replace(/[^\d.]+/g, '')) || row[i] + rowData[table.columns[i].column_name] = (cellObj && cellObj.w && cellObj.w.replace(/[^\d.]+/g, '')) || row[i] } else if (table.columns[i].uidt === UITypes.SingleSelect || table.columns[i].uidt === UITypes.MultiSelect) { - rowData[table.columns[i].cn] = (row[i] || '').toString().trim() || null + rowData[table.columns[i].column_name] = (row[i] || '').toString().trim() || null } else { // toto: do parsing if necessary based on type - rowData[table.columns[i].cn] = row[i] + rowData[table.columns[i].column_name] = row[i] } } this.data[tn].push(rowData) diff --git a/packages/nc-gui/components/importantAnnouncement.vue b/packages/nc-gui/components/importantAnnouncement.vue index 2cf90bd0eb..c854f008b4 100644 --- a/packages/nc-gui/components/importantAnnouncement.vue +++ b/packages/nc-gui/components/importantAnnouncement.vue @@ -32,14 +32,6 @@ API Changes in v0.90.0 - mdi-close diff --git a/packages/nc-gui/components/loader.vue b/packages/nc-gui/components/loader.vue index 94435651b3..09afb7b4b4 100644 --- a/packages/nc-gui/components/loader.vue +++ b/packages/nc-gui/components/loader.vue @@ -21,8 +21,6 @@ export default { name: 'Loader', props: { - // message: String, - // progress: Number }, computed: { message() { diff --git a/packages/nc-gui/components/monaco/Monaco.vue b/packages/nc-gui/components/monaco/Monaco.vue index b0afea5d27..d1755b1a3f 100644 --- a/packages/nc-gui/components/monaco/Monaco.vue +++ b/packages/nc-gui/components/monaco/Monaco.vue @@ -47,7 +47,6 @@ export default { watch: { codeLocal(newValue) { // INFO: for updating value of prop `code` in parent comp - // console.log("update:code Event Emitted", newValue); this.$emit('update:code', newValue) }, code(newValue) { @@ -65,7 +64,6 @@ export default { const editor = this.$refs.editor.getMonaco() const range = editor.getSelection() const selectedText = editor.getModel().getValueInRange(range) - // console.log('getValue', editor.getModel()) this.selection = selectedText this.selectionRange = range }, diff --git a/packages/nc-gui/components/monaco/MonacoSingleLineEditor.js b/packages/nc-gui/components/monaco/MonacoSingleLineEditor.js index 2a04ab4ff6..bf50b214b0 100644 --- a/packages/nc-gui/components/monaco/MonacoSingleLineEditor.js +++ b/packages/nc-gui/components/monaco/MonacoSingleLineEditor.js @@ -245,9 +245,6 @@ export default { ...(this.$store.getters['project/GtrProjectJson'].envs ? Object.keys(this.$store.getters['project/GtrProjectJson'].envs[this.env].api) : [])]; - - console.log('============', this.envValues) - this.tokRef = monaco.languages.setMonarchTokensProvider('mySpecialLanguage', { tokenizer: { root: [ diff --git a/packages/nc-gui/components/monaco/MonacoSqlEditor.vue b/packages/nc-gui/components/monaco/MonacoSqlEditor.vue index f60eed1c66..2604bca7ce 100644 --- a/packages/nc-gui/components/monaco/MonacoSqlEditor.vue +++ b/packages/nc-gui/components/monaco/MonacoSqlEditor.vue @@ -189,23 +189,15 @@ export default { this.codeLocal = newValue } }, - beforeCreate() { - // console.log(MonacoEditor) - }, - created() { - // - }, methods: { selectionFn() { const editor = this.$refs.editor.getMonaco() const range = editor.getSelection() const selectedText = editor.getModel().getValueInRange(range) - // console.log('getValue', editor.getModel()) this.selection = selectedText this.selectionRange = range }, pretify() { - // console.log("this.code", this.code); const editor = this.$refs.editor.getMonaco() if (this.selection && this.selectionRange) { diff --git a/packages/nc-gui/components/previewAs.vue b/packages/nc-gui/components/previewAs.vue new file mode 100644 index 0000000000..5be79665af --- /dev/null +++ b/packages/nc-gui/components/previewAs.vue @@ -0,0 +1,167 @@ + + + + + diff --git a/packages/nc-gui/components/project/apiClientSwagger.vue b/packages/nc-gui/components/project/apiClientSwagger.vue index 64e4c0c960..dd77a216d5 100644 --- a/packages/nc-gui/components/project/apiClientSwagger.vue +++ b/packages/nc-gui/components/project/apiClientSwagger.vue @@ -782,7 +782,6 @@ export default { await this.loadFileCollection(this.$store.getters['apiClientSwagger/GtrCurrentApiFilePaths'][i]) } - // console.log(this.$store.getters['apiClientSwagger/GtrCurrentApiFilePaths']); } catch (e) { console.log('Failed to load previously opened query collections', e) } @@ -794,7 +793,6 @@ export default { this.api.meta = {} - console.log(this.nodes) try { const info = (await this.$axios.get('/nc/projectApiInfo', { headers: { @@ -818,7 +816,6 @@ export default { console.log('Node info : ', api) }, async handleKeyDown ({ metaKey, key, altKey, shiftKey, ctrlKey }) { - console.log(metaKey, key, altKey, shiftKey, ctrlKey) // cmd + s -> save // cmd + l -> reload // cmd + n -> new @@ -857,7 +854,6 @@ export default { }) if (userChosenPath) { - console.log(userChosenPath) fs.writeFileSync(userChosenPath, '[]', 'utf-8') const pathObj = { path: userChosenPath, @@ -1056,7 +1052,6 @@ export default { }, async ctxMenuClickHandler (actionEvent, index) { - console.log(actionEvent, index) switch (actionEvent.value) { case 'add-folder': this.tvNodeFolderAdd(index) @@ -1112,8 +1107,6 @@ export default { }, async apiSend () { - console.log('apiSend') - if (!this.api.path.trim()) { this.$toast.info('Please enter http url').goAway(3000) return @@ -1154,7 +1147,6 @@ export default { async fileCollectionReload () { const data = new Tree(await this.apiFileCollection.read()) - console.log(data) this.apiTv = data // this.$set(this, 'apiCollections', data); @@ -1167,12 +1159,10 @@ export default { }, async tvNodeRename (params) { - console.log(params) await this.savefileCollections(this.curApiCollectionPanel) }, async onAddNode (params) { - console.log(params) await this.savefileCollections(this.curApiCollectionPanel) }, @@ -1180,7 +1170,6 @@ export default { const { parent, children, ...params } = node this.currentNode = node - console.log(params) this.apiClickedOnList(params) // if (params.query) ; // this.selectQuery(params) diff --git a/packages/nc-gui/components/project/apis.vue b/packages/nc-gui/components/project/apis.vue index 024e10f825..aa372428fb 100644 --- a/packages/nc-gui/components/project/apis.vue +++ b/packages/nc-gui/components/project/apis.vue @@ -204,8 +204,6 @@ export default { _nodes.type = 'apiClientDir' _nodes.url = url const tabIndex = this.tabs.findIndex(el => el.key === _nodes.key) - console.log('apis node', this.nodes) - console.log('apiClient node', _nodes) if (tabIndex !== -1) { this.changeActiveTab(tabIndex) } else { diff --git a/packages/nc-gui/components/project/appStore.vue b/packages/nc-gui/components/project/appStore.vue index 6a95a9f68a..28df19a2ec 100644 --- a/packages/nc-gui/components/project/appStore.vue +++ b/packages/nc-gui/components/project/appStore.vue @@ -1,104 +1,109 @@ @@ -207,37 +213,32 @@ export default { }, async created() { await this.loadPluginList() - this.readPluginDefaults() }, methods: { - async readPluginDefaults() { - try { - this.defaultConfig = await this.$store.dispatch('sqlMgr/ActSqlOp', [null, 'xcPluginDemoDefaults']) - } catch (e) { - } - }, async confirmResetPlugin() { try { - await this.$store.dispatch('sqlMgr/ActSqlOp', [null, 'xcPluginSet', { + await this.$api.plugin.update(this.resetPluginRef.id, { input: null, - id: this.resetPluginRef.id, - title: this.resetPluginRef.title, - uninstall: true - }]) - + active: 0 + }) this.$toast.success('Plugin uninstalled successfully').goAway(5000) await this.loadPluginList() } catch (e) { this.$toast.error(e.message).goAway(3000) } + + this.$tele.emit(`appstore:reset:${this.resetPluginRef.title}`) }, async saved() { this.pluginInstallOverlay = false await this.loadPluginList() + this.$tele.emit(`appstore:install:submit:${this.installPlugin.title}`) }, async installApp(app) { this.pluginInstallOverlay = true this.installPlugin = app + + this.$tele.emit(`appstore:install:trigger:${app.title}`) }, async resetApp(app) { this.pluginUninstallModal = true @@ -245,8 +246,9 @@ export default { }, async loadPluginList() { try { - const plugins = await this.$store.dispatch('sqlMgr/ActSqlOp', [null, 'xcPluginList']) - plugins.push(...plugins.splice(0, 3)) + // const plugins = await this.$store.dispatch('sqlMgr/ActSqlOp', [null, 'xcPluginList']) + const plugins = (await this.$api.plugin.list()).list + // plugins.push(...plugins.splice(0, 3)) this.apps = plugins.map((p) => { p.tags = p.tags ? p.tags.split(',') : [] p.parsedInput = p.input && JSON.parse(p.input) @@ -261,9 +263,6 @@ export default { diff --git a/packages/nc-gui/components/project/spreadsheet/components/columnFilterMenu.vue b/packages/nc-gui/components/project/spreadsheet/components/columnFilterMenu.vue index 2b41cd838e..db51a44720 100644 --- a/packages/nc-gui/components/project/spreadsheet/components/columnFilterMenu.vue +++ b/packages/nc-gui/components/project/spreadsheet/components/columnFilterMenu.vue @@ -1,5 +1,5 @@ - + Apply changes @@ -62,7 +71,7 @@ import ColumnFilter from '@/components/project/spreadsheet/components/columnFilt export default { name: 'ColumnFilterMenu', components: { ColumnFilter }, - props: ['fieldList', 'isLocked', 'value', 'meta'], + props: ['fieldList', 'isLocked', 'value', 'meta', 'viewId', 'shared'], data: () => ({ filters: [] }), @@ -70,6 +79,7 @@ export default { autosave: { set(v) { this.$store.commit('windows/MutAutoApplyFilter', v) + this.$tele.emit(`filter:auto-apply:${v}`) }, get() { return this.$store.state.windows.autoApplyFilter @@ -97,7 +107,13 @@ export default { created() { this.filters = this.autosave ? this.value || [] : JSON.parse(JSON.stringify(this.value || [])) }, - methods: {} + methods: { + applyChanges() { + this.$emit('input', this.filters) + if (this.$refs.filter) { this.$refs.filter.applyChanges() } + this.$tele.emit('filter:apply-explicit') + } + } } diff --git a/packages/nc-gui/components/project/spreadsheet/components/editColumn.vue b/packages/nc-gui/components/project/spreadsheet/components/editColumn.vue index 75bd864278..6146b14737 100644 --- a/packages/nc-gui/components/project/spreadsheet/components/editColumn.vue +++ b/packages/nc-gui/components/project/spreadsheet/components/editColumn.vue @@ -10,15 +10,15 @@ - - Changing MultiSelect to SingleSelect can lead to errors when there are multiple values associated with a cell + Changing MultiSelect to SingleSelect can lead to errors when there are multiple values associated + with a cell @@ -140,7 +141,7 @@ :nodes="nodes" :meta="meta" :is-s-q-lite="isSQLite" - :alias="newColumn.cn" + :alias="newColumn.column_name" :is-m-s-s-q-l="isMSSQL" v-on="$listeners" /> @@ -155,7 +156,7 @@ :nodes="nodes" :meta="meta" :is-s-q-lite="isSQLite" - :alias="newColumn.cn" + :alias="newColumn.column_name" :is-m-s-s-q-l="isMSSQL" v-on="$listeners" /> @@ -170,7 +171,7 @@ :nodes="nodes" :meta="meta" :is-s-q-lite="isSQLite" - :alias="newColumn.cn" + :alias="newColumn.column_name" :is-m-s-s-q-l="isMSSQL" @onColumnSelect="onRelColumnSelect" /> @@ -190,7 +191,7 @@ /> - - diff --git a/packages/nc-gui/components/project/spreadsheet/components/virtualCell/hasManyCell.vue b/packages/nc-gui/components/project/spreadsheet/components/virtualCell/hasManyCell.vue index b6c6a21c45..71fe16590c 100644 --- a/packages/nc-gui/components/project/spreadsheet/components/virtualCell/hasManyCell.vue +++ b/packages/nc-gui/components/project/spreadsheet/components/virtualCell/hasManyCell.vue @@ -2,7 +2,7 @@
- {{ allToggle ? 'Disable' : 'Enable' }} all {{ nodes.tn }} resolvers for all roles + {{ allToggle ? 'Disable' : 'Enable' }} all {{ nodes.table_name }} resolvers for all roles - {{ nodes.tn }} RPC Services + {{ nodes.table_name }} RPC Services
@@ -98,9 +98,9 @@ v-on="on" /> - {{ allToggle ? 'Disable' : 'Enable' }} all {{ nodes.tn }} routes for all roles + {{ allToggle ? 'Disable' : 'Enable' }} all {{ nodes.table_name }} routes for all roles - {{ nodes.tn }} Routes + {{ nodes.table_name }} Routes @@ -124,14 +124,14 @@ export default { // this.policyPaths = await this.sqlMgr.projectGetTsPolicyPath({ // env: this.nodes.env, // dbAlias: this.nodes.dbAlias, - // tn: this.nodes.tn + // tn: this.nodes.table_name // }); this.policyPaths = await this.$store.dispatch('sqlMgr/ActSqlOp', [{ env: this.nodes.env, dbAlias: this.nodes.dbAlias }, 'projectGetTsPolicyPath', { - tn: this.nodes.tn + table_name: this.nodes.table_name }]) }, reload() { diff --git a/packages/nc-gui/components/project/tableTabs/aclTsFileChild.vue b/packages/nc-gui/components/project/tableTabs/aclTsFileChild.vue index 6038be7c83..72f6335b34 100644 --- a/packages/nc-gui/components/project/tableTabs/aclTsFileChild.vue +++ b/packages/nc-gui/components/project/tableTabs/aclTsFileChild.vue @@ -14,7 +14,7 @@ - + @@ -56,7 +56,7 @@ - + @@ -74,7 +74,7 @@ v-on="on" /> - {{ allToggle ? 'Disable' : 'Enable' }} all {{ nodes.tn }} routes for all roles + {{ allToggle ? 'Disable' : 'Enable' }} all {{ nodes.table_name }} routes for all roles {{ routesName }} Routes @@ -240,7 +240,6 @@ export default { this.disableSaveButton = true try { - console.log(this.policyPath, this.data1) // this.data1 = JSON.parse(JSON.stringify(await this.sqlMgr.importFresh({path: this.policyPath}))); this.data1 = JSON.parse(JSON.stringify(await this.$store.dispatch('sqlMgr/ActSqlOp', [null, 'importFresh', { path: this.policyPath }]))) this.groupRoutes() @@ -318,11 +317,6 @@ export default { }, async save() { try { - // await this.sqlMgr.writeFile({ - // path: this.policyPath, - // data: `module.exports = ${JSON.stringify(this.data1, null, 2)}` - // }) - await this.$store.dispatch('sqlMgr/ActSqlOp', [null, 'writeFile', { path: this.policyPath, data: `module.exports = ${JSON.stringify(this.data1, null, 2)}` diff --git a/packages/nc-gui/components/project/tableTabs/aclTsFileDb.vue b/packages/nc-gui/components/project/tableTabs/aclTsFileDb.vue index 29f9e06477..1f348fc25a 100644 --- a/packages/nc-gui/components/project/tableTabs/aclTsFileDb.vue +++ b/packages/nc-gui/components/project/tableTabs/aclTsFileDb.vue @@ -14,7 +14,7 @@ href: '#' }, { - text: nodes.tn + ' (ACL)', + text: nodes.table_name + ' (ACL)', disabled: true, href: '#' }]" @@ -86,7 +86,7 @@ dense hide-details class="ma-2" - :placeholder="`Search ${nodes.tn} routes`" + :placeholder="`Search ${nodes.table_name} routes`" prepend-inner-icon="search" outlined /> @@ -132,13 +132,13 @@ export default { // this.policies = (await this.sqlMgr.xcRoutesPolicyGet({ // env: this.nodes.env, // dbAlias: this.nodes.dbAlias, - // tn: this.nodes.tn + // tn: this.nodes.table_name // })).data.list; // this.disableSaveButton = true; this.policies = (await this.$store.dispatch('sqlMgr/ActSqlOp', [null, 'xcRoutesPolicyGet', { env: this.nodes.env, dbAlias: this.nodes.dbAlias, - tn: this.nodes.tn + tn: this.nodes.table_name }])).data.list }, reload() { diff --git a/packages/nc-gui/components/project/tableTabs/aclTsFileDbChild.vue b/packages/nc-gui/components/project/tableTabs/aclTsFileDbChild.vue index 1f975e85fb..33dd6fddd1 100644 --- a/packages/nc-gui/components/project/tableTabs/aclTsFileDbChild.vue +++ b/packages/nc-gui/components/project/tableTabs/aclTsFileDbChild.vue @@ -14,7 +14,7 @@ - + @@ -56,7 +56,7 @@ - + @@ -74,7 +74,7 @@ v-on="on" /> - {{ allToggle ? 'Disable' : 'Enable' }} all {{ nodes.tn }} routes for all roles + {{ allToggle ? 'Disable' : 'Enable' }} all {{ nodes.table_name }} routes for all roles {{ routesName }} Routes @@ -261,7 +261,6 @@ export default { aclInit() { this.disableSaveButton = true try { - // console.log(this.policyPath, this.data1) // this.data1 = JSON.parse(JSON.stringify(importFresh(this.policyPath))); this.groupRoutes() this.initColumnCheckBox() @@ -342,18 +341,11 @@ export default { }, async save() { try { - // - // await this.sqlMgr.xcRoutesPolicyUpdate({ - // env: this.nodes.env, - // dbAlias: this.nodes.dbAlias, - // tn: this.nodes.tn, - // data: this.data1 - // }) await this.$store.dispatch('sqlMgr/ActSqlOp', [null, 'xcRoutesPolicyUpdate', { env: this.nodes.env, dbAlias: this.nodes.dbAlias, - tn: this.nodes.tn, + tn: this.nodes.table_name, data: this.data1 }]) diff --git a/packages/nc-gui/components/project/tableTabs/aclTsFileDbGql.vue b/packages/nc-gui/components/project/tableTabs/aclTsFileDbGql.vue index 5d157f7b3d..dde9f0a5b7 100644 --- a/packages/nc-gui/components/project/tableTabs/aclTsFileDbGql.vue +++ b/packages/nc-gui/components/project/tableTabs/aclTsFileDbGql.vue @@ -15,7 +15,7 @@ href: '#' }, { - text: nodes.tn + ' (ACL)', + text: nodes.table_name + ' (ACL)', disabled: true, href: '#' }]" @@ -78,7 +78,7 @@ dense hide-details class="ma-2" - :placeholder="`Search ${nodes.tn} resolvers`" + :placeholder="`Search ${nodes.table_name} resolvers`" prepend-inner-icon="search" outlined /> @@ -99,9 +99,9 @@ v-on="on" /> - {{ allToggle ? 'Disable' : 'Enable' }} all {{ nodes.tn }} resolvers for all roles + {{ allToggle ? 'Disable' : 'Enable' }} all {{ nodes.table_name }} resolvers for all roles - {{ nodes.tn }} Resolvers + {{ nodes.table_name }} Resolvers @@ -99,9 +99,9 @@ v-on="on" /> - {{ allToggle ? 'Disable' : 'Enable' }} all {{ nodes.tn }} resolvers for all roles + {{ allToggle ? 'Disable' : 'Enable' }} all {{ nodes.table_name }} resolvers for all roles - {{ nodes.tn }} Resolvers + {{ nodes.table_name }} Resolvers