From 6e4805d5bd744f32437506dbbb2516e65a62b563 Mon Sep 17 00:00:00 2001 From: Nilansh Bansal Date: Thu, 29 Dec 2022 18:09:12 +0530 Subject: [PATCH] feat: Adding Navigation Settings Functionality (#19272) ## Description > This PR implements backend model and APIs for Part 1 of Improved App Viewer Navigation Project i.e implementing the navigation configuration settings > [Notion Doc](https://www.notion.so/appsmith/Improved-app-viewer-navigation-6126afa2a3694cad84382874a3f1bd9d#9d20423e53a54ec898083ab41f388af2) > [Figma Design](https://www.figma.com/proto/EkPT7FdqmArkk9L7mySA5S/NAV---Designs?page-id=748%3A313757&node-id=935%3A478734&viewport=303%2C-336%2C0.04&scaling=min-zoom&starting-point-node-id=935%3A478734) Implements #19163 ## Implementation It reuses the following existing APIs to implement storing and fetching navigation settings: /api/v1/applications/{applicationId} (PUT) /api/v1/pages?applicationId=\(GET) Additional fields `unpublishedNavigationSetting` and `publishedNavigationSetting` have been added to the `application` collection. ## Type of change - New feature (non-breaking change which adds functionality) ## How Has This Been Tested? - Manual ## Testing Results > Postman testing results attached below **Update publishedNavigationSetting API** - API Route: /api/v1/applications/{applicationId} - API Method: PUT - API JSON Response: [http://jsonblob.com/1057577523797573632](http://jsonblob.com/1057577523797573632) image **Update unpublishedNavigationSetting API** - API Route: /api/v1/applications/{applicationId} - API Method: PUT - API JSON Response: [http://jsonblob.com/1057578112661078016](http://jsonblob.com/1057578112661078016) image **Database Record** image **GET Published and Unpublished Navigation Settings API** - API Route: /api/v1/pages?applicationId=\ - API Method: GET - API JSON Response: [http://jsonblob.com/1057580262598393856](http://jsonblob.com/1057580262598393856) image ## Checklist: ### Dev activity - [x] My code follows the style guidelines of this project - [x] I have performed a self-review of my own code - [x] 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 - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] 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 --- .../appsmith/server/domains/Application.java | 27 +++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) 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 8b301d6333..8f1c822863 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 @@ -47,6 +47,7 @@ public class Application extends BaseDomain { TODO: remove default values from application. */ @JsonProperty(access = JsonProperty.Access.READ_ONLY) + @Deprecated(forRemoval = true) Boolean isPublic = false; List pages; @@ -109,6 +110,11 @@ public class Application extends BaseDomain { EmbedSetting embedSetting; + NavigationSetting unpublishedNavigationSetting; + + NavigationSetting publishedNavigationSetting; + + /** * 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, @@ -251,11 +257,28 @@ public class Application extends BaseDomain { * EmbedSetting is used for embedding Appsmith apps on other platforms */ @Data - @NoArgsConstructor - @AllArgsConstructor public static class EmbedSetting { private String height; private String width; private Boolean showNavigationBar; } + + + /** + * NavigationSetting stores the navigation configuration for the app + */ + @Data + public static class NavigationSetting { + private Boolean showNavbar; + private String orientation; + private String navStyle; + private String position; + private String itemStyle; + private String colorStyle; + private String logoAssetId; + private String logoConfiguration; + private Boolean showSignIn; + private Boolean showShareApp; + } + }