From f38846d9592e5f52702c08f02465b50d66864c37 Mon Sep 17 00:00:00 2001 From: Tolulope Adetula <31691737+Tooluloope@users.noreply.github.com> Date: Mon, 13 Mar 2023 09:53:35 +0000 Subject: [PATCH 1/8] Revert "chore: Hotfix Release v1.9.11.1 (#21340)" This reverts commit e2b3e7e08d8faac17e8dda7193c2302689a2bfad. --- .github/workflows/build-docker-image.yml | 99 ------------------- .github/workflows/ci-debugging.yml | 95 ------------------ .github/workflows/ci-test.yml | 49 +++++++-- .../workflows/integration-tests-command.yml | 14 +-- .github/workflows/perf-test.yml | 52 ++++++++-- .github/workflows/test-build-docker-image.yml | 14 +-- app/client/cypress/apply-patches.js | 2 +- .../cypress/fixtures/listv2PaginationDsl.json | 1 - .../ListV2/ListV2_PageNo_PageSize_spec.js | 7 ++ app/client/cypress/package.json | 43 -------- app/client/src/utils/widgetRenderUtils.tsx | 12 +-- .../src/widgets/ListWidgetV2/widget/index.tsx | 23 +---- .../appsmith/git/service/GitExecutorImpl.java | 30 +----- ci-debug.sh | 18 ---- 14 files changed, 102 insertions(+), 357 deletions(-) delete mode 100644 .github/workflows/build-docker-image.yml delete mode 100644 .github/workflows/ci-debugging.yml delete mode 100644 app/client/cypress/package.json delete mode 100644 ci-debug.sh diff --git a/.github/workflows/build-docker-image.yml b/.github/workflows/build-docker-image.yml deleted file mode 100644 index db2fdae24c..0000000000 --- a/.github/workflows/build-docker-image.yml +++ /dev/null @@ -1,99 +0,0 @@ -name: Appsmith Build Docker Image Workflow - -on: - # This line enables manual triggering of this workflow. - workflow_dispatch: - workflow_call: - inputs: - pr: - description: "This is the PR number in case the workflow is being called in a pull request" - required: false - type: number - -jobs: - build-docker: - runs-on: ubuntu-latest - if: | - github.event.pull_request.head.repo.full_name == github.repository || - github.event_name == 'push' || - github.event_name == 'workflow_dispatch' || - github.event_name == 'repository_dispatch' - defaults: - run: - shell: bash - - steps: - # Check out merge commit - - name: Fork based /ok-to-test checkout - if: inputs.pr != 0 - uses: actions/checkout@v3 - with: - fetch-depth: 0 - ref: "refs/pull/${{ inputs.pr }}/merge" - - # Checkout the code in the current branch in case the workflow is called because of a branch push event - - name: Checkout the head commit of the branch - if: inputs.pr == 0 - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - # Setup Java - - name: Set up JDK 17 - if: steps.run_result.outputs.run_result != 'success' - uses: actions/setup-java@v3 - with: - distribution: 'temurin' - java-version: '17' - - - name: Download the client build artifact - if: steps.run_result.outputs.run_result != 'success' - uses: actions/download-artifact@v3 - with: - name: client-build - path: app/client/build - - - name: Download the server build artifact - if: steps.run_result.outputs.run_result != 'success' - uses: actions/download-artifact@v3 - with: - name: server-build - path: app/server/dist/ - - - name: Download the rts build artifact - if: steps.run_result.outputs.run_result != 'success' - uses: actions/download-artifact@v3 - with: - name: rts-dist - path: app/rts/dist - - - name: Un-tar the rts folder - run: | - tar -xvf app/rts/dist/rts-dist.tar -C app/rts/ - echo "Cleaning up the tar files" - rm app/rts/dist/rts-dist.tar - - # We don't use Depot Docker builds because it's faster for local Docker images to be built locally. - # It's slower and more expensive to build these Docker images on Depot and download it back to the CI node. - - name: Build docker image - if: steps.run_result.outputs.run_result != 'success' - working-directory: "." - run: | - docker build -t cicontainer . - - # Saving the docker image to tar file - - name: Save Docker image to tar file - run: | - docker save cicontainer -o cicontainer.tar - gzip cicontainer.tar - - # Uploading the artifact to use it in other subsequent runners - - name: Upload Docker image to artifacts - uses: actions/upload-artifact@v3 - with: - name: cicontainer - path: cicontainer.tar.gz - - - name: Save the status of the run - run: echo "run_result=success" >> $GITHUB_OUTPUT > ~/run_result - \ No newline at end of file diff --git a/.github/workflows/ci-debugging.yml b/.github/workflows/ci-debugging.yml deleted file mode 100644 index aaea85da11..0000000000 --- a/.github/workflows/ci-debugging.yml +++ /dev/null @@ -1,95 +0,0 @@ -name: CI Debugging - -on: - # This line enables manual triggering of this workflow. - workflow_dispatch: - inputs: - run_id: - description: 'Run id to download artifacts:' - required: true - type: number - -jobs: - ci-debugger: - runs-on: ubuntu-latest - if: github.event_name == 'workflow_dispatch' - defaults: - run: - shell: bash - strategy: - fail-fast: false - matrix: - job: [ 0 ] - - # Service containers to run with this job. Required for running tests - services: - # Label used to access the service container - redis: - # Docker Hub image for Redis - image: redis - ports: - # Opens tcp port 6379 on the host and service container - - 6379:6379 - mongo: - image: mongo - ports: - - 27017:27017 - - steps: - - name: Set up Depot CLI - uses: depot/setup-action@v1 - - - name: Checkout the head commit of the branch - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Download Docker image artifact - uses: dawidd6/action-download-artifact@v2 - with: - name: cicontainer - run_id: ${{ github.event.inputs.run_id }} - - - name: Load Docker image from tar file - run: | - gunzip cicontainer.tar.gz - docker load -i cicontainer.tar - - - name: Create folder - if: steps.run_result.outputs.run_result != 'success' - env: - APPSMITH_LICENSE_KEY: ${{ secrets.APPSMITH_LICENSE_KEY }} - working-directory: "." - run: | - mkdir -p cicontainerlocal/stacks/configuration/ - - - name: Run docker image - if: steps.run_result.outputs.run_result != 'success' - env: - APPSMITH_LICENSE_KEY: ${{ secrets.APPSMITH_LICENSE_KEY }} - working-directory: "." - run: | - sudo /etc/init.d/ssh stop ; - mkdir -p ~/git-server/keys - mkdir -p ~/git-server/repos - docker run --name test-event-driver -d -p 22:22 -p 5001:5001 -p 3306:3306 \ - -p 5432:5432 -p 28017:27017 -p 25:25 -p 5000:5000 -p 3001:3000 --privileged --pid=host --ipc=host --volume /:/host -v ~/git-server/keys:/git-server/keys \ - -v ~/git-server/repos:/git-server/repos appsmith/test-event-driver:latest - cd cicontainerlocal - docker run -d --name appsmith -p 80:80 -p 9001:9001 \ - -v "$PWD/stacks:/appsmith-stacks" -e APPSMITH_LICENSE_KEY=$APPSMITH_LICENSE_KEY \ - -e APPSMITH_DISABLE_TELEMETRY=true \ - -e APPSMITH_CLOUD_SERVICES_BASE_URL=http://host.docker.internal:5001 \ - --add-host=host.docker.internal:host-gateway \ - cicontainer - - - name: Execute access to ci-debug.sh - if: steps.run_result.outputs.run_result != 'success' - working-directory: "." - run: | - chmod +x ci-debug.sh - - # Start tmate session for tunnelling - - name: Setup tmate session - if: steps.run_result.outputs.run_result != 'success' - uses: mxschmitt/action-tmate@v3 diff --git a/.github/workflows/ci-test.yml b/.github/workflows/ci-test.yml index 4c115f2a92..b6dfac30f9 100644 --- a/.github/workflows/ci-test.yml +++ b/.github/workflows/ci-test.yml @@ -116,15 +116,48 @@ jobs: - name: cat run_result run: echo ${{ steps.run_result.outputs.run_result }} - - name: Download Docker image artifact + # Setup Java + - name: Set up JDK 17 + if: steps.run_result.outputs.run_result != 'success' + uses: actions/setup-java@v3 + with: + distribution: 'temurin' + java-version: '17' + + - name: Download the client build artifact + if: steps.run_result.outputs.run_result != 'success' uses: actions/download-artifact@v3 with: - name: cicontainer + name: client-build + path: app/client/build - - name: Load Docker image from tar file + - name: Download the server build artifact + if: steps.run_result.outputs.run_result != 'success' + uses: actions/download-artifact@v3 + with: + name: server-build + path: app/server/dist/ + + - name: Download the rts build artifact + if: steps.run_result.outputs.run_result != 'success' + uses: actions/download-artifact@v3 + with: + name: rts-dist + path: app/rts/dist + + - name: Un-tar the rts folder run: | - gunzip cicontainer.tar.gz - docker load -i cicontainer.tar + tar -xvf app/rts/dist/rts-dist.tar -C app/rts/ + echo "Cleaning up the tar files" + rm app/rts/dist/rts-dist.tar + + # We don't use Depot Docker builds because it's faster for local Docker images to be built locally. + # It's slower and more expensive to build these Docker images on Depot and download it back to the CI node. + - name: Build docker image + if: steps.run_result.outputs.run_result != 'success' + working-directory: "." + run: | + docker build -t cicontainer . - name: Create folder if: steps.run_result.outputs.run_result != 'success' @@ -144,7 +177,7 @@ jobs: submodules: 'recursive' path: cicontainerlocal/oldstack - - name: Run docker image + - name: Load docker image if: steps.run_result.outputs.run_result != 'success' env: APPSMITH_LICENSE_KEY: ${{ secrets.APPSMITH_LICENSE_KEY }} @@ -175,9 +208,7 @@ jobs: if: steps.run_result.outputs.run_result != 'success' run: | cd app/client - yarn install \ - --cwd cypress \ - --modules-folder ../node_modules + yarn install - name: Setting up the cypress tests if: steps.run_result.outputs.run_result != 'success' diff --git a/.github/workflows/integration-tests-command.yml b/.github/workflows/integration-tests-command.yml index cf732f6d47..4810e1c4d8 100644 --- a/.github/workflows/integration-tests-command.yml +++ b/.github/workflows/integration-tests-command.yml @@ -56,18 +56,8 @@ jobs: with: pr: ${{ github.event.client_payload.pull_request.number }} - build-docker-image: - needs: [ client-build, server-build, rts-build ] - # Only run if the build step is successful - if: success() - name: build-docker-image - uses: ./.github/workflows/build-docker-image.yml - secrets: inherit - with: - pr: ${{ github.event.client_payload.pull_request.number }} - ci-test: - needs: [ build-docker-image ] + needs: [ client-build, server-build, rts-build ] # Only run if the build step is successful if: success() name: ci-test @@ -77,7 +67,7 @@ jobs: pr: ${{ github.event.client_payload.pull_request.number }} perf-test: - needs: [ build-docker-image ] + needs: [ client-build, server-build, rts-build ] # Only run if the build step is successful if: success() name: perf-test diff --git a/.github/workflows/perf-test.yml b/.github/workflows/perf-test.yml index 6e7da86d4d..2e80681abf 100644 --- a/.github/workflows/perf-test.yml +++ b/.github/workflows/perf-test.yml @@ -107,22 +107,53 @@ jobs: if: steps.run_result.outputs.run_result != 'success' run: yarn install --frozen-lockfile + # Setup Java + - name: Set up JDK 17 + if: steps.run_result.outputs.run_result != 'success' + uses: actions/setup-java@v3 + with: + distribution: 'temurin' + java-version: '17' + + - name: Download the react build artifact + if: steps.run_result.outputs.run_result != 'success' + uses: actions/download-artifact@v3 + with: + name: client-build + path: app/client/build + + - name: Download the server build artifact + if: steps.run_result.outputs.run_result != 'success' + uses: actions/download-artifact@v3 + with: + name: server-build + path: app/server/dist + + - name: Download the rts build artifact + uses: actions/download-artifact@v3 + with: + name: rts-dist + path: app/rts/dist + + - name: Un-tar the rts folder + working-directory: "." + run: | + tar -xvf app/rts/dist/rts-dist.tar -C app/rts/ + echo "Cleaning up the tar files" + rm app/rts/dist/rts-dist.tar + - name: Installing Yarn serve if: steps.run_result.outputs.run_result != 'success' run: | yarn global add serve echo "$(yarn global bin)" >> $GITHUB_PATH - - - name: Download Docker image artifact - uses: actions/download-artifact@v3 - with: - name: cicontainer - - - name: Load Docker image from tar file + # We don't use Depot Docker builds because it's faster for local Docker images to be built locally. + # It's slower and more expensive to build these Docker images on Depot and download it back to the CI node. + - name: Build docker image + if: steps.run_result.outputs.run_result != 'success' working-directory: "." run: | - gunzip cicontainer.tar.gz - docker load -i cicontainer.tar + docker build -t cicontainer . - name: Create folder if: steps.run_result.outputs.run_result != 'success' @@ -132,7 +163,8 @@ jobs: run: | mkdir -p cicontainerlocal/stacks/configuration/ - - name: Run docker image + + - name: Load docker image if: steps.run_result.outputs.run_result != 'success' env: APPSMITH_LICENSE_KEY: ${{ secrets.APPSMITH_LICENSE_KEY }} diff --git a/.github/workflows/test-build-docker-image.yml b/.github/workflows/test-build-docker-image.yml index 6ba9f88479..80585da910 100644 --- a/.github/workflows/test-build-docker-image.yml +++ b/.github/workflows/test-build-docker-image.yml @@ -36,18 +36,8 @@ jobs: with: pr: 0 - build-docker-image: - needs: [ client-build, server-build, rts-build ] - # Only run if the build step is successful - if: success() - name: build-docker-image - uses: ./.github/workflows/build-docker-image.yml - secrets: inherit - with: - pr: 0 - perf-test: - needs: [ build-docker-image ] + needs: [client-build, server-build, rts-build] # Only run if the build step is successful if: success() name: perf-test @@ -57,7 +47,7 @@ jobs: pr: 0 ci-test: - needs: [ build-docker-image ] + needs: [ client-build, server-build, rts-build ] # Only run if the build step is successful if: success() name: ci-test diff --git a/app/client/cypress/apply-patches.js b/app/client/cypress/apply-patches.js index d4a94ebe60..779a04367d 100644 --- a/app/client/cypress/apply-patches.js +++ b/app/client/cypress/apply-patches.js @@ -5,7 +5,7 @@ const fs = require("fs/promises"); const path = require("path"); async function applyPatches() { - const patchesDir = path.join("patches"); + const patchesDir = path.join("cypress", "patches"); const patchesAbsDir = path.join(process.cwd(), patchesDir); const patches = await fs.readdir(patchesAbsDir); const installDir = getVersionDir(); diff --git a/app/client/cypress/fixtures/listv2PaginationDsl.json b/app/client/cypress/fixtures/listv2PaginationDsl.json index 2facbd179e..824a0b7cf5 100644 --- a/app/client/cypress/fixtures/listv2PaginationDsl.json +++ b/app/client/cypress/fixtures/listv2PaginationDsl.json @@ -77,7 +77,6 @@ "displayName": "List V2", "iconSVG": "/static/media/icon.9925ee17dee37bf1ba7374412563a8a7.svg", "topRow": 5, - "pageSize": 4, "bottomRow": 60, "parentRowSpace": 10, "currentItemsView": "{{[]}}", diff --git a/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/Widgets/ListV2/ListV2_PageNo_PageSize_spec.js b/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/Widgets/ListV2/ListV2_PageNo_PageSize_spec.js index 9841d76b17..ecfd29dd2e 100644 --- a/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/Widgets/ListV2/ListV2_PageNo_PageSize_spec.js +++ b/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/Widgets/ListV2/ListV2_PageNo_PageSize_spec.js @@ -137,6 +137,13 @@ describe("List widget V2 page number and page size", () => { }); cy.openPropertyPane("listwidgetv2"); + // toggle serversidepagination -> true + cy.togglebar(".t--property-control-serversidepagination input"); + cy.wait("@updateLayout"); + + // toggle serversidepagination -> false + cy.togglebarDisable(".t--property-control-serversidepagination input"); + cy.openPropertyPane("textwidget"); cy.testJsontextclear("text"); cy.testJsontext("text", `PageSize {{List1.pageSize}}`); diff --git a/app/client/cypress/package.json b/app/client/cypress/package.json deleted file mode 100644 index 499fc20c99..0000000000 --- a/app/client/cypress/package.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "name": "appsmith-ci-test", - "version": "0.1.0", - "private": true, - "engines": { - "node": "^16.14.0", - "npm": "^8.5.5" - }, - "scripts": { - "install": "node apply-patches.js" - }, - "browserslist": [ - ">0.2%", - "not dead", - "not ie <= 11", - "not op_mini all" - ], - "devDependencies": { - "@blueprintjs/core": "^3.36.0", - "@blueprintjs/datetime": "^3.23.6", - "@blueprintjs/icons": "^3.10.0", - "@blueprintjs/popover2": "^0.5.0", - "@blueprintjs/select": "^3.10.0", - "@typescript-eslint/eslint-plugin": "^5.25.0", - "@typescript-eslint/parser": "^5.25.0", - "@faker-js/faker": "^7.4.0", - "cypress-log-to-output": "^1.1.2", - "cy-verify-downloads": "^0.0.5", - "cypress": "9.7.0", - "cypress-file-upload": "^4.1.1", - "cypress-image-snapshot": "^4.0.1", - "cypress-multi-reporters": "^1.2.4", - "cypress-real-events": "^1.7.1", - "cypress-wait-until": "^1.7.2", - "cypress-xpath": "^1.4.0", - "eslint-plugin-cypress": "^2.11.2", - "dotenv": "^8.1.0", - "typescript": "4.5.5", - "diff": "^5.0.0", - "chalk": "^4.1.1", - "tinycolor2": "^1.4.2" - } -} diff --git a/app/client/src/utils/widgetRenderUtils.tsx b/app/client/src/utils/widgetRenderUtils.tsx index c51ca40bf9..2b06f21ecb 100644 --- a/app/client/src/utils/widgetRenderUtils.tsx +++ b/app/client/src/utils/widgetRenderUtils.tsx @@ -8,10 +8,7 @@ import { ENTITY_TYPE, } from "entities/DataTree/dataTreeFactory"; import { pick } from "lodash"; -import { - WIDGET_DSL_STRUCTURE_PROPS, - WIDGET_STATIC_PROPS, -} from "constants/WidgetConstants"; +import { WIDGET_STATIC_PROPS } from "constants/WidgetConstants"; import WidgetFactory from "./WidgetFactory"; import { WidgetProps } from "widgets/BaseWidget"; import { LoadingEntitiesState } from "reducers/evaluationReducers/loadingEntitiesReducer"; @@ -22,13 +19,8 @@ export const createCanvasWidget = ( evaluatedWidget: DataTreeWidget, specificChildProps?: string[], ) => { - /** - * WIDGET_DSL_STRUCTURE_PROPS is required for Building the List widget meta widgets - * requiresFlatWidgetChildren and hasMetaWidgets are the keys required. - */ - const widgetStaticProps = pick(canvasWidget, [ - ...Object.keys({ ...WIDGET_STATIC_PROPS, ...WIDGET_DSL_STRUCTURE_PROPS }), + ...Object.keys(WIDGET_STATIC_PROPS), ...(canvasWidget.additionalStaticProps || []), ]); diff --git a/app/client/src/widgets/ListWidgetV2/widget/index.tsx b/app/client/src/widgets/ListWidgetV2/widget/index.tsx index da69c936f6..b4bbc838b8 100644 --- a/app/client/src/widgets/ListWidgetV2/widget/index.tsx +++ b/app/client/src/widgets/ListWidgetV2/widget/index.tsx @@ -129,7 +129,6 @@ class ListWidget extends BaseWidget< prevMetaMainCanvasWidget?: MetaWidget; pageSize: number; pageChangeEventTriggerFromPageNo?: number | null; - pageSizeUpdated: boolean; static getPropertyPaneContentConfig() { return PropertyPaneContentConfig; @@ -192,23 +191,11 @@ class ListWidget extends BaseWidget< this.prevMetaContainerNames = []; this.componentRef = createRef(); this.pageSize = this.getPageSize(); - /** - * To prevent an infinite loop, we use a flag to avoid recursively updating the pageSize property. - * This is necessary because the updateWidgetProperty function does not immediately update the property, - * and calling componentDidUpdate can trigger another update, causing an endless loop. - * By using this flag, we can prevent unnecessary and incessant invocations of the updatePageSize function. - */ - this.pageSizeUpdated = false; } componentDidMount() { this.pageSize = this.getPageSize(); - - if (this.props.pageSize === this.pageSize) { - this.pageSizeUpdated = true; - } - - if (this.shouldUpdatePageSize() && !this.pageSizeUpdated) { + if (this.shouldUpdatePageSize()) { this.updatePageSize(); } @@ -244,19 +231,13 @@ class ListWidget extends BaseWidget< this.pageSize = this.getPageSize(); - if (this.shouldUpdatePageSize() && this.pageSizeUpdated) { + if (this.shouldUpdatePageSize()) { this.updatePageSize(); - this.pageSizeUpdated = false; - if (this.props.serverSidePagination && this.pageSize) { this.executeOnPageChange(); } } - if (this.props.pageSize === this.pageSize) { - this.pageSizeUpdated = true; - } - if (this.isCurrPageNoGreaterThanMaxPageNo()) { const totalRecords = this.getTotalDataCount(); diff --git a/app/server/appsmith-git/src/main/java/com/appsmith/git/service/GitExecutorImpl.java b/app/server/appsmith-git/src/main/java/com/appsmith/git/service/GitExecutorImpl.java index 1a1bedefe9..908b622ff5 100644 --- a/app/server/appsmith-git/src/main/java/com/appsmith/git/service/GitExecutorImpl.java +++ b/app/server/appsmith-git/src/main/java/com/appsmith/git/service/GitExecutorImpl.java @@ -484,8 +484,6 @@ public class GitExecutorImpl implements GitExecutor { response.setAdded(status.getAdded()); response.setRemoved(status.getRemoved()); - Set queriesModified = new HashSet<>(); - Set jsObjectsModified = new HashSet<>(); int modifiedPages = 0; int modifiedQueries = 0; int modifiedJSObjects = 0; @@ -494,20 +492,10 @@ public class GitExecutorImpl implements GitExecutor { for (String x : modifiedAssets) { if (x.contains(CommonConstants.CANVAS)) { modifiedPages++; - } else if (x.contains(GitDirectories.ACTION_DIRECTORY + "/") && !x.endsWith(".json")) { - String queryName = x.substring(x.lastIndexOf("/") + 1); - String pageName = x.split("/")[1]; - if (!queriesModified.contains(pageName + queryName)) { - queriesModified.add(pageName + queryName); - modifiedQueries++; - } - } else if (x.contains(GitDirectories.ACTION_COLLECTION_DIRECTORY + "/") && !x.endsWith(".json")) { - String queryName = x.substring(x.lastIndexOf("/") + 1); - String pageName = x.split("/")[1]; - if (!jsObjectsModified.contains(pageName + queryName)) { - jsObjectsModified.add(pageName + queryName); - modifiedJSObjects++; - } + } else if (x.contains(GitDirectories.ACTION_DIRECTORY + "/")) { + modifiedQueries++; + } else if (x.contains(GitDirectories.ACTION_COLLECTION_DIRECTORY + "/")) { + modifiedJSObjects++; } else if (x.contains(GitDirectories.DATASOURCE_DIRECTORY + "/")) { modifiedDatasources++; } else if (x.contains(GitDirectories.JS_LIB_DIRECTORY + "/")) { @@ -552,16 +540,6 @@ public class GitExecutorImpl implements GitExecutor { .subscribeOn(scheduler); } - private int getModifiedQueryCount(Set jsObjectsModified, int modifiedCount, String filePath) { - String queryName = filePath.substring(filePath.lastIndexOf("/") + 1); - String pageName = filePath.split("/")[1]; - if (!jsObjectsModified.contains(pageName + queryName)) { - jsObjectsModified.add(pageName + queryName); - modifiedCount++; - } - return modifiedCount; - } - @Override public Mono mergeBranch(Path repoSuffix, String sourceBranch, String destinationBranch) { return Mono.fromCallable(() -> { diff --git a/ci-debug.sh b/ci-debug.sh deleted file mode 100644 index 956ad88d7c..0000000000 --- a/ci-debug.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash - -cd ~ -if [ ! -f "ngrok-v3-stable-linux-amd64.tgz" ]; then - wget https://bin.equinox.io/c/bNyj1mQVY4c/ngrok-v3-stable-linux-amd64.tgz - gunzip ngrok-v3-stable-linux-amd64.tgz - tar -xvf ngrok-v3-stable-linux-amd64.tar -else - echo "Starting ngrok" -fi - -if [ -z "$1" ]; then - read -p "Please enter ngrok token: " value -else - value="$1" -fi -./ngrok config add-authtoken $value -./ngrok http 80 From 79aacc70e130652ab377d71811513487f5346262 Mon Sep 17 00:00:00 2001 From: Saroj <43822041+sarojsarab@users.noreply.github.com> Date: Fri, 10 Mar 2023 12:51:32 +0530 Subject: [PATCH 2/8] ci: CI optimisation to reduce ci-test run time and modularise docker image building (#21219) - Modularised the docker image building - Optimised the `install dependancies` step to reduce the time from 8 mins to 30-40 secs now - Removed unnecessary steps from the ci-dubugging.yml - Added ci-debug.sh file to ease the steps to run ngrok while running ci-debugging - Changes made to below files 1. integration-tests-command.yml 2. test-build-docker-image.yml 3. ci-test.yml 4. build-docker-image.yml - integration-tests-command.yml - test-build-docker-image.yml - ci-test.yml - build-docker-image.yml - Manual - [ ] Test plan has been approved by relevant developers - [ ] Test plan has been peer reviewed by QA - [ ] Cypress test cases have been added and approved by either SDET or manual QA - [ ] Organized project review call with relevant stakeholders after Round 1/2 of QA - [ ] Added Test Plan Approved label after reveiwing all Cypress test --- .github/workflows/build-docker-image.yml | 99 +++++++++++++++++++ .github/workflows/ci-debugging.yml | 95 ++++++++++++++++++ .github/workflows/ci-test.yml | 49 ++------- .../workflows/integration-tests-command.yml | 12 ++- .github/workflows/test-build-docker-image.yml | 12 ++- app/client/cypress/apply-patches.js | 2 +- app/client/cypress/package.json | 37 +++++++ ci-debug.sh | 18 ++++ 8 files changed, 281 insertions(+), 43 deletions(-) create mode 100644 .github/workflows/build-docker-image.yml create mode 100644 .github/workflows/ci-debugging.yml create mode 100644 app/client/cypress/package.json create mode 100644 ci-debug.sh diff --git a/.github/workflows/build-docker-image.yml b/.github/workflows/build-docker-image.yml new file mode 100644 index 0000000000..db2fdae24c --- /dev/null +++ b/.github/workflows/build-docker-image.yml @@ -0,0 +1,99 @@ +name: Appsmith Build Docker Image Workflow + +on: + # This line enables manual triggering of this workflow. + workflow_dispatch: + workflow_call: + inputs: + pr: + description: "This is the PR number in case the workflow is being called in a pull request" + required: false + type: number + +jobs: + build-docker: + runs-on: ubuntu-latest + if: | + github.event.pull_request.head.repo.full_name == github.repository || + github.event_name == 'push' || + github.event_name == 'workflow_dispatch' || + github.event_name == 'repository_dispatch' + defaults: + run: + shell: bash + + steps: + # Check out merge commit + - name: Fork based /ok-to-test checkout + if: inputs.pr != 0 + uses: actions/checkout@v3 + with: + fetch-depth: 0 + ref: "refs/pull/${{ inputs.pr }}/merge" + + # Checkout the code in the current branch in case the workflow is called because of a branch push event + - name: Checkout the head commit of the branch + if: inputs.pr == 0 + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + # Setup Java + - name: Set up JDK 17 + if: steps.run_result.outputs.run_result != 'success' + uses: actions/setup-java@v3 + with: + distribution: 'temurin' + java-version: '17' + + - name: Download the client build artifact + if: steps.run_result.outputs.run_result != 'success' + uses: actions/download-artifact@v3 + with: + name: client-build + path: app/client/build + + - name: Download the server build artifact + if: steps.run_result.outputs.run_result != 'success' + uses: actions/download-artifact@v3 + with: + name: server-build + path: app/server/dist/ + + - name: Download the rts build artifact + if: steps.run_result.outputs.run_result != 'success' + uses: actions/download-artifact@v3 + with: + name: rts-dist + path: app/rts/dist + + - name: Un-tar the rts folder + run: | + tar -xvf app/rts/dist/rts-dist.tar -C app/rts/ + echo "Cleaning up the tar files" + rm app/rts/dist/rts-dist.tar + + # We don't use Depot Docker builds because it's faster for local Docker images to be built locally. + # It's slower and more expensive to build these Docker images on Depot and download it back to the CI node. + - name: Build docker image + if: steps.run_result.outputs.run_result != 'success' + working-directory: "." + run: | + docker build -t cicontainer . + + # Saving the docker image to tar file + - name: Save Docker image to tar file + run: | + docker save cicontainer -o cicontainer.tar + gzip cicontainer.tar + + # Uploading the artifact to use it in other subsequent runners + - name: Upload Docker image to artifacts + uses: actions/upload-artifact@v3 + with: + name: cicontainer + path: cicontainer.tar.gz + + - name: Save the status of the run + run: echo "run_result=success" >> $GITHUB_OUTPUT > ~/run_result + \ No newline at end of file diff --git a/.github/workflows/ci-debugging.yml b/.github/workflows/ci-debugging.yml new file mode 100644 index 0000000000..aaea85da11 --- /dev/null +++ b/.github/workflows/ci-debugging.yml @@ -0,0 +1,95 @@ +name: CI Debugging + +on: + # This line enables manual triggering of this workflow. + workflow_dispatch: + inputs: + run_id: + description: 'Run id to download artifacts:' + required: true + type: number + +jobs: + ci-debugger: + runs-on: ubuntu-latest + if: github.event_name == 'workflow_dispatch' + defaults: + run: + shell: bash + strategy: + fail-fast: false + matrix: + job: [ 0 ] + + # Service containers to run with this job. Required for running tests + services: + # Label used to access the service container + redis: + # Docker Hub image for Redis + image: redis + ports: + # Opens tcp port 6379 on the host and service container + - 6379:6379 + mongo: + image: mongo + ports: + - 27017:27017 + + steps: + - name: Set up Depot CLI + uses: depot/setup-action@v1 + + - name: Checkout the head commit of the branch + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Download Docker image artifact + uses: dawidd6/action-download-artifact@v2 + with: + name: cicontainer + run_id: ${{ github.event.inputs.run_id }} + + - name: Load Docker image from tar file + run: | + gunzip cicontainer.tar.gz + docker load -i cicontainer.tar + + - name: Create folder + if: steps.run_result.outputs.run_result != 'success' + env: + APPSMITH_LICENSE_KEY: ${{ secrets.APPSMITH_LICENSE_KEY }} + working-directory: "." + run: | + mkdir -p cicontainerlocal/stacks/configuration/ + + - name: Run docker image + if: steps.run_result.outputs.run_result != 'success' + env: + APPSMITH_LICENSE_KEY: ${{ secrets.APPSMITH_LICENSE_KEY }} + working-directory: "." + run: | + sudo /etc/init.d/ssh stop ; + mkdir -p ~/git-server/keys + mkdir -p ~/git-server/repos + docker run --name test-event-driver -d -p 22:22 -p 5001:5001 -p 3306:3306 \ + -p 5432:5432 -p 28017:27017 -p 25:25 -p 5000:5000 -p 3001:3000 --privileged --pid=host --ipc=host --volume /:/host -v ~/git-server/keys:/git-server/keys \ + -v ~/git-server/repos:/git-server/repos appsmith/test-event-driver:latest + cd cicontainerlocal + docker run -d --name appsmith -p 80:80 -p 9001:9001 \ + -v "$PWD/stacks:/appsmith-stacks" -e APPSMITH_LICENSE_KEY=$APPSMITH_LICENSE_KEY \ + -e APPSMITH_DISABLE_TELEMETRY=true \ + -e APPSMITH_CLOUD_SERVICES_BASE_URL=http://host.docker.internal:5001 \ + --add-host=host.docker.internal:host-gateway \ + cicontainer + + - name: Execute access to ci-debug.sh + if: steps.run_result.outputs.run_result != 'success' + working-directory: "." + run: | + chmod +x ci-debug.sh + + # Start tmate session for tunnelling + - name: Setup tmate session + if: steps.run_result.outputs.run_result != 'success' + uses: mxschmitt/action-tmate@v3 diff --git a/.github/workflows/ci-test.yml b/.github/workflows/ci-test.yml index b6dfac30f9..4c115f2a92 100644 --- a/.github/workflows/ci-test.yml +++ b/.github/workflows/ci-test.yml @@ -116,48 +116,15 @@ jobs: - name: cat run_result run: echo ${{ steps.run_result.outputs.run_result }} - # Setup Java - - name: Set up JDK 17 - if: steps.run_result.outputs.run_result != 'success' - uses: actions/setup-java@v3 - with: - distribution: 'temurin' - java-version: '17' - - - name: Download the client build artifact - if: steps.run_result.outputs.run_result != 'success' + - name: Download Docker image artifact uses: actions/download-artifact@v3 with: - name: client-build - path: app/client/build + name: cicontainer - - name: Download the server build artifact - if: steps.run_result.outputs.run_result != 'success' - uses: actions/download-artifact@v3 - with: - name: server-build - path: app/server/dist/ - - - name: Download the rts build artifact - if: steps.run_result.outputs.run_result != 'success' - uses: actions/download-artifact@v3 - with: - name: rts-dist - path: app/rts/dist - - - name: Un-tar the rts folder + - name: Load Docker image from tar file run: | - tar -xvf app/rts/dist/rts-dist.tar -C app/rts/ - echo "Cleaning up the tar files" - rm app/rts/dist/rts-dist.tar - - # We don't use Depot Docker builds because it's faster for local Docker images to be built locally. - # It's slower and more expensive to build these Docker images on Depot and download it back to the CI node. - - name: Build docker image - if: steps.run_result.outputs.run_result != 'success' - working-directory: "." - run: | - docker build -t cicontainer . + gunzip cicontainer.tar.gz + docker load -i cicontainer.tar - name: Create folder if: steps.run_result.outputs.run_result != 'success' @@ -177,7 +144,7 @@ jobs: submodules: 'recursive' path: cicontainerlocal/oldstack - - name: Load docker image + - name: Run docker image if: steps.run_result.outputs.run_result != 'success' env: APPSMITH_LICENSE_KEY: ${{ secrets.APPSMITH_LICENSE_KEY }} @@ -208,7 +175,9 @@ jobs: if: steps.run_result.outputs.run_result != 'success' run: | cd app/client - yarn install + yarn install \ + --cwd cypress \ + --modules-folder ../node_modules - name: Setting up the cypress tests if: steps.run_result.outputs.run_result != 'success' diff --git a/.github/workflows/integration-tests-command.yml b/.github/workflows/integration-tests-command.yml index 4810e1c4d8..76f19e573d 100644 --- a/.github/workflows/integration-tests-command.yml +++ b/.github/workflows/integration-tests-command.yml @@ -56,10 +56,20 @@ jobs: with: pr: ${{ github.event.client_payload.pull_request.number }} - ci-test: + build-docker-image: needs: [ client-build, server-build, rts-build ] # Only run if the build step is successful if: success() + name: build-docker-image + uses: ./.github/workflows/build-docker-image.yml + secrets: inherit + with: + pr: ${{ github.event.client_payload.pull_request.number }} + + ci-test: + needs: [ build-docker-image ] + # Only run if the build step is successful + if: success() name: ci-test uses: ./.github/workflows/ci-test.yml secrets: inherit diff --git a/.github/workflows/test-build-docker-image.yml b/.github/workflows/test-build-docker-image.yml index 80585da910..2b4536dd4c 100644 --- a/.github/workflows/test-build-docker-image.yml +++ b/.github/workflows/test-build-docker-image.yml @@ -46,10 +46,20 @@ jobs: with: pr: 0 - ci-test: + build-docker-image: needs: [ client-build, server-build, rts-build ] # Only run if the build step is successful if: success() + name: build-docker-image + uses: ./.github/workflows/build-docker-image.yml + secrets: inherit + with: + pr: 0 + + ci-test: + needs: [ build-docker-image ] + # Only run if the build step is successful + if: success() name: ci-test uses: ./.github/workflows/ci-test.yml secrets: inherit diff --git a/app/client/cypress/apply-patches.js b/app/client/cypress/apply-patches.js index 779a04367d..d4a94ebe60 100644 --- a/app/client/cypress/apply-patches.js +++ b/app/client/cypress/apply-patches.js @@ -5,7 +5,7 @@ const fs = require("fs/promises"); const path = require("path"); async function applyPatches() { - const patchesDir = path.join("cypress", "patches"); + const patchesDir = path.join("patches"); const patchesAbsDir = path.join(process.cwd(), patchesDir); const patches = await fs.readdir(patchesAbsDir); const installDir = getVersionDir(); diff --git a/app/client/cypress/package.json b/app/client/cypress/package.json new file mode 100644 index 0000000000..aaf8f30ec9 --- /dev/null +++ b/app/client/cypress/package.json @@ -0,0 +1,37 @@ +{ + "name": "appsmith-ci-test", + "version": "0.1.0", + "private": true, + "engines": { + "node": "^16.14.0", + "npm": "^8.5.5" + }, + "scripts": { + "install": "node apply-patches.js" + }, + "browserslist": [ + ">0.2%", + "not dead", + "not ie <= 11", + "not op_mini all" + ], + "devDependencies": { + "@typescript-eslint/eslint-plugin": "^5.25.0", + "@typescript-eslint/parser": "^5.25.0", + "@faker-js/faker": "^7.4.0", + "cypress-log-to-output": "^1.1.2", + "cy-verify-downloads": "^0.0.5", + "cypress": "9.7.0", + "cypress-file-upload": "^4.1.1", + "cypress-image-snapshot": "^4.0.1", + "cypress-multi-reporters": "^1.2.4", + "cypress-real-events": "^1.7.1", + "cypress-wait-until": "^1.7.2", + "cypress-xpath": "^1.4.0", + "eslint-plugin-cypress": "^2.11.2", + "dotenv": "^8.1.0", + "typescript": "4.5.5", + "diff": "^5.0.0", + "chalk": "^4.1.1" + } +} diff --git a/ci-debug.sh b/ci-debug.sh new file mode 100644 index 0000000000..956ad88d7c --- /dev/null +++ b/ci-debug.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +cd ~ +if [ ! -f "ngrok-v3-stable-linux-amd64.tgz" ]; then + wget https://bin.equinox.io/c/bNyj1mQVY4c/ngrok-v3-stable-linux-amd64.tgz + gunzip ngrok-v3-stable-linux-amd64.tgz + tar -xvf ngrok-v3-stable-linux-amd64.tar +else + echo "Starting ngrok" +fi + +if [ -z "$1" ]; then + read -p "Please enter ngrok token: " value +else + value="$1" +fi +./ngrok config add-authtoken $value +./ngrok http 80 From 34fc5a135fc9528f04c64742f490c2be05d5a932 Mon Sep 17 00:00:00 2001 From: Saroj <43822041+sarojsarab@users.noreply.github.com> Date: Fri, 10 Mar 2023 15:06:36 +0530 Subject: [PATCH 3/8] test: fixing cypress dependency issues (#21323) ## Description - fixing cypress dependency issues ## Type of change - Cypress ## How Has This Been Tested? - Cypress ## Checklist: ### QA activity: - [ ] Test plan has been approved by relevant developers - [ ] Test plan has been peer reviewed by QA - [ ] Cypress test cases have been added and approved by either SDET or manual QA - [ ] Organized project review call with relevant stakeholders after Round 1/2 of QA - [ ] Added Test Plan Approved label after reveiwing all Cypress test --- app/client/cypress/package.json | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/client/cypress/package.json b/app/client/cypress/package.json index aaf8f30ec9..499fc20c99 100644 --- a/app/client/cypress/package.json +++ b/app/client/cypress/package.json @@ -16,6 +16,11 @@ "not op_mini all" ], "devDependencies": { + "@blueprintjs/core": "^3.36.0", + "@blueprintjs/datetime": "^3.23.6", + "@blueprintjs/icons": "^3.10.0", + "@blueprintjs/popover2": "^0.5.0", + "@blueprintjs/select": "^3.10.0", "@typescript-eslint/eslint-plugin": "^5.25.0", "@typescript-eslint/parser": "^5.25.0", "@faker-js/faker": "^7.4.0", @@ -32,6 +37,7 @@ "dotenv": "^8.1.0", "typescript": "4.5.5", "diff": "^5.0.0", - "chalk": "^4.1.1" + "chalk": "^4.1.1", + "tinycolor2": "^1.4.2" } } From 0d63847c3137a6b49f3818df8c620665011077dc Mon Sep 17 00:00:00 2001 From: Saroj <43822041+sarojsarab@users.noreply.github.com> Date: Fri, 10 Mar 2023 16:26:20 +0530 Subject: [PATCH 4/8] ci: Added steps to use the pre built docker image instead of building a new one (#21318) ## Description - Added steps to use the pre built docker image instead of building a new one in perf-test.yml ## Type of change - perf-test.yml ## How Has This Been Tested? - Manual ## Checklist: ### QA activity: - [ ] Test plan has been approved by relevant developers - [ ] Test plan has been peer reviewed by QA - [ ] Cypress test cases have been added and approved by either SDET or manual QA - [ ] Organized project review call with relevant stakeholders after Round 1/2 of QA - [ ] Added Test Plan Approved label after reveiwing all Cypress test --- .../workflows/integration-tests-command.yml | 2 +- .github/workflows/perf-test.yml | 53 ++++--------------- .github/workflows/test-build-docker-image.yml | 20 +++---- 3 files changed, 21 insertions(+), 54 deletions(-) diff --git a/.github/workflows/integration-tests-command.yml b/.github/workflows/integration-tests-command.yml index 76f19e573d..cf732f6d47 100644 --- a/.github/workflows/integration-tests-command.yml +++ b/.github/workflows/integration-tests-command.yml @@ -77,7 +77,7 @@ jobs: pr: ${{ github.event.client_payload.pull_request.number }} perf-test: - needs: [ client-build, server-build, rts-build ] + needs: [ build-docker-image ] # Only run if the build step is successful if: success() name: perf-test diff --git a/.github/workflows/perf-test.yml b/.github/workflows/perf-test.yml index 2e80681abf..64c40b92a7 100644 --- a/.github/workflows/perf-test.yml +++ b/.github/workflows/perf-test.yml @@ -107,53 +107,21 @@ jobs: if: steps.run_result.outputs.run_result != 'success' run: yarn install --frozen-lockfile - # Setup Java - - name: Set up JDK 17 - if: steps.run_result.outputs.run_result != 'success' - uses: actions/setup-java@v3 - with: - distribution: 'temurin' - java-version: '17' - - - name: Download the react build artifact - if: steps.run_result.outputs.run_result != 'success' - uses: actions/download-artifact@v3 - with: - name: client-build - path: app/client/build - - - name: Download the server build artifact - if: steps.run_result.outputs.run_result != 'success' - uses: actions/download-artifact@v3 - with: - name: server-build - path: app/server/dist - - - name: Download the rts build artifact - uses: actions/download-artifact@v3 - with: - name: rts-dist - path: app/rts/dist - - - name: Un-tar the rts folder - working-directory: "." - run: | - tar -xvf app/rts/dist/rts-dist.tar -C app/rts/ - echo "Cleaning up the tar files" - rm app/rts/dist/rts-dist.tar - - name: Installing Yarn serve if: steps.run_result.outputs.run_result != 'success' run: | yarn global add serve echo "$(yarn global bin)" >> $GITHUB_PATH - # We don't use Depot Docker builds because it's faster for local Docker images to be built locally. - # It's slower and more expensive to build these Docker images on Depot and download it back to the CI node. - - name: Build docker image - if: steps.run_result.outputs.run_result != 'success' - working-directory: "." + + - name: Download Docker image artifact + uses: actions/download-artifact@v3 + with: + name: cicontainer + + - name: Load Docker image from tar file run: | - docker build -t cicontainer . + gunzip cicontainer.tar.gz + docker load -i cicontainer.tar - name: Create folder if: steps.run_result.outputs.run_result != 'success' @@ -163,8 +131,7 @@ jobs: run: | mkdir -p cicontainerlocal/stacks/configuration/ - - - name: Load docker image + - name: Run docker image if: steps.run_result.outputs.run_result != 'success' env: APPSMITH_LICENSE_KEY: ${{ secrets.APPSMITH_LICENSE_KEY }} diff --git a/.github/workflows/test-build-docker-image.yml b/.github/workflows/test-build-docker-image.yml index 2b4536dd4c..6ba9f88479 100644 --- a/.github/workflows/test-build-docker-image.yml +++ b/.github/workflows/test-build-docker-image.yml @@ -36,16 +36,6 @@ jobs: with: pr: 0 - perf-test: - needs: [client-build, server-build, rts-build] - # Only run if the build step is successful - if: success() - name: perf-test - uses: ./.github/workflows/perf-test.yml - secrets: inherit - with: - pr: 0 - build-docker-image: needs: [ client-build, server-build, rts-build ] # Only run if the build step is successful @@ -56,6 +46,16 @@ jobs: with: pr: 0 + perf-test: + needs: [ build-docker-image ] + # Only run if the build step is successful + if: success() + name: perf-test + uses: ./.github/workflows/perf-test.yml + secrets: inherit + with: + pr: 0 + ci-test: needs: [ build-docker-image ] # Only run if the build step is successful From d8ce162c60bd93724efb8714d2676a7192c9e665 Mon Sep 17 00:00:00 2001 From: Anagh Hegde Date: Fri, 10 Mar 2023 17:27:39 +0530 Subject: [PATCH 5/8] fix: Added fix for the status API (#21321) ## Description Fixed the status API call displaying the wrong number for the git. --------- Co-authored-by: Tolulope Adetula <31691737+Tooluloope@users.noreply.github.com> --- .../appsmith/git/service/GitExecutorImpl.java | 30 ++++++++++++++++--- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/app/server/appsmith-git/src/main/java/com/appsmith/git/service/GitExecutorImpl.java b/app/server/appsmith-git/src/main/java/com/appsmith/git/service/GitExecutorImpl.java index 908b622ff5..1a1bedefe9 100644 --- a/app/server/appsmith-git/src/main/java/com/appsmith/git/service/GitExecutorImpl.java +++ b/app/server/appsmith-git/src/main/java/com/appsmith/git/service/GitExecutorImpl.java @@ -484,6 +484,8 @@ public class GitExecutorImpl implements GitExecutor { response.setAdded(status.getAdded()); response.setRemoved(status.getRemoved()); + Set queriesModified = new HashSet<>(); + Set jsObjectsModified = new HashSet<>(); int modifiedPages = 0; int modifiedQueries = 0; int modifiedJSObjects = 0; @@ -492,10 +494,20 @@ public class GitExecutorImpl implements GitExecutor { for (String x : modifiedAssets) { if (x.contains(CommonConstants.CANVAS)) { modifiedPages++; - } else if (x.contains(GitDirectories.ACTION_DIRECTORY + "/")) { - modifiedQueries++; - } else if (x.contains(GitDirectories.ACTION_COLLECTION_DIRECTORY + "/")) { - modifiedJSObjects++; + } else if (x.contains(GitDirectories.ACTION_DIRECTORY + "/") && !x.endsWith(".json")) { + String queryName = x.substring(x.lastIndexOf("/") + 1); + String pageName = x.split("/")[1]; + if (!queriesModified.contains(pageName + queryName)) { + queriesModified.add(pageName + queryName); + modifiedQueries++; + } + } else if (x.contains(GitDirectories.ACTION_COLLECTION_DIRECTORY + "/") && !x.endsWith(".json")) { + String queryName = x.substring(x.lastIndexOf("/") + 1); + String pageName = x.split("/")[1]; + if (!jsObjectsModified.contains(pageName + queryName)) { + jsObjectsModified.add(pageName + queryName); + modifiedJSObjects++; + } } else if (x.contains(GitDirectories.DATASOURCE_DIRECTORY + "/")) { modifiedDatasources++; } else if (x.contains(GitDirectories.JS_LIB_DIRECTORY + "/")) { @@ -540,6 +552,16 @@ public class GitExecutorImpl implements GitExecutor { .subscribeOn(scheduler); } + private int getModifiedQueryCount(Set jsObjectsModified, int modifiedCount, String filePath) { + String queryName = filePath.substring(filePath.lastIndexOf("/") + 1); + String pageName = filePath.split("/")[1]; + if (!jsObjectsModified.contains(pageName + queryName)) { + jsObjectsModified.add(pageName + queryName); + modifiedCount++; + } + return modifiedCount; + } + @Override public Mono mergeBranch(Path repoSuffix, String sourceBranch, String destinationBranch) { return Mono.fromCallable(() -> { From 54b54ce117ee9e4cee720eb9e457f1ceabe0e5e4 Mon Sep 17 00:00:00 2001 From: Tolulope Adetula <31691737+Tooluloope@users.noreply.github.com> Date: Fri, 10 Mar 2023 14:17:20 +0000 Subject: [PATCH 6/8] fix: list widget in form widget (#21329) The list widget should be visible in the Form widget. Also, updatePageNo shouldn't be called recursively when the List widget Height is adjusted. --- .../cypress/fixtures/listv2PaginationDsl.json | 1 + .../ListV2/ListV2_PageNo_PageSize_spec.js | 7 ------ app/client/src/utils/widgetRenderUtils.tsx | 12 ++++++++-- .../src/widgets/ListWidgetV2/widget/index.tsx | 23 +++++++++++++++++-- 4 files changed, 32 insertions(+), 11 deletions(-) diff --git a/app/client/cypress/fixtures/listv2PaginationDsl.json b/app/client/cypress/fixtures/listv2PaginationDsl.json index 824a0b7cf5..2facbd179e 100644 --- a/app/client/cypress/fixtures/listv2PaginationDsl.json +++ b/app/client/cypress/fixtures/listv2PaginationDsl.json @@ -77,6 +77,7 @@ "displayName": "List V2", "iconSVG": "/static/media/icon.9925ee17dee37bf1ba7374412563a8a7.svg", "topRow": 5, + "pageSize": 4, "bottomRow": 60, "parentRowSpace": 10, "currentItemsView": "{{[]}}", diff --git a/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/Widgets/ListV2/ListV2_PageNo_PageSize_spec.js b/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/Widgets/ListV2/ListV2_PageNo_PageSize_spec.js index ecfd29dd2e..9841d76b17 100644 --- a/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/Widgets/ListV2/ListV2_PageNo_PageSize_spec.js +++ b/app/client/cypress/integration/Regression_TestSuite/ClientSideTests/Widgets/ListV2/ListV2_PageNo_PageSize_spec.js @@ -137,13 +137,6 @@ describe("List widget V2 page number and page size", () => { }); cy.openPropertyPane("listwidgetv2"); - // toggle serversidepagination -> true - cy.togglebar(".t--property-control-serversidepagination input"); - cy.wait("@updateLayout"); - - // toggle serversidepagination -> false - cy.togglebarDisable(".t--property-control-serversidepagination input"); - cy.openPropertyPane("textwidget"); cy.testJsontextclear("text"); cy.testJsontext("text", `PageSize {{List1.pageSize}}`); diff --git a/app/client/src/utils/widgetRenderUtils.tsx b/app/client/src/utils/widgetRenderUtils.tsx index 2b06f21ecb..c51ca40bf9 100644 --- a/app/client/src/utils/widgetRenderUtils.tsx +++ b/app/client/src/utils/widgetRenderUtils.tsx @@ -8,7 +8,10 @@ import { ENTITY_TYPE, } from "entities/DataTree/dataTreeFactory"; import { pick } from "lodash"; -import { WIDGET_STATIC_PROPS } from "constants/WidgetConstants"; +import { + WIDGET_DSL_STRUCTURE_PROPS, + WIDGET_STATIC_PROPS, +} from "constants/WidgetConstants"; import WidgetFactory from "./WidgetFactory"; import { WidgetProps } from "widgets/BaseWidget"; import { LoadingEntitiesState } from "reducers/evaluationReducers/loadingEntitiesReducer"; @@ -19,8 +22,13 @@ export const createCanvasWidget = ( evaluatedWidget: DataTreeWidget, specificChildProps?: string[], ) => { + /** + * WIDGET_DSL_STRUCTURE_PROPS is required for Building the List widget meta widgets + * requiresFlatWidgetChildren and hasMetaWidgets are the keys required. + */ + const widgetStaticProps = pick(canvasWidget, [ - ...Object.keys(WIDGET_STATIC_PROPS), + ...Object.keys({ ...WIDGET_STATIC_PROPS, ...WIDGET_DSL_STRUCTURE_PROPS }), ...(canvasWidget.additionalStaticProps || []), ]); diff --git a/app/client/src/widgets/ListWidgetV2/widget/index.tsx b/app/client/src/widgets/ListWidgetV2/widget/index.tsx index b4bbc838b8..da69c936f6 100644 --- a/app/client/src/widgets/ListWidgetV2/widget/index.tsx +++ b/app/client/src/widgets/ListWidgetV2/widget/index.tsx @@ -129,6 +129,7 @@ class ListWidget extends BaseWidget< prevMetaMainCanvasWidget?: MetaWidget; pageSize: number; pageChangeEventTriggerFromPageNo?: number | null; + pageSizeUpdated: boolean; static getPropertyPaneContentConfig() { return PropertyPaneContentConfig; @@ -191,11 +192,23 @@ class ListWidget extends BaseWidget< this.prevMetaContainerNames = []; this.componentRef = createRef(); this.pageSize = this.getPageSize(); + /** + * To prevent an infinite loop, we use a flag to avoid recursively updating the pageSize property. + * This is necessary because the updateWidgetProperty function does not immediately update the property, + * and calling componentDidUpdate can trigger another update, causing an endless loop. + * By using this flag, we can prevent unnecessary and incessant invocations of the updatePageSize function. + */ + this.pageSizeUpdated = false; } componentDidMount() { this.pageSize = this.getPageSize(); - if (this.shouldUpdatePageSize()) { + + if (this.props.pageSize === this.pageSize) { + this.pageSizeUpdated = true; + } + + if (this.shouldUpdatePageSize() && !this.pageSizeUpdated) { this.updatePageSize(); } @@ -231,13 +244,19 @@ class ListWidget extends BaseWidget< this.pageSize = this.getPageSize(); - if (this.shouldUpdatePageSize()) { + if (this.shouldUpdatePageSize() && this.pageSizeUpdated) { this.updatePageSize(); + this.pageSizeUpdated = false; + if (this.props.serverSidePagination && this.pageSize) { this.executeOnPageChange(); } } + if (this.props.pageSize === this.pageSize) { + this.pageSizeUpdated = true; + } + if (this.isCurrPageNoGreaterThanMaxPageNo()) { const totalRecords = this.getTotalDataCount(); From 16177eff56dfae34dd8443ef1a42cdd7cafeecde Mon Sep 17 00:00:00 2001 From: Saroj <43822041+sarojsarab@users.noreply.github.com> Date: Fri, 10 Mar 2023 20:45:59 +0530 Subject: [PATCH 7/8] ci: Updated the path to download the artifact in perf-test.yml (#21339) ## Description - Updated the path to download the artifact in perf-test.yml ## Type of change - perf-test.yml ## How Has This Been Tested? - Manual ## Checklist: ### QA activity: - [ ] Test plan has been approved by relevant developers - [ ] Test plan has been peer reviewed by QA - [ ] Cypress test cases have been added and approved by either SDET or manual QA - [ ] Organized project review call with relevant stakeholders after Round 1/2 of QA - [ ] Added Test Plan Approved label after reveiwing all Cypress test --- .github/workflows/perf-test.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/perf-test.yml b/.github/workflows/perf-test.yml index 64c40b92a7..7457c46506 100644 --- a/.github/workflows/perf-test.yml +++ b/.github/workflows/perf-test.yml @@ -117,8 +117,10 @@ jobs: uses: actions/download-artifact@v3 with: name: cicontainer + path: app/client - name: Load Docker image from tar file + working-directory: "." run: | gunzip cicontainer.tar.gz docker load -i cicontainer.tar From a10532f82857efce4a2798a9c7961d6b3ea199fb Mon Sep 17 00:00:00 2001 From: Saroj <43822041+sarojsarab@users.noreply.github.com> Date: Fri, 10 Mar 2023 23:49:15 +0530 Subject: [PATCH 8/8] ci: Fixing the working directory in perf-test.yml (#21341) ## Description - Fixing the working directory in perf-test.yml ## Type of change - perf-test.yml ## How Has This Been Tested? - Manual ## Checklist: ### QA activity: - [ ] Test plan has been approved by relevant developers - [ ] Test plan has been peer reviewed by QA - [ ] Cypress test cases have been added and approved by either SDET or manual QA - [ ] Organized project review call with relevant stakeholders after Round 1/2 of QA - [ ] Added Test Plan Approved label after reveiwing all Cypress test --- .github/workflows/perf-test.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/perf-test.yml b/.github/workflows/perf-test.yml index 7457c46506..6e7da86d4d 100644 --- a/.github/workflows/perf-test.yml +++ b/.github/workflows/perf-test.yml @@ -117,7 +117,6 @@ jobs: uses: actions/download-artifact@v3 with: name: cicontainer - path: app/client - name: Load Docker image from tar file working-directory: "."