From 37715085f34793c64ffefd1fbf292eb221bdfb4e Mon Sep 17 00:00:00 2001 From: sneha122 Date: Fri, 5 Jul 2024 15:09:39 +0530 Subject: [PATCH] fix: snowflake imports issue fixed (#34745) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Description This PR fixes the intermittent issue in snowflake, where if we import the app containing snowflake and if we open the datasource it in edit mode, password field was not there. Root cause: When we are on slow 3g and when we don’t wait for datasources to load in reconnect dialog and quickly go to application, the authentication object does not get set, which causes snowflake password conditions to break and it does not show up. We tried by simulating slow 3g on all environments and were able to reproduce it Steps to test: - We can try importing following app json and simulating slow 3g in network tab - Once app is imported, when we see reconnect modal, quickly click on go to application before the datasources are loaded in the modal [Snow issue_aparna.json](https://github.com/user-attachments/files/16107584/Snow.issue_aparna.json) Fixes #`Issue Number` _or_ Fixes `Issue URL` > [!WARNING] > _If no issue exists, please create an issue first, and check with the maintainers if the issue is valid._ ## Automation /ok-to-test tags="@tag.Sanity" ### :mag: Cypress test results > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: > Commit: 9868be55568774565f9c675d8cec92b12eb55d70 > Cypress dashboard. > Tags: `@tag.Sanity` >
Fri, 05 Jul 2024 09:38:19 UTC ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [x] No ## Summary by CodeRabbit - **New Features** - Introduced a new comparison operation `DEFINED_AND_NOT_EQUALS` for form controls. - **Bug Fixes** - Updated the Snowflake plugin to use `DEFINED_AND_NOT_EQUALS` for better validation of authentication type configurations. - **Improvements** - Enhanced form control logic to support more precise comparison checks. Co-authored-by: “sneha122” <“sneha@appsmith.com”> --- app/client/src/components/formControls/BaseControl.tsx | 3 ++- app/client/src/components/formControls/utils.ts | 2 ++ .../snowflakePlugin/src/main/resources/form.json | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/client/src/components/formControls/BaseControl.tsx b/app/client/src/components/formControls/BaseControl.tsx index 7f2e7c12416..6bf3ad21ae2 100644 --- a/app/client/src/components/formControls/BaseControl.tsx +++ b/app/client/src/components/formControls/BaseControl.tsx @@ -21,7 +21,8 @@ export type ComparisonOperations = | "IN" | "NOT_IN" | "FEATURE_FLAG" - | "VIEW_MODE"; + | "VIEW_MODE" + | "DEFINED_AND_NOT_EQUALS"; export enum ComparisonOperationsEnum { VIEW_MODE = "VIEW_MODE", diff --git a/app/client/src/components/formControls/utils.ts b/app/client/src/components/formControls/utils.ts index b5e78233dff..4ec2bd0e7c8 100644 --- a/app/client/src/components/formControls/utils.ts +++ b/app/client/src/components/formControls/utils.ts @@ -255,6 +255,8 @@ export const caculateIsHidden = ( case "VIEW_MODE": // This can be used to decide which form controls to show in view mode or edit mode depending on the value. return viewMode === value; + case "DEFINED_AND_NOT_EQUALS": + return !!valueAtPath && valueAtPath !== value; default: return true; } diff --git a/app/server/appsmith-plugins/snowflakePlugin/src/main/resources/form.json b/app/server/appsmith-plugins/snowflakePlugin/src/main/resources/form.json index 8053ec58f28..265cb6df3f0 100644 --- a/app/server/appsmith-plugins/snowflakePlugin/src/main/resources/form.json +++ b/app/server/appsmith-plugins/snowflakePlugin/src/main/resources/form.json @@ -95,7 +95,7 @@ }, { "path": "datasourceConfiguration.authentication.authenticationType", - "comparison": "NOT_EQUALS", + "comparison": "DEFINED_AND_NOT_EQUALS", "value": "dbAuth" } ]