From 066e20d0a2bdec9b65542b0986510b2c3e3aed38 Mon Sep 17 00:00:00 2001 From: Pawan Kumar Date: Wed, 2 Dec 2020 16:12:51 +0530 Subject: [PATCH] Fix: Remove Fusioncharts Watermark (#1978) * Fusion charts watermark can be removed by adding the `APPSMITH_FUSIONCHARTS_LICENSE_KEY` env variable. Co-authored-by: Pawan Kumar --- .github/workflows/client.yml | 419 +++++++++--------- .github/workflows/github-release.yml | 219 +++++---- app/client/public/index.html | 5 +- .../designSystems/appsmith/ChartComponent.tsx | 21 +- app/client/src/configs/index.ts | 14 + app/client/src/configs/types.ts | 4 + 6 files changed, 355 insertions(+), 327 deletions(-) diff --git a/.github/workflows/client.yml b/.github/workflows/client.yml index 83c7aa1612..974f54bc7b 100644 --- a/.github/workflows/client.yml +++ b/.github/workflows/client.yml @@ -1,15 +1,15 @@ -name: Appsmith Client Workflow +name: Appsmith Client Workflow on: push: - branches: [ release, master ] + branches: [release, master] # Only trigger if files have changed in this specific path paths: - - 'app/client/**' + - "app/client/**" pull_request_target: - branches: [ release, master ] + branches: [release, master] paths: - - 'app/client/**' + - "app/client/**" # Change the working directory for all the jobs in this workflow defaults: run: @@ -24,67 +24,67 @@ jobs: shell: bash steps: - # Checkout the code - - name: Checkout the merged commit from PR and base branch - if: ${{ github.event_name == 'pull_request_target' }} - uses: actions/checkout@v2 - with: - ref: refs/pull/${{ github.event.pull_request.number }}/merge + # Checkout the code + - name: Checkout the merged commit from PR and base branch + if: ${{ github.event_name == 'pull_request_target' }} + uses: actions/checkout@v2 + with: + ref: refs/pull/${{ github.event.pull_request.number }}/merge - - name: Checkout the head commit of the branch - if: ${{ github.event_name == 'push' }} - uses: actions/checkout@v2 + - name: Checkout the head commit of the branch + if: ${{ github.event_name == 'push' }} + uses: actions/checkout@v2 - - name: Figure out the PR number - run: echo ${{ github.event.pull_request.number }} + - name: Figure out the PR number + run: echo ${{ github.event.pull_request.number }} - - name: Use Node.js 10.16.3 - uses: actions/setup-node@v1 - with: - node-version: '10.16.3' + - name: Use Node.js 10.16.3 + uses: actions/setup-node@v1 + with: + node-version: "10.16.3" - # Retrieve npm dependencies from cache. After a successful run, these dependencies are cached again - - name: Cache npm dependencies - uses: actions/cache@v2 - env: - cache-name: cache-yarn-dependencies - with: - # npm dependencies are stored in `~/.npm` on Linux/macOS - path: ~/.npm - key: ${{ runner.OS }}-node-${{ hashFiles('**/yarn.lock') }} - restore-keys: | + # Retrieve npm dependencies from cache. After a successful run, these dependencies are cached again + - name: Cache npm dependencies + uses: actions/cache@v2 + env: + cache-name: cache-yarn-dependencies + with: + # npm dependencies are stored in `~/.npm` on Linux/macOS + path: ~/.npm + key: ${{ runner.OS }}-node-${{ hashFiles('**/yarn.lock') }} + restore-keys: | ${{ runner.OS }}-node- ${{ runner.OS }}- - # Install all the dependencies - - name: Install dependencies - run: yarn install - - - name: Set the build environment based on the branch - id: vars - run: | - REACT_APP_ENVIRONMENT="DEVELOPMENT" - if [ ${GITHUB_REF} == '/refs/heads/master' ]; then - REACT_APP_ENVIRONMENT="PRODUCTION" - elif [ ${GITHUB_REF} == '/refs/heads/release' ]; then - REACT_APP_ENVIRONMENT="STAGING" - fi - echo ::set-output name=REACT_APP_ENVIRONMENT::${REACT_APP_ENVIRONMENT} + # Install all the dependencies + - name: Install dependencies + run: yarn install - - name: Run the jest tests - run: REACT_APP_ENVIRONMENT=${{steps.vars.outputs.REACT_APP_ENVIRONMENT}} yarn run test:unit + - name: Set the build environment based on the branch + id: vars + run: | + REACT_APP_ENVIRONMENT="DEVELOPMENT" + if [ ${GITHUB_REF} == '/refs/heads/master' ]; then + REACT_APP_ENVIRONMENT="PRODUCTION" + elif [ ${GITHUB_REF} == '/refs/heads/release' ]; then + REACT_APP_ENVIRONMENT="STAGING" + fi + echo ::set-output name=REACT_APP_ENVIRONMENT::${REACT_APP_ENVIRONMENT} - # We burn React environment & the Segment analytics key into the build itself. - # This is to ensure that we don't need to configure it in each installation - - name: Create the bundle - run: REACT_APP_ENVIRONMENT=${{steps.vars.outputs.REACT_APP_ENVIRONMENT}} REACT_APP_SEGMENT_CE_KEY=${{ secrets.APPSMITH_SEGMENT_CE_KEY }} yarn build + - name: Run the jest tests + run: REACT_APP_ENVIRONMENT=${{steps.vars.outputs.REACT_APP_ENVIRONMENT}} yarn run test:unit - # Upload the build artifact so that it can be used by the test & deploy job in the workflow - - name: Upload react build bundle - uses: actions/upload-artifact@v2 - with: - name: build - path: app/client/build/ + # We burn React environment & the Segment analytics key into the build itself. + # This is to ensure that we don't need to configure it in each installation + - name: Create the bundle + run: REACT_APP_ENVIRONMENT=${{steps.vars.outputs.REACT_APP_ENVIRONMENT}} REACT_APP_FUSIONCHARTS_LICENSE_KEY=${{ secrets.APPSMITH_FUSIONCHARTS_LICENSE_KEY }} REACT_APP_SEGMENT_CE_KEY=${{ secrets.APPSMITH_SEGMENT_CE_KEY }} yarn build + + # Upload the build artifact so that it can be used by the test & deploy job in the workflow + - name: Upload react build bundle + uses: actions/upload-artifact@v2 + with: + name: build + path: app/client/build/ ui-test: needs: build @@ -108,134 +108,134 @@ jobs: - 6379:6379 mongo: image: mongo - ports: + ports: - 27017:27017 - + steps: - # Checkout the code - - name: Checkout the merged commit from PR and base branch - if: ${{ github.event_name == 'pull_request_target' }} - uses: actions/checkout@v2 - with: - ref: refs/pull/${{ github.event.pull_request.number }}/merge + # Checkout the code + - name: Checkout the merged commit from PR and base branch + if: ${{ github.event_name == 'pull_request_target' }} + uses: actions/checkout@v2 + with: + ref: refs/pull/${{ github.event.pull_request.number }}/merge - - name: Checkout the head commit of the branch - if: ${{ github.event_name == 'push' }} - uses: actions/checkout@v2 + - name: Checkout the head commit of the branch + if: ${{ github.event_name == 'push' }} + uses: actions/checkout@v2 - - name: Use Node.js 10.16.3 - uses: actions/setup-node@v1 - with: - node-version: '10.16.3' + - name: Use Node.js 10.16.3 + uses: actions/setup-node@v1 + with: + node-version: "10.16.3" - # Retrieve npm dependencies from cache. After a successful run, these dependencies are cached again - - name: Cache npm dependencies - uses: actions/cache@v2 - env: - cache-name: cache-yarn-dependencies - with: - # maven dependencies are stored in `~/.m2` on Linux/macOS - path: ~/.npm - key: ${{ runner.OS }}-node-${{ hashFiles('**/yarn.lock') }} - restore-keys: | + # Retrieve npm dependencies from cache. After a successful run, these dependencies are cached again + - name: Cache npm dependencies + uses: actions/cache@v2 + env: + cache-name: cache-yarn-dependencies + with: + # maven dependencies are stored in `~/.m2` on Linux/macOS + path: ~/.npm + key: ${{ runner.OS }}-node-${{ hashFiles('**/yarn.lock') }} + restore-keys: | ${{ runner.OS }}-node- ${{ runner.OS }}- - # Install all the dependencies - - name: Install dependencies - run: yarn install - - - name: Download the react build artifact - uses: actions/download-artifact@v2 - with: - name: build - path: app/client/build - - - name: Pull release server docker container and start it locally - if: github.ref == 'refs/heads/release' - shell: bash - run: | - echo ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | docker login -u ${{ secrets.DOCKER_HUB_USERNAME }} --password-stdin - - docker run -d --net=host --name appsmith-internal-server -p 8080:8080 \ - --env APPSMITH_MONGODB_URI=mongodb://localhost:27017/appsmith \ - --env APPSMITH_REDIS_URL=redis://localhost:6379 \ - --env APPSMITH_ENCRYPTION_PASSWORD=password \ - --env APPSMITH_ENCRYPTION_SALT=salt \ - --env APPSMITH_IS_SELF_HOSTED=false \ - appsmith/appsmith-server:release + # Install all the dependencies + - name: Install dependencies + run: yarn install - - name: Pull master server docker container and start it locally - if: github.ref == 'refs/heads/master' - shell: bash - run: | - echo ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | docker login -u ${{ secrets.DOCKER_HUB_USERNAME }} --password-stdin - - docker run -d --net=host --name appsmith-internal-server -p 8080:8080 \ - --env APPSMITH_MONGODB_URI=mongodb://localhost:27017/appsmith \ - --env APPSMITH_REDIS_URL=redis://localhost:6379 \ - --env APPSMITH_ENCRYPTION_PASSWORD=password \ - --env APPSMITH_ENCRYPTION_SALT=salt \ - --env APPSMITH_IS_SELF_HOSTED=false \ - appsmith/appsmith-server:nightly + - name: Download the react build artifact + uses: actions/download-artifact@v2 + with: + name: build + path: app/client/build - - name: Installing Yarn serve - run: | - yarn global add serve - echo "$(yarn global bin)" >> $GITHUB_PATH + - name: Pull release server docker container and start it locally + if: github.ref == 'refs/heads/release' + shell: bash + run: | + echo ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | docker login -u ${{ secrets.DOCKER_HUB_USERNAME }} --password-stdin - - name: Setting up the cypress tests - shell: bash - env: - APPSMITH_SSL_CERTIFICATE: ${{ secrets.APPSMITH_SSL_CERTIFICATE }} - APPSMITH_SSL_KEY: ${{ secrets.APPSMITH_SSL_KEY }} - CYPRESS_URL: ${{ secrets.CYPRESS_URL }} - CYPRESS_USERNAME: ${{ secrets.CYPRESS_USERNAME }} - CYPRESS_PASSWORD: ${{ secrets.CYPRESS_PASSWORD }} - CYPRESS_TESTUSERNAME1: ${{ secrets.CYPRESS_TESTUSERNAME1 }} - CYPRESS_TESTPASSWORD1: ${{ secrets.CYPRESS_TESTPASSWORD1 }} - CYPRESS_TESTUSERNAME2: ${{ secrets.CYPRESS_TESTUSERNAME2 }} - CYPRESS_TESTPASSWORD2: ${{ secrets.CYPRESS_TESTPASSWORD1 }} - APPSMITH_DISABLE_TELEMETRY: true - APPSMITH_GOOGLE_MAPS_API_KEY: ${{ secrets.APPSMITH_GOOGLE_MAPS_API_KEY }} - POSTGRES_PASSWORD: postgres - run: | - ./cypress/setup-test.sh - - - name: Run the cypress test - uses: cypress-io/github-action@v2 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} - CYPRESS_PROJECT_ID: ${{ secrets.CYPRESS_PROJECT_ID }} - CYPRESS_USERNAME: ${{ secrets.CYPRESS_USERNAME }} - CYPRESS_PASSWORD: ${{ secrets.CYPRESS_PASSWORD }} - CYPRESS_TESTUSERNAME1: ${{ secrets.CYPRESS_TESTUSERNAME1 }} - CYPRESS_TESTPASSWORD1: ${{ secrets.CYPRESS_TESTPASSWORD1 }} - CYPRESS_TESTUSERNAME2: ${{ secrets.CYPRESS_TESTUSERNAME2 }} - CYPRESS_TESTPASSWORD2: ${{ secrets.CYPRESS_TESTPASSWORD1 }} - APPSMITH_DISABLE_TELEMETRY: true - APPSMITH_GOOGLE_MAPS_API_KEY: ${{ secrets.APPSMITH_GOOGLE_MAPS_API_KEY }} - COMMIT_INFO_MESSAGE: ${{ github.event.pull_request.title }} - with: - browser: chrome - headless: true - record: true - install: false - parallel: true - group: 'Electrons on Github Action' - spec: 'cypress/integration/Smoke_TestSuite/*/*' - working-directory: app/client - # tag will be either "push" or "pull_request_target" - tag: ${{ github.event_name }} - env: 'NODE_ENV=development' + docker run -d --net=host --name appsmith-internal-server -p 8080:8080 \ + --env APPSMITH_MONGODB_URI=mongodb://localhost:27017/appsmith \ + --env APPSMITH_REDIS_URL=redis://localhost:6379 \ + --env APPSMITH_ENCRYPTION_PASSWORD=password \ + --env APPSMITH_ENCRYPTION_SALT=salt \ + --env APPSMITH_IS_SELF_HOSTED=false \ + appsmith/appsmith-server:release - # Upload the screenshots as artifacts if there's a failure - - uses: actions/upload-artifact@v1 - if: failure() - with: - name: cypress-screenshots-${{ matrix.job }} - path: app/client/cypress/screenshots/ + - name: Pull master server docker container and start it locally + if: github.ref == 'refs/heads/master' + shell: bash + run: | + echo ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | docker login -u ${{ secrets.DOCKER_HUB_USERNAME }} --password-stdin + + docker run -d --net=host --name appsmith-internal-server -p 8080:8080 \ + --env APPSMITH_MONGODB_URI=mongodb://localhost:27017/appsmith \ + --env APPSMITH_REDIS_URL=redis://localhost:6379 \ + --env APPSMITH_ENCRYPTION_PASSWORD=password \ + --env APPSMITH_ENCRYPTION_SALT=salt \ + --env APPSMITH_IS_SELF_HOSTED=false \ + appsmith/appsmith-server:nightly + + - name: Installing Yarn serve + run: | + yarn global add serve + echo "$(yarn global bin)" >> $GITHUB_PATH + + - name: Setting up the cypress tests + shell: bash + env: + APPSMITH_SSL_CERTIFICATE: ${{ secrets.APPSMITH_SSL_CERTIFICATE }} + APPSMITH_SSL_KEY: ${{ secrets.APPSMITH_SSL_KEY }} + CYPRESS_URL: ${{ secrets.CYPRESS_URL }} + CYPRESS_USERNAME: ${{ secrets.CYPRESS_USERNAME }} + CYPRESS_PASSWORD: ${{ secrets.CYPRESS_PASSWORD }} + CYPRESS_TESTUSERNAME1: ${{ secrets.CYPRESS_TESTUSERNAME1 }} + CYPRESS_TESTPASSWORD1: ${{ secrets.CYPRESS_TESTPASSWORD1 }} + CYPRESS_TESTUSERNAME2: ${{ secrets.CYPRESS_TESTUSERNAME2 }} + CYPRESS_TESTPASSWORD2: ${{ secrets.CYPRESS_TESTPASSWORD1 }} + APPSMITH_DISABLE_TELEMETRY: true + APPSMITH_GOOGLE_MAPS_API_KEY: ${{ secrets.APPSMITH_GOOGLE_MAPS_API_KEY }} + POSTGRES_PASSWORD: postgres + run: | + ./cypress/setup-test.sh + + - name: Run the cypress test + uses: cypress-io/github-action@v2 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} + CYPRESS_PROJECT_ID: ${{ secrets.CYPRESS_PROJECT_ID }} + CYPRESS_USERNAME: ${{ secrets.CYPRESS_USERNAME }} + CYPRESS_PASSWORD: ${{ secrets.CYPRESS_PASSWORD }} + CYPRESS_TESTUSERNAME1: ${{ secrets.CYPRESS_TESTUSERNAME1 }} + CYPRESS_TESTPASSWORD1: ${{ secrets.CYPRESS_TESTPASSWORD1 }} + CYPRESS_TESTUSERNAME2: ${{ secrets.CYPRESS_TESTUSERNAME2 }} + CYPRESS_TESTPASSWORD2: ${{ secrets.CYPRESS_TESTPASSWORD1 }} + APPSMITH_DISABLE_TELEMETRY: true + APPSMITH_GOOGLE_MAPS_API_KEY: ${{ secrets.APPSMITH_GOOGLE_MAPS_API_KEY }} + COMMIT_INFO_MESSAGE: ${{ github.event.pull_request.title }} + with: + browser: chrome + headless: true + record: true + install: false + parallel: true + group: "Electrons on Github Action" + spec: "cypress/integration/Smoke_TestSuite/*/*" + working-directory: app/client + # tag will be either "push" or "pull_request_target" + tag: ${{ github.event_name }} + env: "NODE_ENV=development" + + # Upload the screenshots as artifacts if there's a failure + - uses: actions/upload-artifact@v1 + if: failure() + with: + name: cypress-screenshots-${{ matrix.job }} + path: app/client/cypress/screenshots/ package: needs: ui-test @@ -247,43 +247,42 @@ jobs: if: always() && (github.ref == 'refs/heads/release' || github.ref == 'refs/heads/master') steps: - - # Checkout the code - - name: Checkout the merged commit from PR and base branch - if: ${{ github.event_name == 'pull_request_target' }} - uses: actions/checkout@v2 - with: - ref: refs/pull/${{ github.event.pull_request.number }}/merge + # Checkout the code + - name: Checkout the merged commit from PR and base branch + if: ${{ github.event_name == 'pull_request_target' }} + uses: actions/checkout@v2 + with: + ref: refs/pull/${{ github.event.pull_request.number }}/merge - - name: Checkout the head commit of the branch - if: ${{ github.event_name == 'push' }} - uses: actions/checkout@v2 - - - name: Download the react build artifact - uses: actions/download-artifact@v2 - with: - name: build - path: app/client/build - - # Here, the GITHUB_REF is of type /refs/head/. We extract branch_name from this by removing the - # first 11 characters. This can be used to build images for several branches - - name: Get the version to tag the Docker image - id: branch_name - run: echo ::set-output name=tag::$(echo ${GITHUB_REF:11}) + - name: Checkout the head commit of the branch + if: ${{ github.event_name == 'push' }} + uses: actions/checkout@v2 - # Build release Docker image and push to Docker Hub - - name: Push release image to Docker Hub - if: success() && github.ref == 'refs/heads/release' && github.event_name == 'push' - run: | - docker build -t appsmith/appsmith-editor:${{steps.branch_name.outputs.tag}} . - echo ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | docker login -u ${{ secrets.DOCKER_HUB_USERNAME }} --password-stdin - docker push appsmith/appsmith-editor - - # Build master Docker image and push to Docker Hub - - name: Push production image to Docker Hub with commit tag - if: success() && github.ref == 'refs/heads/master' && github.event_name == 'push' - run: | - docker build -t appsmith/appsmith-editor:${GITHUB_SHA} . - docker build -t appsmith/appsmith-editor:nightly . - echo ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | docker login -u ${{ secrets.DOCKER_HUB_USERNAME }} --password-stdin - docker push appsmith/appsmith-editor \ No newline at end of file + - name: Download the react build artifact + uses: actions/download-artifact@v2 + with: + name: build + path: app/client/build + + # Here, the GITHUB_REF is of type /refs/head/. We extract branch_name from this by removing the + # first 11 characters. This can be used to build images for several branches + - name: Get the version to tag the Docker image + id: branch_name + run: echo ::set-output name=tag::$(echo ${GITHUB_REF:11}) + + # Build release Docker image and push to Docker Hub + - name: Push release image to Docker Hub + if: success() && github.ref == 'refs/heads/release' && github.event_name == 'push' + run: | + docker build -t appsmith/appsmith-editor:${{steps.branch_name.outputs.tag}} . + echo ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | docker login -u ${{ secrets.DOCKER_HUB_USERNAME }} --password-stdin + docker push appsmith/appsmith-editor + + # Build master Docker image and push to Docker Hub + - name: Push production image to Docker Hub with commit tag + if: success() && github.ref == 'refs/heads/master' && github.event_name == 'push' + run: | + docker build -t appsmith/appsmith-editor:${GITHUB_SHA} . + docker build -t appsmith/appsmith-editor:nightly . + echo ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | docker login -u ${{ secrets.DOCKER_HUB_USERNAME }} --password-stdin + docker push appsmith/appsmith-editor diff --git a/.github/workflows/github-release.yml b/.github/workflows/github-release.yml index 0feb8b2d7d..edb7477e04 100644 --- a/.github/workflows/github-release.yml +++ b/.github/workflows/github-release.yml @@ -1,4 +1,4 @@ -name: Appsmith Github Release Workflow +name: Appsmith Github Release Workflow on: push: @@ -14,56 +14,56 @@ jobs: working-directory: app/client steps: - # Checkout the code - - uses: actions/checkout@v2 + # Checkout the code + - uses: actions/checkout@v2 - - name: Use Node.js 10.16.3 - uses: actions/setup-node@v1 - with: - node-version: '10.16.3' - - # Retrieve npm dependencies from cache. After a successful run, these dependencies are cached again - - name: Cache npm dependencies - uses: actions/cache@v2 - env: - cache-name: cache-yarn-dependencies - with: - # npm dependencies are stored in `~/.m2` on Linux/macOS - path: ~/.npm - key: ${{ runner.OS }}-node-${{ hashFiles('**/yarn.lock') }} - restore-keys: | + - name: Use Node.js 10.16.3 + uses: actions/setup-node@v1 + with: + node-version: "10.16.3" + + # Retrieve npm dependencies from cache. After a successful run, these dependencies are cached again + - name: Cache npm dependencies + uses: actions/cache@v2 + env: + cache-name: cache-yarn-dependencies + with: + # npm dependencies are stored in `~/.m2` on Linux/macOS + path: ~/.npm + key: ${{ runner.OS }}-node-${{ hashFiles('**/yarn.lock') }} + restore-keys: | ${{ runner.OS }}-node- ${{ runner.OS }}- - - # Install all the dependencies - - name: Install dependencies - run: yarn install - - name: Set the build environment based on the branch - id: vars - run: | - REACT_APP_ENVIRONMENT="PRODUCTION" - echo ::set-output name=REACT_APP_ENVIRONMENT::${REACT_APP_ENVIRONMENT} - - - name: Create the bundle - run: REACT_APP_ENVIRONMENT=${{steps.vars.outputs.REACT_APP_ENVIRONMENT}} REACT_APP_SEGMENT_CE_KEY=${{ secrets.APPSMITH_SEGMENT_CE_KEY }} yarn build - - - name: Get the version - id: get_version - run: echo ::set-output name=tag::${GITHUB_REF#refs/tags/} - - # Build Docker image and push to Docker Hub - - name: Push production image to Docker Hub with commit tag - run: | - docker build -t appsmith/appsmith-editor:${{steps.get_version.outputs.tag}} . - - # Only build & tag with latest if the tag doesn't contain beta - if [[ ! ${{steps.get_version.outputs.tag}} == *"beta"* ]]; then - docker build -t appsmith/appsmith-editor:latest . - fi - - echo ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | docker login -u ${{ secrets.DOCKER_HUB_USERNAME }} --password-stdin - docker push appsmith/appsmith-editor + # Install all the dependencies + - name: Install dependencies + run: yarn install + + - name: Set the build environment based on the branch + id: vars + run: | + REACT_APP_ENVIRONMENT="PRODUCTION" + echo ::set-output name=REACT_APP_ENVIRONMENT::${REACT_APP_ENVIRONMENT} + + - name: Create the bundle + run: REACT_APP_ENVIRONMENT=${{steps.vars.outputs.REACT_APP_ENVIRONMENT}} REACT_APP_FUSIONCHARTS_LICENSE_KEY=${{ secrets.APPSMITH_FUSIONCHARTS_LICENSE_KEY }} REACT_APP_SEGMENT_CE_KEY=${{ secrets.APPSMITH_SEGMENT_CE_KEY }} yarn build + + - name: Get the version + id: get_version + run: echo ::set-output name=tag::${GITHUB_REF#refs/tags/} + + # Build Docker image and push to Docker Hub + - name: Push production image to Docker Hub with commit tag + run: | + docker build -t appsmith/appsmith-editor:${{steps.get_version.outputs.tag}} . + + # Only build & tag with latest if the tag doesn't contain beta + if [[ ! ${{steps.get_version.outputs.tag}} == *"beta"* ]]; then + docker build -t appsmith/appsmith-editor:latest . + fi + + echo ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | docker login -u ${{ secrets.DOCKER_HUB_USERNAME }} --password-stdin + docker push appsmith/appsmith-editor build-server: runs-on: ubuntu-latest @@ -72,78 +72,77 @@ jobs: working-directory: app/server steps: - # Checkout the code - - uses: actions/checkout@v2 - - # Setup Java - - name: Set up JDK 1.11 - uses: actions/setup-java@v1 - with: - java-version: 1.11 - - # Retrieve maven dependencies from cache. After a successful run, these dependencies are cached again - - name: Cache maven dependencies - uses: actions/cache@v2 - env: - cache-name: cache-maven-dependencies - with: - # maven dependencies are stored in `~/.m2` on Linux/macOS - path: ~/.m2 - key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} - restore-keys: ${{ runner.os }}-m2 - - # Build the code - - name: Build without running any tests - run: mvn -B package -DskipTests - - - name: Get the version - id: get_version - run: echo ::set-output name=tag::${GITHUB_REF#refs/tags/} - - # Build Docker image and push to Docker Hub - - name: Push image to Docker Hub - run: | - docker build --build-arg APPSMITH_SEGMENT_CE_KEY=${{ secrets.APPSMITH_SEGMENT_CE_KEY }} -t appsmith/appsmith-server:${{steps.get_version.outputs.tag}} . + # Checkout the code + - uses: actions/checkout@v2 - # Only build & tag with latest if the tag doesn't contain beta - if [[ ! ${{steps.get_version.outputs.tag}} == *"beta"* ]]; then - docker build --build-arg APPSMITH_SEGMENT_CE_KEY=${{ secrets.APPSMITH_SEGMENT_CE_KEY }} -t appsmith/appsmith-server:latest . - fi + # Setup Java + - name: Set up JDK 1.11 + uses: actions/setup-java@v1 + with: + java-version: 1.11 - echo ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | docker login -u ${{ secrets.DOCKER_HUB_USERNAME }} --password-stdin - docker push appsmith/appsmith-server + # Retrieve maven dependencies from cache. After a successful run, these dependencies are cached again + - name: Cache maven dependencies + uses: actions/cache@v2 + env: + cache-name: cache-maven-dependencies + with: + # maven dependencies are stored in `~/.m2` on Linux/macOS + path: ~/.m2 + key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} + restore-keys: ${{ runner.os }}-m2 + + # Build the code + - name: Build without running any tests + run: mvn -B package -DskipTests + + - name: Get the version + id: get_version + run: echo ::set-output name=tag::${GITHUB_REF#refs/tags/} + + # Build Docker image and push to Docker Hub + - name: Push image to Docker Hub + run: | + docker build --build-arg APPSMITH_SEGMENT_CE_KEY=${{ secrets.APPSMITH_SEGMENT_CE_KEY }} -t appsmith/appsmith-server:${{steps.get_version.outputs.tag}} . + + # Only build & tag with latest if the tag doesn't contain beta + if [[ ! ${{steps.get_version.outputs.tag}} == *"beta"* ]]; then + docker build --build-arg APPSMITH_SEGMENT_CE_KEY=${{ secrets.APPSMITH_SEGMENT_CE_KEY }} -t appsmith/appsmith-server:latest . + fi + + echo ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | docker login -u ${{ secrets.DOCKER_HUB_USERNAME }} --password-stdin + docker push appsmith/appsmith-server create-release: - needs: + needs: - build-server - build-client runs-on: ubuntu-latest steps: - # Creating the release on Github - - name: Get the version - id: get_version - run: echo ::set-output name=tag::${GITHUB_REF#refs/tags/} + # Creating the release on Github + - name: Get the version + id: get_version + run: echo ::set-output name=tag::${GITHUB_REF#refs/tags/} - # If the tag has the string "beta", then mark the Github release as a pre-release - - name: Get the version - id: get_prerelease - run: | - STATUS=false - if [[ ${{steps.get_version.outputs.tag}} == *"beta"* ]]; then - STATUS=true - fi + # If the tag has the string "beta", then mark the Github release as a pre-release + - name: Get the version + id: get_prerelease + run: | + STATUS=false + if [[ ${{steps.get_version.outputs.tag}} == *"beta"* ]]; then + STATUS=true + fi - echo ::set-output name=status::${STATUS} + echo ::set-output name=status::${STATUS} - - name: Create Release - id: create_release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: ${{ github.ref }} - release_name: Release ${{ github.ref }} - draft: false - prerelease: ${{steps.get_prerelease.outputs.status}} - \ No newline at end of file + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref }} + release_name: Release ${{ github.ref }} + draft: false + prerelease: ${{steps.get_prerelease.outputs.status}} diff --git a/app/client/public/index.html b/app/client/public/index.html index cf2a03b0a9..f39036d853 100755 --- a/app/client/public/index.html +++ b/app/client/public/index.html @@ -98,7 +98,7 @@ } const LOG_LEVELS = ["debug", "error"]; const CONFIG_LOG_LEVEL_INDEX = LOG_LEVELS.indexOf(parseConfig("__APPSMITH_CLIENT_LOG_LEVEL__")); - + const APP_ID = parseConfig("__APPSMITH_INTERCOM_APP_ID__"); const CLOUD_HOSTING = parseConfig("__APPSMITH_CLOUD_HOSTING__").length > 0; const DISABLE_TELEMETRY = parseConfig("__APPSMITH_DISABLE_TELEMETRY__").toLowerCase(); @@ -125,6 +125,9 @@ apiKey: parseConfig("__APPSMITH_SEGMENT_KEY__"), ceKey: parseConfig("__APPSMITH_SEGMENT_CE_KEY__"), }, + fusioncharts: { + licenseKey: parseConfig("__APPSMITH_FUSIONCHARTS_LICENSE_KEY__") + }, optimizely: parseConfig("__APPSMITH_OPTIMIZELY_KEY__"), enableMixpanel: parseConfig("__APPSMITH_SEGMENT_KEY__").length > 0, algolia: { diff --git a/app/client/src/components/designSystems/appsmith/ChartComponent.tsx b/app/client/src/components/designSystems/appsmith/ChartComponent.tsx index d64a38f302..159bb4d777 100644 --- a/app/client/src/components/designSystems/appsmith/ChartComponent.tsx +++ b/app/client/src/components/designSystems/appsmith/ChartComponent.tsx @@ -1,14 +1,23 @@ -import React from "react"; -import { ChartType, ChartData, ChartDataPoint } from "widgets/ChartWidget"; -import styled from "styled-components"; -import { invisible } from "constants/DefaultTheme"; import _ from "lodash"; +import React from "react"; +import styled from "styled-components"; + +import { invisible } from "constants/DefaultTheme"; +import { getAppsmithConfigs } from "configs"; +import { ChartType, ChartData, ChartDataPoint } from "widgets/ChartWidget"; + const FusionCharts = require("fusioncharts"); const Charts = require("fusioncharts/fusioncharts.charts"); const FusionTheme = require("fusioncharts/themes/fusioncharts.theme.fusion"); + +const { fusioncharts } = getAppsmithConfigs(); Charts(FusionCharts); FusionTheme(FusionCharts); -FusionCharts.options.creditLabel = false; + +FusionCharts.options.license({ + key: fusioncharts.licenseKey, + creditLabel: false, +}); export interface ChartComponentProps { chartType: ChartType; @@ -231,7 +240,7 @@ class ChartComponent extends React.Component { componentDidMount() { this.createGraph(); FusionCharts.ready(() => { - /* Component could be unmounted before FusionCharts is ready, + /* Component could be unmounted before FusionCharts is ready, this check ensure we don't render on unmounted component */ if (this.chartInstance) { this.chartInstance.render(); diff --git a/app/client/src/configs/index.ts b/app/client/src/configs/index.ts index e1dd4cea58..5f3e2e4b3a 100644 --- a/app/client/src/configs/index.ts +++ b/app/client/src/configs/index.ts @@ -20,6 +20,9 @@ type INJECTED_CONFIGS = { apiKey: string; ceKey: string; }; + fusioncharts: { + licenseKey: string; + }; optimizely: string; enableMixpanel: boolean; google: string; @@ -74,6 +77,9 @@ const getConfigsFromEnvVars = (): INJECTED_CONFIGS => { apiKey: process.env.REACT_APP_SEGMENT_KEY || "", ceKey: process.env.REACT_APP_SEGMENT_CE_KEY || "", }, + fusioncharts: { + licenseKey: process.env.REACT_APP_FUSIONCHARTS_LICENSE_KEY || "", + }, optimizely: process.env.REACT_APP_OPTIMIZELY_KEY || "", enableMixpanel: process.env.REACT_APP_SEGMENT_KEY ? process.env.REACT_APP_SEGMENT_KEY.length > 0 @@ -151,6 +157,10 @@ export const getAppsmithConfigs = (): AppsmithUIConfigs => { ENV_CONFIG.segment.apiKey, APPSMITH_FEATURE_CONFIGS.segment.apiKey, ); + const fusioncharts = getConfig( + ENV_CONFIG.fusioncharts.licenseKey, + APPSMITH_FEATURE_CONFIGS.fusioncharts.licenseKey, + ); const google = getConfig(ENV_CONFIG.google, APPSMITH_FEATURE_CONFIGS.google); // As the following shows, the config variables can be set using a combination @@ -217,6 +227,10 @@ export const getAppsmithConfigs = (): AppsmithUIConfigs => { apiKey: segment.value, ceKey: segmentCEKey.value, }, + fusioncharts: { + enabled: fusioncharts.enabled, + licenseKey: fusioncharts.value, + }, algolia: { enabled: true, apiId: algoliaAPIID.value || "AZ2Z9CJSJ0", diff --git a/app/client/src/configs/types.ts b/app/client/src/configs/types.ts index 7007f200fd..2c4adfe9d8 100644 --- a/app/client/src/configs/types.ts +++ b/app/client/src/configs/types.ts @@ -37,6 +37,10 @@ export type AppsmithUIConfigs = { apiKey: string; ceKey: string; }; + fusioncharts: { + enabled: boolean; + licenseKey: string; + }; algolia: { enabled: boolean; apiId: string;