From ad2c9c060b298f1949c5defbf5d8a164c2d8eeaa Mon Sep 17 00:00:00 2001 From: Nilansh Bansal Date: Fri, 27 Jan 2023 23:13:20 +0530 Subject: [PATCH] feat: Collapse invisible widgets Field for Auto-height (#20142) ## Description > This PR implements the backend APIs for Invisible widgets in Auto-height containers > Notion doc here: https://www.notion.so/appsmith/Invisible-widgets-in-auto-height-containers-460c6bf4e0a342e4a1fa4955f7f6c461 > Frontend feature implementation here: https://github.com/appsmithorg/appsmith/pull/20118 Fixes #19983 ## Type of change - New feature (non-breaking change which adds functionality) ## How Has This Been Tested? - Manual - JUnit ## Checklist: ### Dev activity - [x] My code follows the style guidelines of this project - [x] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [x] I have added tests that prove my fix is effective or that my feature works - [x] New and existing unit tests pass locally with my changes - [x] PR is being merged under a feature flag ### 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 --- .../src/main/java/com/appsmith/server/domains/Application.java | 3 +++ .../server/services/ce/ApplicationPageServiceCEImpl.java | 1 + .../appsmith/server/services/ce/ApplicationServiceCETest.java | 1 + 3 files changed, 5 insertions(+) diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/domains/Application.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/domains/Application.java index 7ef804c03a..7da580c899 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/domains/Application.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/domains/Application.java @@ -123,6 +123,8 @@ public class Application extends BaseDomain { @JsonIgnore AppPositioning unpublishedAppPositioning; + Boolean collapseInvisibleWidgets; + /** * Earlier this was returning value of the updatedAt property in the base domain. * As this property is modified by the framework when there is any change in domain, @@ -192,6 +194,7 @@ public class Application extends BaseDomain { this.unpublishedNavigationSetting = application.getUnpublishedNavigationSetting() == null ? null : new NavigationSetting(); this.publishedNavigationSetting = application.getPublishedNavigationSetting() == null ? null : new NavigationSetting(); this.unpublishedCustomJSLibs = application.getUnpublishedCustomJSLibs(); + this.collapseInvisibleWidgets = application.getCollapseInvisibleWidgets(); } public void exportApplicationPages(final Map pageIdToNameMap) { diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/ApplicationPageServiceCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/ApplicationPageServiceCEImpl.java index 2f4bbb6224..d290edb877 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/ApplicationPageServiceCEImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/ApplicationPageServiceCEImpl.java @@ -318,6 +318,7 @@ public class ApplicationPageServiceCEImpl implements ApplicationPageServiceCE { application.setPublishedPages(new ArrayList<>()); application.setUnpublishedCustomJSLibs(new HashSet<>()); + application.setCollapseInvisibleWidgets(Boolean.TRUE); // For all new applications being created, set it to use the latest evaluation version. application.setEvaluationVersion(EVALUATION_VERSION); diff --git a/app/server/appsmith-server/src/test/java/com/appsmith/server/services/ce/ApplicationServiceCETest.java b/app/server/appsmith-server/src/test/java/com/appsmith/server/services/ce/ApplicationServiceCETest.java index 4db22e5a6e..3354570827 100644 --- a/app/server/appsmith-server/src/test/java/com/appsmith/server/services/ce/ApplicationServiceCETest.java +++ b/app/server/appsmith-server/src/test/java/com/appsmith/server/services/ce/ApplicationServiceCETest.java @@ -345,6 +345,7 @@ public class ApplicationServiceCETest { assertThat(application.getColor()).isNotEmpty(); assertThat(application.getEditModeThemeId()).isEqualTo(defaultThemeId); assertThat(application.getPublishedModeThemeId()).isEqualTo(defaultThemeId); + assertThat(application.getCollapseInvisibleWidgets()).isEqualTo(TRUE); List permissionGroups = tuple2.getT3(); PermissionGroup adminPermissionGroup = permissionGroups.stream()